Skip to content

Support dynamic version for dev and releases.#617

Open
ccoulombe wants to merge 1 commit intogoogle-deepmind:mainfrom
ccoulombe:dynamic-version
Open

Support dynamic version for dev and releases.#617
ccoulombe wants to merge 1 commit intogoogle-deepmind:mainfrom
ccoulombe:dynamic-version

Conversation

@ccoulombe
Copy link
Copy Markdown

When installing from HEAD, this would allow one to have traceable reproducibility.
A local wheel built today from a fresh clone, would be tagged alphafold3-3.0.2.dev113+gebfe70a27.d20260206-cp313-cp313-linux_x86_64.whl.

The version is incremented from the current tag.
A dev release suffix which show that 113 commits have been made since.
A local version +gebfe70a27.d20260206 which means :

  • gebfe70a27 (g+short commit)
  • d20260206 (d+date)

Hence it is easy to know which build/commit a user used as it is described in the file name.

Ref:

@Augustin-Zidek
Copy link
Copy Markdown
Collaborator

Wouldn't the CMake part need to be updated as well?

@ccoulombe
Copy link
Copy Markdown
Author

ccoulombe commented Mar 6, 2026 via email

@Augustin-Zidek
Copy link
Copy Markdown
Collaborator

Sorry for the late reply. Will this work correctly with this line in CMakeLists.txt:

project(
  "${SKBUILD_PROJECT_NAME}"
  LANGUAGES CXX
  VERSION "${SKBUILD_PROJECT_VERSION}")

The ${SKBUILD_PROJECT_VERSION} variable in particular.

@ccoulombe
Copy link
Copy Markdown
Author

With the changes from this PR, I was able to build ebfe70a27a6a1ad18c77664191c5f7fa486ebee9 of AF3.

  Created wheel for alphafold3: filename=alphafold3-3.0.2.dev113+gebfe70a27.d20260402-cp313-cp313-linux_x86_64.whl size=242965375 sha256=221d6b8d0464d5018a373e5dd1aab767cb3f0eb75883e0e74024b2f23cdef61c

And adding some print status from CMake:

  -- Detecting CXX compile features - done
  -- >>> SKBUILD_PROJECT_VERSION = 3.0.2
  -- >>> PROJECT_VERSION = 3.0.2

Thus, I'd say yes. Esp. since it is scikit-build-core that manage the version via

metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"

From the documentation,

If you need to set the CMake project version without scikit-build-core (which provides ${SKBUILD_PROJECT_VERSION})

we could infer that it manages the variable SKBUILD_PROJECT_VERSION correctly.

@Augustin-Zidek
Copy link
Copy Markdown
Collaborator

Right, I am still worried about a few things:

  1. Will this work if people download a zip of the source code without the .git directory? I.e. what version will I get if I remove the .git directory? Is there a fallback mechanism?
  2. Does python3 run_alphafold.py --version work?
  3. Does the version still work correctly when run in the Docker container? (Docker might exclude the .git directory when building)
  4. Isn't a [build-system] section missing (see e.g. https://pydevtools.com/handbook/how-to/how-to-add-dynamic-versioning-to-uv-projects/)

@ccoulombe
Copy link
Copy Markdown
Author

Let me work on each point...

Regarding

Does python3 run_alphafold.py --version work?

There is currently no argument --version, but one could think of adding one :)

Regarding

  1. Isn't a [build-system] section missing (see e.g. https://pydevtools.com/handbook/how-to/how-to-add-dynamic-versioning-to-uv-projects/)

The section is already present in

[build-system]

and setuptools-scm is already part (pulled) from scikit-build-core : scikit_build_core/metadata/setuptools_scm.py.
And see:
https://github.com/scikit-build/scikit-build-core/blob/fc4ea500205d0ee79b5505305a184970476abfc1/src/scikit_build_core/metadata/setuptools_scm.py#L51-L54

@Augustin-Zidek
Copy link
Copy Markdown
Collaborator

Augustin-Zidek commented Apr 10, 2026

There is currently no argument --version, but one could think of adding one :)

There isn't an explicit one, but I think abseil flags library adds one.

and setuptools-scm is already part (pulled) from scikit-build-core : scikit_build_core/metadata/setuptools_scm.py.

TIL, thanks for investigating!

@ccoulombe
Copy link
Copy Markdown
Author

ccoulombe commented Apr 11, 2026

So, regarding the items from #617 (comment)


  1. This does not work when no .git folder is found. See scikit-build-core/setuptools-scm

It fails with:

  ValueError: setuptools-scm was unable to detect version for /home/coulombc/alphafold3.

  Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

  For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj

Personally, I would bluntly let the installation fails when a user used the .zip directly instead of pip install git+<> and document the correct installation procedure.

Else, a static version could act as a fallback mechanism:

[tool.setuptools_scm]
fallback_version = "3.0.1"

Ref: https://setuptools-scm.readthedocs.io/en/latest/config/#core-configuration

What do you prefer?

Also note, that one can always override the version with an env. variable: SETUPTOOLS_SCM_PRETEND_VERSION.


  1. There is no version automagically added, but I suppose it could be added if needed
$ python run_alphafold.py --helpfull | rg version
$ python run_alphafold.py --version
FATAL Flags parsing error: Unknown command line flag 'version'
Pass --helpshort or --helpfull to see help on flags.

  1. Since .git is not excluded from the dockerignore file, it is my understanding that it would be copied hence the dynamic version would work. But I do not have docker to 100% test it out.

Also depends on choice made for 1.


  1. scikit-build-core does pull dynamically some build.requires like ninja, cmake, or setuptools-scm.
    On second thought, I do prefer when things are explicit so I will add setuptools-scm. But if you prefer, the three can be removed, as the build system warns:
2026-04-10 23:15:00,200 - scikit_build_core - WARNING - ninja should not be in build-system.requires - scikit-build-core will inject it as needed

Based on the decision for 1. I would remove the file src/alphafold3/version.py and add the section

[tool.setuptools_scm]  
write_to = "src/alphafold3/version.py"

to the pyproject.toml so that the version.py file is automatically generated.
Else, in case the version.py needs to stay, I would use importlib.metadata.
It would look like:

>>> from alphafold3 import version
>>> version.__version__
'3.0.1.dev224+g35955279b.d20260410'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants