Skip to content

Providing base version without git tags #1233

@AbdealiLoKo

Description

@AbdealiLoKo

Hi, We use a monorepo in my organization and so we do not use git tags for each project release. Instead, we are expected to note the version number within the respective project folder in the pyproject.toml

We are trying to add nightly releases, and use setuptools-scm to add the git commit to the version number for a specific project.

So, I have gotten setuptools-scm to work by adding it to the setuptools build system that we have, but I am not able to figure out how to get setuptools-scm to create the version number correctly.

Specifically, I have this in my pyproject.toml:

[build-system]
requires = [
    "setuptools>=62.3", # Need recursive package-data glob support
    "setuptools-scm",
]
build-backend = "setuptools.build_meta"

[project]
name = "myapp"
version = "1.34.0"

When I change the version = "1.34.0" to dynamic = ["version"] - setuptools-scm does give me a lot of nice stuff (it adds the git and diff/dirty parts to the version) - i.e. +g1a1a1a1a.d20251023 is appended - the "pseudo unique versions per commmit" feature

Things i found:

  • I found the tag_regex config - But that still needs a git tag to be present
  • I found the SETUPTOOLS_SCM_PRETEND_VERSION env var - But that doesn't add the +g... part to the version as it is taken as the final version
  • I saw some version_scheme options - But couldn't find one that would fit my need

Wanted to check if I was missing any documentation or suggestions on how we coud use setuptools-scm to add the pseudo unique part to a base version we could provide in the pyproject.toml or another file in the monorepo (but not from git tags)?

PS: We also really liked the auto add items added to git into the package-data feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions