Skip to content

Commit b46d158

Browse files
update versioning to strictly use setuptools-scm
1 parent 5a1751d commit b46d158

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/python-package-conda.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
source $CONDA/etc/profile.d/conda.sh
2929
conda activate test_schimpy
3030
conda config --set anaconda_upload yes
31+
export SETUPTOOLS_SCM_PRETEND_VERSION=$(python -m setuptools_scm)
3132
conda build -c cadwr-dms -c conda-forge --user cadwr-dms --token "$ANACONDA_CHANNEL_UPLOAD_TOKEN" conda.recipe
3233
conda activate
3334
conda remove -n test_schimpy --all

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wheels/
2424
*.egg-info/
2525
.installed.cfg
2626
*.egg
27+
vtools/_version.py # auto generated by setuptools_scm
2728

2829
# PyInstaller
2930
# Usually these files are written by a python script from a template

conda.recipe/meta.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
package:
77
name: schimpy
8-
version: {{ version }}
8+
version: {{ SETUPTOOLS_SCM_PRETEND_VERSION }}
99

1010
source:
1111
#git_url: https://github.com/CADWRDeltaModeling/schimpy.git
@@ -28,18 +28,20 @@ requirements:
2828
- {{ dep.lower() }}
2929
{% endfor %}
3030
build:
31-
- python
31+
- python {{ project['requires-python'] }}
3232
- pip
3333
- setuptools
3434
- setuptools_scm
3535
- pyproj
36-
- pytest-runner >=5.0
36+
- ruff>=0.4.8
37+
# - pytest-runner >=5.0
3738
- numpy >=2.0
3839
run:
3940
- python {{ project['requires-python'] }}
4041
{% for dep in project.get('dependencies', []) %}
4142
- {{ dep.lower() }}
4243
{% endfor %}
44+
- numpy >=2.0
4345

4446
test:
4547
imports:
@@ -51,7 +53,7 @@ test:
5153
- {{ dep.lower() }}
5254
{% endfor %}
5355
commands:
54-
- (setlocal && cd tests && pytest && endlocal) # [win]
56+
- (cd tests && pytest) # [win]
5557
- (cd tests; pytest) # [unix]
5658

5759
about:

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "schimpy"
7-
dynamic = ["version"] # Placeholder; versioneer will manage this
7+
dynamic = ["version"] # Placeholder; setuptools-scm will manage this
88
description = "Python package for SCHISM"
99
readme = "README.rst"
1010
license = "MIT"
@@ -76,6 +76,9 @@ Homepage = "https://cadwrdeltamodeling.github.io/schimpy/"
7676
[tool.flake8]
7777
exclude = ["docs"]
7878

79+
[tool.ruff.lint]
80+
select = ["NPY201"]
81+
7982
[tool.setuptools.packages.find]
8083
include = ["schimpy"]
8184
exclude = ["docsrc"]

schimpy/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
__author__ = """Eli Ateljevich, Kijin Nam"""
44
__email__ = "Eli.Ateljevich@water.ca.gov; Kijin.Nam@water.ca.gov"
55

6-
from importlib.metadata import version, PackageNotFoundError
7-
86
try:
9-
__version__ = version("schimpy")
10-
except PackageNotFoundError:
11-
__version__ = "0.0.0" # Default version if package metadata is unavailable
7+
from ._version import __version__
8+
except ImportError:
9+
__version__ = "0.0.0" # fallback for weird dev cases

0 commit comments

Comments
 (0)