-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Move __version__ single source of truth to package __init__ #36
Conversation
This is a lot of code for something rather simple – I tend to handle this with a simple regex in my own projects with open('jprm/__init__.py', 'r') as fh:
version = re.search(r'__version__ *= *["\'](.*?)["\']', fh.read()).group(1) In jprm I also have CI to automate the version change as part of the release prep, but I see that this repo doesn't have anything of that sort yet. https://github.com/oddstr13/jellyfin-plugin-repository-manager/blob/493e3aec37da39f8faa7a2ee308109edebe856b4/.github/workflows/release-next-create-pr.yaml#L61-L69 |
Whatever the maintainers feel comfortable with is fine. The main thing I care about is that This code is generated by my xcookie repo templater. While it is longer than a regex, this code correctly handles edge cases that the regex doesn't. I like things that treat code as code, but that's my opinion. |
I usually just throw the version in the natural places and use a script to yell at me if I forget to change them all. |
I'd accept this PR if it just throws the version into the two places. I could add something like |
I think it's important to have a single-source-of-truth for information like the version. It looks like the new pyproject.toml configuration has built in support for this sort of versioning. I think a better solution would be to switch to that. |
412d50c
to
0236068
Compare
I've added a commit that makes this change. This removes the problem of there being a lot of code in the setup.py. In fact there is no more code in the setup.py, the entire build process is now declarative. I build a wheel before / after this change to ensure that all metadata in the |
Sure, this looks fine. |
Currently the main Python module don't have a
__version__
property. This is a pseudo-standard property that many packages do include, and its helpful to have. I find putting__version__
in the top-level__init__.py
is a good place for the single-source-of-truth for the version number. I've included code in thesetup.py
to parse that information from__init__.py
file, so when versions change, you only need to bump the version in one place.