Skip to content

Automate conda version by extracting it from setup.py#782

Merged
astroJeff merged 3 commits intomainfrom
mb_automatic_conda_version
Feb 5, 2026
Merged

Automate conda version by extracting it from setup.py#782
astroJeff merged 3 commits intomainfrom
mb_automatic_conda_version

Conversation

@maxbriel
Copy link
Collaborator

@maxbriel maxbriel commented Jan 8, 2026

Extracts the versioneer version using conda's build in function to add it inside meta.yaml.
I wasn't able to test properly, because my local conda build fails (also without this change).

See here for an example: https://docs.conda.io/projects/conda-build/en/stable/resources/define-metadata.html#loading-data-from-other-files

@maxbriel maxbriel requested a review from sgossage January 8, 2026 09:43
@maxbriel maxbriel self-assigned this Jan 8, 2026
@maxbriel maxbriel added the enhancement New feature or request label Jan 8, 2026
@maxbriel maxbriel requested a review from a team January 8, 2026 09:45
@sgossage
Copy link
Contributor

@maxbriel, how do we update the project version with this approach? Is the idea that we'd edit

setup(
    name=DISTNAME,
    provides=[PACKAGENAME],
    version=__version__,
    ...

in setup.py so that version = NEW_VERSION?

@maxbriel
Copy link
Collaborator Author

maxbriel commented Jan 13, 2026

This branch still has versioneer.py installed, so it will use the github tag of the release to set the version in setup.py. Then the load_setup_py_data from conda loads in the setup.py with the associated variables. This contains the version set by versioneer.py. It then uses that tag to set the conda tag. #784 would replace this with a different mechanism to achieve the same using setuptools-scm.

It should be possible to test this on Linux with conda build.
There it should be possible to verify the tag (I will try to get my local github actions working again).

This basically removes the manual step of updating the conda version number for each release.

@sgossage
Copy link
Contributor

sgossage commented Feb 5, 2026

thanks @maxbriel I think this looks good. I tested this locally and it appears to pick up the correct version.

I believe we could still have e.g., custom versions for development branches if we wanted, using e.g.,

git tag <new-tag>

to set a custom tag for the branch locally. Otherwise, the local branch should always report the nearest version tag associated with that branch's commit.

@elizabethteng elizabethteng self-requested a review February 5, 2026 15:58
@astroJeff astroJeff merged commit f74af54 into main Feb 5, 2026
4 checks passed
@astroJeff astroJeff deleted the mb_automatic_conda_version branch February 5, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments