fastapi_mcp icon indicating copy to clipboard operation
fastapi_mcp copied to clipboard

[Build] Use setuptools_scm to allow git as the SSOT for package version

Open shahar4499 opened this issue 10 months ago • 4 comments

Instead of hardcoding the version into the repo, use git tags as the single source of truth for project's version, eliminating human error on releases. To do this we can use setuptools_scm.

shahar4499 avatar Apr 07 '25 10:04 shahar4499

Hi! May I work on this issue?

AnnaRevutsky avatar Apr 07 '25 18:04 AnnaRevutsky

Hi @shahar4499!

Can you please elaborate on the following points:

  • What's the current release process you want to automate versioning for, if I understood correctly?
  • Assuming you want the version to be determined by a git tag, which part of which flow (a github action presumably?) will produce the version artifact and where (github releases, pypi, the repo itself, etc)?

Thanks in advance, Anna

AnnaRevutsky avatar Apr 08 '25 08:04 AnnaRevutsky

Hey @AnnaRevutsky , sure! I'd be happy to guide you.

So basically right now, when releasing a version you have to do this in order:

  1. bump the package's version in pyproject.toml
  2. run uv sync
  3. commit the pyproject.toml and uv.lock files
  4. create a new tag + release via Github (only maintainers can do that)
  5. the Github Action will run and publish it to PyPi

So, instead it would be better if pyproject.toml, and the package's init.py are not hardcoding any version, and are taking it from the git tag when a release is created.

setuptools_scm is supposed to allow this kind of CI workflow.

Does that make sense?

shahar4499 avatar Apr 08 '25 15:04 shahar4499

Hey @shahar4499, could you please review the changed files?

Thank you.

AnnaRevutsky avatar May 04 '25 18:05 AnnaRevutsky