Skip to content

Update to work with latest tech stack - #26

Merged
micolous merged 14 commits into
mithro:masterfrom
pganssle:fix_tzabbr
Jun 20, 2019
Merged

Update to work with latest tech stack#26
micolous merged 14 commits into
mithro:masterfrom
pganssle:fix_tzabbr

Conversation

@pganssle

@pganssle pganssle commented Jun 11, 2019

Copy link
Copy Markdown
Contributor

This has many changes, but this was necessary to update various parts of the module's stack (there's been a lot of churn in packaging these past few years, so that part had pretty aggressively bit-rotted).

The biggest changes are:

  1. Converted over to using PEP 517 for builds, which allows us to drop a lot of the conditional logic in setup.py.
  2. Updated the URL for the CLDR data, which has moved since the last time this was updated.
  3. Made tzabbr a real, usable tzinfo, since that is what dateutil is expecting - even though it's a thin proxy over an underlying pytz zone.
  4. Somewhat related to issue 1, I've changed the release stack to use pep517.build to run the builds and twine to upload them. This avoids setup.py invocations entirely, which is desirable.
  5. I have switched the test runner over from using setup.py test (deprecated) to using tox, which allows you to declare dependencies per-environment, runs the tests in a virtual environment, etc.
  6. Removed run_tests_all_pytz.py. Because it was trying to act as some sort of PyPI client and pip installing old versions of pytz. I think this would be better accomplished with parametrized tox environment, but I'm not really sure it's necessary at all - pytz is very stable these days, as is this project.

Fixes #25.

I'll note that this also really could use a python_requires in the setup(), but I wasn't sure which versions are supported.

@pganssle
pganssle force-pushed the fix_tzabbr branch 4 times, most recently from c844e90 to 9f49fe0 Compare June 11, 2019 20:43
Comment thread datetime_tz/pytz_abbr.py
Comment thread datetime_tz/pytz_abbr.py
@pganssle
pganssle force-pushed the fix_tzabbr branch 2 times, most recently from f29969a to db04ede Compare June 12, 2019 01:11
Comment thread datetime_tz/pytz_abbr.py
def utcoffset(self, dt):
return self._get_localized(dt).utcoffset() # pragma: no cover

def dst(self, dt):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dst needs to be a method (as this is) but above in the constructor you set .dst as an attribute.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, good catch, changed it to is_dst.

Would be nice to get actual coverage of this and utcoffset, but it seems wrong to add a test for something that should not really be part of the public interface.

pganssle added 10 commits June 12, 2019 15:38
dateutil expects tzinfos to return an actual tzinfo object, which is
causing failures with recent versions. This switches tzabbr over to
acting as a proxy for its associated pytz zone rather than a passive
label.
This should be able to build a single universal wheel, so there is no
need for separate Python 2 and Python 3 releases.

This also uses PEP 517 for the builds and drops invocations of setup.py
If this is necessary, it should probably be done in a CI stage, or with
parametrized tox environments.
micolous added 2 commits June 20, 2019 14:53
When the default locale cannot be detected, `locale.getdefaultlocale` may return `(None, None)`. This works around the issue.
This makes the mock functions work like the underlying builtin.
@micolous
micolous merged commit c4b64b4 into mithro:master Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Appears to be broken on new versions of Python

3 participants