Skip to content

Commit 0dcf72b

Browse files
committed
Merge branch 'main' into feature/gh-actions-pylint-mypy
2 parents 7884b1b + 520d1a5 commit 0dcf72b

12 files changed

+110
-19
lines changed

.github/workflows/test.yml

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
steps:
1919
- uses: tlambert03/setup-qt-libs@v1
2020
- uses: actions/checkout@v3
21+
with:
22+
# Fetch all history to get correct version numbers with versioningit
23+
# Otherwise, `git describe` is not working
24+
fetch-depth: 0
2125
- name: Set up Python ${{ matrix.python-version }}
2226
uses: actions/setup-python@v4
2327
with:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ __pycache__/
33
*.egg-info/
44

55
dist/
6+
build/
67

78
# generated images / documents
89
*.png

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v4.5.0
66
hooks:
77
- id: check-docstring-first
88
- id: check-yaml
@@ -15,7 +15,7 @@ repos:
1515
- id: trailing-whitespace
1616
- id: end-of-file-fixer
1717
- repo: https://github.com/asottile/pyupgrade
18-
rev: v3.10.1
18+
rev: v3.15.0
1919
hooks:
2020
- id: pyupgrade
2121
args: [--py39-plus]
@@ -25,7 +25,7 @@ repos:
2525
- id: isort
2626
args: ["--profile", "black"]
2727
- repo: https://github.com/psf/black
28-
rev: 23.7.0
28+
rev: 23.9.1
2929
hooks:
3030
- id: black
3131
args: ["--line-length", "120"]

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ python -m pre-commit install
7272

7373
To build the documentation, run:
7474

75+
```
76+
tox -e docs
77+
```
78+
79+
or
80+
7581
```
7682
cd docs
7783
make html

docs/conf.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# import os
1414
# import sys
1515
# sys.path.insert(0, os.path.abspath('.'))
16+
from packaging.version import parse
1617

18+
import qumada
1719

1820
# -- Project information -----------------------------------------------------
1921

@@ -22,7 +24,8 @@
2224
author = "JARA Institute for Quantum Information"
2325

2426
# The full version, including alpha/beta/rc tags
25-
release = "0.3.2"
27+
release = parse(qumada.__version__).public
28+
version = qumada.__version__
2629

2730

2831
# -- General configuration ---------------------------------------------------

docs/installation.rst

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ Build documentation
6363

6464
Run
6565

66+
.. code-block:: console
67+
68+
tox -e docs
69+
70+
or
71+
6672
.. code-block:: console
6773
6874
cd docs

pyproject.toml

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[project]
22
name = "QuMADA"
3-
version = "0.4.1"
43
description = "Measurement Abstraction and Database Access layer for QCoDeS"
54
readme = "README.md"
65
authors = [
@@ -15,15 +14,17 @@ classifiers = [
1514
"Topic :: Scientific/Engineering",
1615
"Intended Audience :: Science/Research",
1716
]
17+
dynamic = ["version"]
1818

1919
requires-python = ">=3.9"
2020
dependencies = [
21-
"qcodes >= 0.37.0",
21+
"qcodes >= 0.37.0, < 0.40.0",
2222
"qcodes_contrib_drivers >= 0.18.0",
2323
"matplotlib",
2424
"jsonschema",
2525
"zhinst-toolkit >= 0.3.3",
2626
"pyqt5",
27+
"versioningit ~= 2.2.0",
2728
]
2829

2930
[project.optional-dependencies]
@@ -35,12 +36,39 @@ Repository = "https://github.com/qutech/qumada"
3536
Documentation = "https://qumada.readthedocs.io/en/latest/"
3637

3738
[build-system]
38-
requires = ["setuptools"]
39+
requires = [
40+
"setuptools >= 68.1.0",
41+
"versioningit ~= 2.2.0",
42+
]
3943
build-backend = "setuptools.build_meta"
4044

45+
[tool.setuptools.package-data]
46+
qumada = ["*.json"]
47+
48+
[tool.versioningit]
49+
default-version = "0.0"
50+
51+
[tool.versioningit.onbuild]
52+
source-file = "src/qumada/_version.py"
53+
build-file = "qumada/_version.py"
54+
4155
[tool.pytest.ini_options]
56+
addopts = [
57+
"--import-mode=importlib",
58+
]
4259
qt_api = "pyqt5"
4360

61+
[tool.coverage.run]
62+
source = [
63+
"qumada",
64+
]
65+
66+
[tool.coverage.paths]
67+
source = [
68+
"src",
69+
"*/site-packages"
70+
]
71+
4472
[tool.black]
4573
line-length = 120
4674
target-version = ['py39', 'py310', 'py311']

setup.cfg

-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
[options]
2-
package_dir =
3-
= src
4-
packages = find:
5-
61
[flake8]
72
max-line-length = 120
83
extend-ignore = E203
@@ -11,8 +6,3 @@ extend-ignore = E203
116
show_error_codes = True
127
warn_unused_ignores = True
138
ignore_missing_imports = True
14-
15-
[coverage:run]
16-
omit =
17-
*/__init__.py
18-
src/tests/*

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"""Setup.py"""
44

55
from setuptools import setup
6+
from versioningit import get_cmdclasses
67

7-
setup()
8+
setup(cmdclass=get_cmdclasses())

src/qumada/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
# You should have received a copy of the GNU General Public License along with
1515
# QuMADA. If not, see <https://www.gnu.org/licenses/>.
1616
#
17+
18+
import qumada._version
19+
20+
__version__ = qumada._version.__version__

src/tests/__init__.py src/qumada/_version.py

+24
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,27 @@
1414
# You should have received a copy of the GNU General Public License along with
1515
# QuMADA. If not, see <https://www.gnu.org/licenses/>.
1616
#
17+
# Contributors:
18+
# - Daniel Grothe
19+
20+
# The idea is to get the current version from versioningit for editable installed qumada.
21+
# For built packages, versioningit's onbuild functionality replaces __version__'s value
22+
# with a fixed string.
23+
#
24+
# See
25+
# - https://github.com/QCoDeS/Qcodes/blob/master/qcodes/_version.py
26+
# - https://github.com/jwodder/versioningit/issues/8
27+
28+
29+
def get_version() -> str:
30+
from pathlib import Path
31+
32+
import versioningit
33+
34+
import qumada
35+
36+
qumada_path = Path(qumada.__file__).parent
37+
return versioningit.get_version(project_dir=qumada_path.parent.parent)
38+
39+
40+
__version__ = get_version()

tox.ini

+25-1
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,34 @@ envlist =
33
py{39,310,311}
44
flake8
55
mypy
6+
report
7+
docs
8+
9+
[tool:pytest]
10+
testpaths = src/tests
11+
addopts =
12+
--cov-report=term
613

714
[testenv:py{39,310,311}]
15+
setenv =
16+
COVERAGE_FILE = .coverage.{envname}
817
deps =
918
pytest
1019
pytest-cov
1120
pytest-cases
1221
pytest-mock
1322
pytest-qt
1423
commands =
15-
pytest --cov=src/qumada --cov-report term src/tests {posargs}
24+
pytest --cov {posargs}
25+
depends =
26+
report: py{39,310,311}
27+
28+
[testenv:report]
29+
skip_install = true
30+
deps = coverage
31+
commands =
32+
coverage combine
33+
coverage report
1634

1735
[testenv:flake8]
1836
deps =
@@ -25,3 +43,9 @@ deps =
2543
mypy
2644
commands =
2745
mypy src {posargs}
46+
47+
[testenv:docs]
48+
deps =
49+
-rdocs{/}requirements.txt
50+
commands =
51+
sphinx-build docs docs{/}_build -bhtml {posargs}

0 commit comments

Comments
 (0)