Skip to content
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

Switch to autover #214

Merged
merged 8 commits into from Mar 5, 2018
Merged

Switch to autover #214

merged 8 commits into from Mar 5, 2018

Conversation

ceball
Copy link
Member

@ceball ceball commented Mar 5, 2018

Changes:

  • param.__version__ now complies with pep440, and is a string
  • param.version.Version uses a different versioning scheme from before; see autover for more details.

@coveralls
Copy link

coveralls commented Mar 5, 2018

Coverage Status

Coverage decreased (-1.03%) to 74.65% when pulling 0954adf on autover into aa087db on master.

@@ -36,10 +36,13 @@
# only two required files.
try:
from .version import Version
__version__ = Version(release=(1,5,1), fpath=__file__,
commit="$Format:%h$", reponame="param")
_version = Version(release=None, fpath=__file__,
Copy link
Member

Choose a reason for hiding this comment

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

Will autover accept (1,5,1) and do something reasonable with it, so that people who have been using the old param.version.Version won't have problems?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so as autover.Version is based on the old param.Version. The issues are:

  1. Supporting the old behavior properly makes things more complicated.
  2. This old approach is not properly tested.

I'm pretty sure it will be accepted but I can't guarantee it will do the right thing! I think the original unit tests were moved to autover but I would need to check how many remain.

Copy link
Contributor

Choose a reason for hiding this comment

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

I should add that we are the only people who used param.Version as far as I know (unlikely autover it wasn't a separate project and it wasn't advertised).

Copy link
Contributor

Choose a reason for hiding this comment

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

One option would be to explicitly disallow these tuples making sure that projects depending on the next param release have to update to the new approach.

Copy link
Member

Choose a reason for hiding this comment

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

We haven't advertised it recently, but it has always been available for use, the code at the top of the old Version file explained exactly how to use it in external projects, and though it's been years now, I definitely recommended it in various talks to audiences I have now forgotten.

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't release be None by default, then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

The way it is specified in the line above is explicit but not strictly necessary. Explicit is good though!

Copy link
Member

Choose a reason for hiding this comment

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

But since this is code that gets copied into every new project, I'd rather have it as short as possible here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in 0954adf. The version declaration shouldn't be copied verbatim between projects but I agree it is worth making this short as it is the reference example!

setup.py Outdated
try:
version = importlib.import_module(reponame + ".version") # Bundled
except:
version = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll just note that the shortened version looks fine! We can return to it later but for now, it is safest to stick to what is properly tested in autover.

@jlstevens
Copy link
Contributor

jlstevens commented Mar 5, 2018

One suggestion might be to shorten the functions in setup.py after checking autover is working nicely by doing a quick param dev release using autover. :-)

Then if it all works well, we can shorten things again before the actual param release.

@ceball
Copy link
Member Author

ceball commented Mar 5, 2018

I just unshortened the setup.py functions after your recommendation. I can't tell what all the code paths do, but I think at this stage I would just like to use it and move on. Can we merge this?

@jlstevens
Copy link
Contributor

I'm happy to see this merged but I would recommend that you try doing a param dev release before doing the actual release. I'm guessing @jbednar should be the one to merge or not?

@jlstevens
Copy link
Contributor

jlstevens commented Mar 5, 2018

I can do the quick change suggested by Jim on both the autover and param repos after this is merged.

Edit: Actually, why wait? I'll make the change on this PR right away.


if release is not None or 'commit_count' in kwargs:
print('WARNING: param.Version now supports PEP440 and a new tag based workflow. See param/version.py for more details')

Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to use param.warning but that will probably cause cyclic import issues unless I inline the import? Is a print statement ok in this case and do you have any suggestions for a better message?

Copy link
Member

Choose a reason for hiding this comment

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

Using print is ok by me.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is so simple I didn't test it locally. I would wait for travis here and also on autover where I'll port this change across now. The only thing I'm wondering about is whether this print will be triggered in some of the unit tests.

@jbednar
Copy link
Member

jbednar commented Mar 5, 2018

I'm happy for it to be merged as soon as release=None is deleted, to keep the boilerplate as simple as possible.

@jlstevens
Copy link
Contributor

I've made the requested changes both here and to the autover repo. Params tests are green (above) and so are autover's.

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.

None yet

4 participants