Repository navigation
Improve single_source_version.rst - #190
Conversation
There was a problem hiding this comment.
Nitpick: "Git" is a proper noun; shouldn't it be capitalised?
There was a problem hiding this comment.
I guess so. I've made the change.
|
As a Python end-user, I dislike this change because it offers yet more options for us to choose from, as opposed to whittling things down to one or two clear choices. Single-sourcing the project version is such a basic part of packaging that I would assume the general Python community would prefer to converge on a standard solution rather than see things go off in many directions. Per @qwcode over in #182, it seems like the community is slowly converging on option 3 in the current guide:
I would rather see the guide evolve slowly in that direction than evolve to add more options. |
|
In my opinion a solution based on VCS tags should be one of the recommended approaches, so adding them to the document is a necessary precondition to building a consensus in #182. |
|
I agree that we want fewer options, not more. The I'd prefer that we keep it simple, and don't offer recommendations for how to integrate version control into the package management process. |
|
Simply ignoring version control systems doesn't seem like a good strategy to me. If it isn't mentioned at all in the document then it's likely that others like me will open issues/PRs asking to complete it. |
|
It's not so much ignoring them as assuming that people with a sufficiently advanced VCS workflow that they want to derive versions from tags, will be capable of rolling their own solution. Maybe we could add a comment to the current option 2 ("Use an external build tool...") to say that some such tools (e.g. pbr) derive the version number from VCS tag data, and leave it at that. |
|
It seems to me that option 2 is badly worded (they're release tools, not build tools) and somewhat hidden in the middle when it should be a separate section. How about merging option 2 with the new section this PR proposes to add? |
|
Since this PR has become tangled with #182 I've modified it to try to solve that issue. |
|
I don't particularly like the rewrite (for no specific reason, sorry - it just doesn't feel helpful to me), but at a minimum, can we include the script you're proposing for extracting git tags in the text? (BTW, you lost the note that version 1 needs you to deal with regular expressions...) |
Why? Adding the script and the instructions that go with it would add 50+ lines, and we'd have to keep them updated. |
|
Largely because it would be in line with the other sections, which include code inline. The code here is basically sample code we'd expect people to copy into their project, so it should be short & understandable. The script in this case is probably too big for that, which makes me think that it would be better packaged (and described) as a 3rd party project like pbr, rather than as an example of "how to do this". One of my problems with this whole proposal is that basing the version on VCS tags is a bit too complex to recommend that people do it by hand. The fact that the sample script is too big to be plausibly included in the page just illustrates that point. |
|
To clarify, my |
|
I've restored the note about regexps. |
|
As I was thinking about packaging my script I stumbled upon the setuptools_scm package, which is close to what my I've modified this PR to link to |
|
But |
|
Like my |
|
I've made a few more changes. @nchammas You opened #182, can I have your opinion on whether the document as it is on this branch is better than the current one? |
|
It reduces the number of categories of options presented to the user, which is good. I can't comment more specifically other than to repeat, as we've been discussing in #182, that I hope this eventually evolves into something much simpler than what even this change proposes. But as a random user, I think this direction is good. |
|
Thanks @nchammas. The document could be simplified further by dropping option 1, but @pfmoore has voted against that in #182 (comment). The other remaining issue is whether |
|
In my view the whole section is far too complex for the audience it's intended for anyway. It's aimed at addressing people who say "but I don't like the fact that the basic recommended approach asks me to maintain my version number in more than one place, what should I do?". Fundamentally, the answer is "it depends, you need to understand the trade-offs and devise a solution that suits you". This section is basically showing a number of options, but it's still aimed at people who don't yet have the knowledge to assess things properly - that's why it's so frustrating that there isn't a "best practice" we can recommend. (But choosing something that a significant number of people disagree with is even more confusing for the newcomer, so we stick with what we have). So I see little point in separating out nuances of build tool vs release tool. The message for all of them is "let a 3rd party package do the job for you". Once someone knows the implications of choosing a "release tool" over a "build tool" or whatever other distinction is implied, they probably don't need this page any more. FWIW, I don't understand the distinction you're trying to make - that's probably because I only have small single-maintainer projects to deal with, and so it's irrelevant to me. I don't want an explanation - until I have the problem, the explanation isn't important. I don't really have anything more to say, so I'm going to drop out of the discussion at this point. |
|
Okay, so we need someone else with write access to step in. Ping @dstufft @qwcode @xavfernandez (owners who commented on #182). |
|
No real opinion except to keep all older options documented :) Why did you remove the solution based on pkg_resources ? |
|
Because it's not a reliable solution, it returns the number of the installed version, not the number of the version you're actually running. |
|
Well the only version that is mandatory for packaging is the one from the metadata, i.e. the one returned by pkg_resources. Nothing mandates that you add a duplicate information inside your python code to allow things like |
|
If you don't need the information in more than one place then you don't need a guide on how to single-source it. |
|
Well the guide supposedly presents |
|
The |
|
Please note - this section is intended to enumerate the options available. We don't try to provide judgments. There are projects who use the I'd suggest scaling back on the scope of this PR to simply add the extra option of getting the version from a VCS. That's relatively non-controversial (as long as you keep the text objective and don't try to claim one option is better than another). Just add a new section with your VCS option, and stop trying to adjust the existing text. |
|
Sigh. I did that, a week ago, you and @nchammas both said that you wanted fewer options. What you just said contradicts what @nchammas said in #182 (comment) (which you acquiesced):
|
|
Your original version split the list into two parts "using version control" and "storing it in the code". I'd rather a single undifferentiated list. If all you'd done was add a new item to the existing list, I don't think your proposal would have caused so much debate. I would still prefer there were fewer options, but what I meant by that was that I didn't see any great value in adding the option of getting the version from the VCS (it's an advanced enough technique that I feel that anyone who wants to do that is probably competent to work out how without needing a guide like this). Specifically I view "not to document every possible permutation that people have found useful" as arguing that not adding your proposed approach is entirely acceptable - that's what I was agreeing with. My preference is to simply not merge this PR at all, but if it were just an extra option added to the list with no change to the existing text, I'd probably be willing to merge it, just because you feel strongly enough that it's worth mentioning to have put all the effort in. I do appreciate the effort you put into trying to reword things to cram more options into a shorter format, but IMO the results didn't end up being an improvement. Anyway, as I said, I'm not planning on doing anything further on the PR in its current form, so I'll leave it at that (once again...) |
|
I've scaled back this PR, please review. |
|
I see no problem with this version, so I'll merge. Thanks for all the effort dealing with the feedback, I appreciate how exhausting it can get. |
Improve single_source_version.rst
Solutions based on version control systems.