-
Notifications
You must be signed in to change notification settings - Fork 0
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
Question about using pyver for versioning a package #2
Comments
I think all four of the things in the first list above are both reasonable requests and important to achieve. I couldn't quite follow everything in the second list, but overall it sounds reasonable as well. In particular, why do you / how can you tag 1.5.2.dev0 immediately? At that point, how do you know that the next release is going to be 1.5.2 as opposed to 1.6.0? What's wrong with leaving the tag at 1.5.1? |
Yeah, I'm not sure about that bit. I've never actually tried it out in a real project, just when I implemented the test scheme above. It's to do with saying "understand you're not using an official release" when someone installs/imports the package between releases, while also not having to do anything other than tagging to make that happen. Having "dev" in the version indicates clearly it's not an official/final release. Sorry, that's still not very clear. I'll try to explain, but only to help you understand what I'm trying to achieve so you can suggest what's better (because I also don't like the idea of tagging straight after a release). Say I release 1.5.1. I then leave the tag that way and keep working, getting a commit on master. As an aside, I did also previously consider a scheme where the commit number Anyway, I am trying to find a way of making clear that the between-release packages are not 'official releases'. Because I am conflicted between wanting to make latest work always available for people (including myself) to try out and use in projects (where 'latest work' means PRs that are merged to master, so reviewed and accepted as a good idea, but maybe not perfect and possibly subject to change once tested in the real world a bit), while also wanting to cling to the idea that I can still make releases which have some guarantee of being better than taking some random point from master. |
I don't think you are worried about nothing, especially now that conda versions typically include a hash, which means that the g... notation is very likely not to get noticed. Looking over PEP440, it just seems like they really didn't consider the idea of continuous releases, i.e. things that need to be always available with no human intervention. I certainly can't find any category that sorts correctly and conveys what we would be trying to do here. Using What about |
Discussing with Chris, why not |
Just to clarify, there's a decision to make for the python package and the conda package name. Conda isn't a python packager specifically, but according to https://conda.io/docs/user-guide/tasks/build-packages/package-spec.html#info-index-json, "Conda acknowledges PEP 440". Maybe there's a better page than that, or we should ask conda (build) developers what to do? Anyway, to try to summarize the question we're asking... We're talking here about packages that get built automatically for every merge to master. For the first commit to master after release 1.5.2:
|
To clarify more (not sure if it's helping...), a project doesn't have to produce a package for every commit to master. The main thing is that packages can be generated in an automated way. Producing a package for every commit to master is something I'm probably proposing for e.g. param 2 development, but other projects might well prefer to do something different. E.g. a project might want to produce packages only on pushing a tag, e.g. |
I have no strong feelings about this and the tyeps of workflow Chris just described is something you can do with autover. Right now, I just want to decide on the version string format (and maybe this discussion means it has to be more configurable?). @jbednar I don't mind the One idea might be that if we automate packaging when PRs are merged to master, we no longer need a separate notion of a 'dev' releases. These could just be lightweight tags linking to the corresponding, automatically generated package from the last PR merge, using whatever version format we settle on. |
Are they both required? Could it be just |
I think that would be ok. I feel having both |
Unfortunately, I think we have to abuse PEP440 somehow, because it was apparently not anticipating the desire to have a complete spectrum of interim releases, so it doesn't have any tag that actually means what we want to mean. |
For the record, PEP440 says |
Why don't we just use the normal If this is still confused, I'll have to give in and actually read PEP440! ;-p |
That's a valid option. Calling it that isn't necessarily actually accurate, i.e. the next genuine release after 1.9.1 might be 2.0.0, making 1.9.2.dev29 confusing in retrospect. But sure, maybe that's the least of our worries, i.e. we could simply accept that dev releases labelled 1.9.2 really mean "post-1.9.1 dev releases", because then everything sorts properly and is less complex than .post.dev. We could end up with release histories like:
etc. All things considered, maybe that's the least confusing option. It's true there's never any 1.9.2 real release, but by the time we have 2.0, maybe no one cares? I'm ok with that. |
What do you think @ceball @philippjfr ? I will need to think a bit about the implications for autover. You don't want to make a '1.9.2' tag to define '1.9.2dev0' when '1.9.2' isn't actually released yet. I suppose you can just tag '1.9.2dev0' when it is ready though I'll need to make sure |
I don't think this would work if it required a manual tag for 1.9.2x to exist. Instead, it would just be defined that the current dev version is 1.9.N+1devM, for 1.9.N last tagged as non-dev. Any explicit tagging of dev versions would be optional and would need to be consistent with such automatic versions (or I guess the CI system could automatically tag?). |
I'm not sure if I'm helping here, but these are two "workflows" in which I used/tested versioneer:
I think that automatically generating and uploading packages from master (between tags) would be useful for some projects. E.g. it could be good for a project that's quite stable, and which only has PRs merged after they've been accepted as a good idea and have been reviewed, and has reasonable tests, and is thus expected to work all the time - but which might only release after several such PRs. (Releasing generally requiring quite a lot of extra work beyond just making a package, at least in the current world - although the amount of work is falling with automated documentation etc.) |
I think I don't have much of an opinion about the versioning scheme to use, i.e. whether it's "post release" versioning vs "predicted next release" versioning. E.g. to make recent work available, you could deliberately generate (tag) 1.5.2.dev1 or 1.5.1.post1dev0 depending which versioning scheme you prefer. Any number of commits later you could then deliberately generate 1.5.2.dev2 or 1.5.1.post2.dev0. And so on. Alternatively, to make recent work available, you could automatically generate 1.5.2.dev1 or 1.5.1.post1dev0 from the 1st commit to master since 1.5.1. The 2nd commit, you could generate 1.5.2.dev2 or 1.5.1.post2.dev0. And so on. (In both cases, whether you only ever deliberately make packages available, or "latest master" packages are automatically available, someone would still deliberately make certain "release" packages e.g. by tagging 1.5.2 or 1.5.2.rc1 or whatever.) There seem to be tradeoffs with both versioning schemes. Maybe it depends what you want your versions to mean. I guess I've only ever thought about a version as an identifier, a way of ordering, and some kind of weak indicator of how big my problems will be when I try to upgrade to a new version. |
There are a few things I'd really like from a versioning package like pyver, but I can't quite see how pyver would provide them for me. I'll try to describe what it is that I want, and maybe someone could tell me how to achieve them with pyver, or suggest an alternative thing to do because what I want is something bad and I need to be saved from myself!
I want...
To be able to produce a package at any time (even between "official releases", e.g. to test) without having to do anything except run the packaging command (e.g.
python setup.py sdist
), and for that package to include the correct version in its name, and to have the same correct version in the imported python package.To automatically get a version that matches the style currently expected for python packages (PEP440), including what I think is important info like e.g. git hash and number of commits on master since last tag if created from a git repo master between tagged releases.
To write the release version once via e.g.
git tag -a v1.2.3 -m "Release something"
, and then run the packaging command, and get a release with version1.2.3
(in package name, and in imported package). Without having to do anything else such as setting one or more other version numbers scattered throughout the source code.To believe the version data from the python package when I ask for it, and to believe the version data in the name of a package, and to know pretty certainly how to regenerate that package if I wanted to do so.
Is it possible to achieve these with pyver? Alternatively, am I wrong for wanting the things described above?
The behavior described above comes out of wanting the following kind of scheme for packaging/releasing:
1.5.1
of my package.1.5.2.dev0
, which is "pre" version1.5.2
i.e.1.5.2
will be considered later than1.5.2.dev0
; additionally, python tools will not install1.5.2.dev0
unless requested to install pre-releases (pip install --pre [...]
).git describe
will return something likev1.5.2.dev0-1-g813a2fd
. If I import the package from github master (e.g. maybeI pip install -e
my clone, or Ipip install [github master.zip]
), I will get a__version__
of1.5.2.dev0+1.g813a2fd
. If I create a package, e.g.python setup.py bdist_wheel
, I will get e.g.package-1.5.2.dev0+1.g813a2fd-py2.py3-none-any.whl
. If I install and import that, I will get a__version__
of1.5.2.dev0+1.g813a2fd
. If Iconda build conda.recipe/
, I will get a conda packagenoarch/package-1.5.2.dev0_g813a2fd-py_1.tar.bz2
(not totally sure about abusing the build number to store the commit number, but it works) and a__version__
of1.5.2.dev0+1.g813a2fd
when I import the package.[channel]/label/dev
, meaning the latest master is always easily available.git tag -a v1.5.2 -m "Finally made release"
and push the tag.v1.5.2
results in an sdist and wheel being uploaded to pypi (will automatically look like e.g.package-1.5.2-py2.py3-none-any.whl
), and a conda package being uploaded to anaconda.org[channel]/label/main
(will automatically look like e.g.noarch/package-1.5.2-py_0.tar.bz2
). Importing the resulting python package will give a__version__
of1.5.2
.I’m not certain the scheme above is right, but I think it works (I concretely implemented it to test, and it seems really great). I think such a scheme would help reduce time and willpower required to make a release, reduce confusion about what versions of packages people really have, reduce packaging errors, improve package reproducibility, improve package quality (no stray files - not that it’s a big deal), reduce time to make features and fixes available to others (risk takers!) between releases, and reduce the amount of time spent thinking about versioning and packaging and releasing. I think the scheme depends on the desired behaviors of a versioning tool that I described at the start of this issue, but I might be wrong. I also think the benefits to packaging/releasing would outweigh even quite bad/sneaky code required to achieve the behaviors.
But surely there are downsides to the scheme that I don’t see, so fire away :)
The text was updated successfully, but these errors were encountered: