Skip to content

Force release-branch-semver version scheme of setuptools_scm #53

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

Merged
merged 3 commits into from
Aug 5, 2022
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ defaults:

env:
PACKAGE_NAME: labscript-suite
SCM_VERSION_SCHEME: release-branch-semver
SCM_LOCAL_SCHEME: no-local-version
ANACONDA_USER: labscript-suite

# Configuration for a package with compiled extensions:
Expand Down
9 changes: 3 additions & 6 deletions labscript_suite/__version__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import os
from pathlib import Path

try:
import importlib.metadata as importlib_metadata
except ImportError:
import importlib_metadata

VERSION_SCHEME = {
"version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"),
"local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"),
}

root = Path(__file__).parent.parent
if (root / '.git').is_dir():
from setuptools_scm import get_version
__version__ = get_version(root, **VERSION_SCHEME)

__version__ = get_version(root, version_scheme="release-branch-semver")
else:
try:
__version__ = importlib_metadata.version(__package__)
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools", "wheel", "setuptools_scm"]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=4.1.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_scheme = "release-branch-semver"
local_scheme = "node-and-date"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ packages = find:
python_requires = >=3.6
install_requires =
importlib_metadata
setuptools_scm
setuptools_scm>=4.1.0
Copy link
Member Author

@rpanderson rpanderson Jun 27, 2020

Choose a reason for hiding this comment

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

@chrisjbillington should this be here? I think it can be omitted since it is now specified in the build-system requirements of pyproject.toml. If it should stay, it then needs to be added to other projects (e.g labscript-devices) which do not have it in install_requires of setup.cfg. Also, shouldn't it only ever have been in setup_requires?

Copy link
Member

@chrisjbillington chrisjbillington Jul 15, 2020

Choose a reason for hiding this comment

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

Yep! It still needs to be there.

It's both a runtime requirement (i.e. belongs in install_requires) since our __version__.pys use it, and a build-time requirement (i.e. belongs in pyproject.toml) since our setup.pys use it.

Installing a pre-built wheel does not install its build-time requirements, and similarly, building a wheel does not install its run-time requirements. So it needs to be both in pyproject.toml and setup_requires.

pyproject.toml supersedes setup_requires, so nothing belongs in setup_requires.

If it should stay, it then needs to be added to other projects (e.g labscript-devices) which do not have it in install_requires of setup.cfg

Yes, I think to be kosher each project should depend on it directly, rather than relying on it being installed due to being a transitive dependency.

blacs>=3.0.0
labscript>=3.0.0
labscript-devices>=3.0.0
Expand Down
8 changes: 1 addition & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import os
from setuptools import setup

VERSION_SCHEME = {
"version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"),
"local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"),
}

setup(use_scm_version=VERSION_SCHEME)
setup()
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy