Skip to content
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

set the version number somewhere #162

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,7 @@ preview = true
pyink-indentation = 2
pyink-use-majority-quotes = true

[tool.setuptools_scm]
[tools.setuptools.dynamic]
version = {attr = "xee.__version__"}

[tool.setuptools_scm]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should take this approach. Can we try generating the version file with setuptools_scm instead?

https://github.com/pypa/setuptools-scm

[tool.setuptools_scm]
version_file = "pkg/_version.py"

Will that fix the issue with conda that lead to this patch?

Copy link
Contributor Author

@12rambau 12rambau Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never use setuptools_scm, I personnaly use commitizen to generate the version numbers. I think from conda the version number needs to exist at least in 1 place that does not require to load the modules. If this does the job as well I'm happy with it, I just don't know how to test it if not doing patch releases to conda-forge.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how other folks solve this problem. I'd like to keep using setuptools_scm if possible and not have two places where that is traced (version control and code). It looks like Xarray does something similar. Maybe, to address the conda issue, we could do what they do and set a fallback version?

https://github.com/pydata/xarray/blob/1c6300c415efebac15f5ee668a3ef6419dbeab63/pyproject.toml#L70

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me do that in another PR and see if it works

6 changes: 1 addition & 5 deletions xee/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@


assert sys.version_info >= (3, 8)
try:
__version__ = importlib.metadata.version('xee') or 'unknown'
except importlib.metadata.PackageNotFoundError:
__version__ = 'unknown'

__version__ = "0.0.14"

# Chunks type definition taken from Xarray
# https://github.com/pydata/xarray/blob/f13da94db8ab4b564938a5e67435ac709698f1c9/xarray/core/types.py#L173
Expand Down