-
-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor CI Support #153
Refactor CI Support #153
Conversation
mindw
commented
Apr 29, 2015
- Added appveyor support (testing on Windows) https://ci.appveyor.com/project/mindw/pyjwt
- Refactored tox.ini to eliminate duplication using recent tox features.
- Refactor setup.py
- Convert jwt script to entrypoint - make it usable on Windows.
- Refactor setup.py to eliminate customizations.
Thanks for the PR. Looks like things aren't quite right yet... The coverage numbers seem off a bit |
Yes it is expected. The jwt script was moved to reside inside the source tree but no tests for it exist. Only two configurations retained they original name so they reflect a 10% drop in coverage. It was always there, undetected. |
Yea, we either need to write tests for that thing or get rid of it as discussed in #130 to get rid of this coverage issue. |
What about the contrib stuff? Isn't it redundant given the use of cryptography? |
The contrib stuff is basically the old pre-cryptography code that we reintroduced a few months back. Some users who were using PyJWT reported they were unable to use RSA on Google App Engine because it doesn't allow for compiling modules with C extensions. As a result, cryptography isn't an option so we brought the code back so they could fallback on PyCrypto if needed in GAE and similar scenarios. |
Ok. Please note that you need to setup and account on appveyor for its badge. Any other comments for this pull request? |
if line.startswith('__version__'): | ||
exec(line, None, _locals) | ||
__version__ = _locals['__version__'] | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mindw any specific reason for these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, why are we manually reading this in instead of doing a simple import
like we were previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import happens before any of the project dependencies are installed and it will fail in case they are missing. A better variant og the above is to have a _version.py file in the project with the version and 'exec' it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking into using setuptools_scm instead which will eliminate the version bookkeeping alltogher,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see when it might actually fail. Let's do this instead.
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
version = get_version('jwt')
That's what we use here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see the discussion here for recommendations:
http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package
Please review my latest version which eliminates 'version' extraction completely while providing automatic version management.
@mindw I think next steps here should be simplifying this PR down to the changes for appveyor, travis, and tox. I'm mostly 👎 on setuptools-scm as I don't think that's currently an issue. I'd like a separate PR for actually removing @mark-adams I'm I missing something else? |
@mark-adams My apologies for the delayed answer. The issue at had is how to share the version number between the package itself and the metadata. Currently there are two possibilities:
The reasons why options 1 is better are:
The perceived negatives are the the setup_requires dependencies. Which is irrelevant when providing wheels. @jpadilla advocates 2. Which does not have the above additional advantages but is a solution to the problem. _locals = {}
with open('jwt/_version.py') as fp:
exec(fp.read(), None, _locals)
__version__ = _locals['__version__'] Simple and compatible with any pep 440. A good discussion can be found here. |
@jpadilla It is unlikely I can spare the time and effort to split this small pull into even smaller parts. If it will help I can do some minor fixups. It was never my intention for this to consume so much time. |