Skip to content

Commit 5c96bf1

Browse files
authored
Add versioneer script to compute a version number (#1497)
* Added versioneer * Setting env variable PROJECT_NUMBER prior building backend docs * Added setup.cfg * Resolve pre-commit faults * Reverted changes in setup.cfg to exclude perf tests * Set env variable to project number
1 parent c333172 commit 5c96bf1

File tree

11 files changed

+3046
-49
lines changed

11 files changed

+3046
-49
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ exclude =
5757
conda.recipe,
5858
tests/*.py,
5959
tests_external/*.py,
60-
version.py,
60+
versioneer.py,
6161

6262
# Print detailed statistic if any issue detected
6363
count = True

.github/workflows/build-sphinx.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ jobs:
7171
7272
- name: Checkout repo
7373
uses: actions/[email protected]
74+
with:
75+
fetch-depth: 0
7476

7577
# https://github.com/marketplace/actions/setup-miniconda
7678
- name: Setup miniconda
@@ -109,6 +111,13 @@ jobs:
109111
run: make html
110112
working-directory: doc
111113

114+
- name: Set a project number to current release
115+
run: |
116+
export PROJECT_NUMBER=$(git describe --tags --abbrev=0)
117+
118+
echo PROJECT_NUMBER=${PROJECT_NUMBER}
119+
echo "PROJECT_NUMBER=$PROJECT_NUMBER" >> $GITHUB_ENV
120+
112121
# https://github.com/marketplace/actions/doxygen-action
113122
- name: Build backend docs
114123
uses: mattnotmitt/[email protected]

.github/workflows/conda-package.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ jobs:
194194
run: conda list
195195

196196
- name: Smoke test
197-
run: python -c "import dpnp, dpctl; dpctl.lsplatform()"
197+
run: |
198+
python -c "import dpnp, dpctl; dpctl.lsplatform()"
199+
python -c "import dpnp; print(dpnp.__version__)"
198200
199201
# TODO: run the whole scope once the issues on CPU are resolved
200202
- name: Run tests
@@ -331,7 +333,9 @@ jobs:
331333
Get-Content -Tail 5 -Path $cl_cfg
332334
333335
- name: Smoke test
334-
run: python -c "import dpnp, dpctl; dpctl.lsplatform()"
336+
run: |
337+
python -c "import dpnp, dpctl; dpctl.lsplatform()"
338+
python -c "import dpnp; print(dpnp.__version__)"
335339
336340
# TODO: run the whole scope once the issues on CPU are resolved
337341
- name: Run tests

doc/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
with open("reference/comparison_table.rst.inc", "w") as fd:
2424
fd.write(comparison_generator.generate())
2525

26+
import dpnp
2627

2728
# -- Project information -----------------------------------------------------
2829

29-
project = "dpnp"
30+
project = "Data Parallel Extension for NumPy"
3031
copyright = "2020-2023, Intel Corporation"
3132
author = "Intel"
3233

33-
# The short X.Y version
34-
version = "0.12"
34+
version = dpnp.__version__.strip(".dirty")
3535
# The full version, including alpha/beta/rc tags
36-
release = "0.12.1"
36+
release = dpnp.__version__.strip(".dirty")
3737

3838

3939
# -- General configuration ---------------------------------------------------

dpnp/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
from dpnp.dpnp_iface_types import *
5555
from dpnp.dpnp_iface import *
5656
from dpnp.dpnp_iface import __all__ as _iface__all__
57-
from dpnp.version import __version__
57+
from dpnp._version import get_versions
5858

5959
__all__ = _iface__all__
60+
61+
__version__ = get_versions()["version"]
62+
del get_versions

0 commit comments

Comments
 (0)