-
-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add support for dynamic metadata #474
Comments
Thanks for the suggestion. I agree that "version from SCM" is a use case worth considering. There are a couple of complications to what you describe, though. Some packaging schemes have very strict version number requirements. Windows only allows strict numerical Triples. Android requires a build "sequence" number. IIRC, iOS only allows numbers. As a result, building an installer "for git hash xxxxx" isn't actually something you're going to be able to do in practice; even "for git tag xxxxx" will have some very serious constraints. We'll need to work out how to manage those constraints in any SCM-based version number solution. There are also alternatives to |
So maybe add option to provide version by function? |
A user-provided function would be one way to provide compliant version numbers; however, that function would have to either (a) return a PEP508-compliant version number, which is then processed using the existing version number handling code, or (b) return a different version number for each platform. What we really need at this point is a complete proposal for needs to change, and what the experience will be like as an end-user. |
But is is enough to add description in documentation for this and fail if user function return version in wrong format. |
As mentioned in #1277, there is now a standard |
The official dynamic version support in Essentially:
Once these are done, part of However, there's an alternate format of configuring dynamic version without needing a package that supports it, by simply setting a block in pyproject.toml:
This one gets flagged with a warning from setuptools that it's still beta functionality. Basically... if briefcase simply built the app as a wheel or sdist first with the standard tooling (eg. the Trying to replicate the official functionality might be possible, but probably a lot of busywork and I'd also expect it to be somewhat fragile. |
I know the Python packaging landscape is (more than) a little confusing, but there's nothing I'd call "official" dynamic version support in pyproject.toml. Declaring |
I guess I meant official in the sense of how the current pypa backed tooling uses pyproject.toml to build sdist/wheels. Briefcase should really be able to work with any dynamic version provider if they all follow a standard pattern... though most of the standard patterns are discounted l designed to ultimately build a wheel. |
That being said, the setuptools workaround pattern could be reused here, providing a section like this:
Which allows the user to define a property/function to call to provide the version. |
So - I agree in theory - but I'm not sure there is any such thing as a standalone dynamic version provider in the way you're describing it. All the tools I'm aware of exist as plugins to other build systems (setuptools, hatch, poetry etc). It may be possible to adopt one of these tools, but the configuration of that tool is going to be something that is Briefcase specific. I'm also not sure I understand why the ability to configure multiple SCM version number utilities is required. Yes, the ecosystem has a proliferation of near-identical tools... but AFAICT this is mostly due to no single tool gaining traction due to the general mess of the broader Python packaging ecosystem, rather than a demonstration of the highly customised needs of individual versioning schemes. With that in mind, I make the following suggestion: If a project only defines If a project defines a PEP621-compliant
If The decision to use setuptools_scm is based entirely on the fact that Briefcase itself uses setuptools_scm, and it's the implementation that is used by a lot of the other build tool plugins (e.g., hatch-vcs is really just a wrapper around setuptools_scm). If someone wants to make a particularly impassioned plea to use a different library, I'm open to reasonable discussions, but this would probably need to be paired with Briefcase (and other BeeWare projects) making the same choice. The decision to make setuptools_scm the default if In theory, we could expose a plugin interface - allow anyone to define a |
There are very few SCM version number utilities (I can only think of two:
Just to note, and assuming these are inspired by setuptools, the |
That would seem to reduce the impetus for a Briefcase plugin even further.
"Inspired by setuptools" was the intention, so I agree we should follow those implementations. I know the |
Renamed to reflect other possible types and sources of metadata, such as this example from @DaloroAT in #1432: I have my own project where I'm using Dynamic Metadata for the version field. [project]
name = "my-project"
dynamic = ["version"]
[tool.setuptools.dynamic]
version = {file = "my-project/VERSION"} I have the file |
In my project I use setuptools_scm for versioning (it calculate version from git tag and create proper file handling it). My project is distributed as python package and pyinstaler executable. I would like to switch from pyinstaller to briefcase (possibility of pip support) but I do not want to manually change version in file.
Describe the solution you'd like
Add support to read version from setuptools_scm instead of manual update
Describe alternatives you've considered
Manual updating version. read version from file
The text was updated successfully, but these errors were encountered: