Skip to content

Commit 75fd205

Browse files
authored
Modernize build system using PEP621 semantics (#97)
For more details, see https://peps.python.org/pep-0621/
1 parent d4d6198 commit 75fd205

File tree

11 files changed

+150
-3001
lines changed

11 files changed

+150
-3001
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
max-line-length = 88
3+
select = C,E,F,W
4+
ignore = E203,E231,E501,E741,W503,W504,C901
5+
per-file-ignores =
6+
**/__init__.py:F401,E402,F403

.github/workflows/pypi.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,22 @@ jobs:
2727
- uses: actions/setup-python@v4
2828
with:
2929
python-version: "3.8"
30-
- name: Build the sdist
30+
- name: Build the sdist and wheel
3131
run: |
32-
python setup.py sdist
32+
python -m pip install --upgrade pip build
33+
python -m build
3334
- name: Check the sdist installs and imports
3435
run: |
35-
mkdir -p test-sdist
36-
cd test-sdist
3736
python -m venv venv-sdist
38-
venv-sdist/bin/python -m pip install ../dist/aehmc-*.tar.gz
37+
# Since the whl distribution is build using sdist, it suffices
38+
# to only test the wheel installation to ensure both function as expected.
39+
venv-sdist/bin/python -m pip install dist/aehmc-*.whl
3940
venv-sdist/bin/python -c "import aehmc;print(aehmc.__version__)"
40-
- uses: actions/upload-artifact@v2
41+
- uses: actions/upload-artifact@v3
4142
with:
4243
name: artifact
43-
path: dist/*
44+
path: dist
45+
if-no-files-found: error
4446

4547
upload_pypi:
4648
name: Upload to PyPI on release

MANIFEST.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
include versioneer.py
2-
include aehmc/_version.py
1+
prune .github
2+
prune examples
3+
exclude *.yaml
4+
exclude *.yml
5+
exclude .git*
6+
exclude *.py
7+
exclude *rc
8+
exclude .flake8

aehmc/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
from . import _version
2-
3-
__version__ = _version.get_versions()["version"]
1+
try:
2+
from ._version import __version__, __version_tuple__
3+
except ImportError: # pragma: no cover
4+
raise RuntimeError(
5+
"Unable to find the version number that is generated when either building or "
6+
"installing from source. Please make sure that `aehmc` has been properly "
7+
"installed, e.g. with\n\n pip install -e .\n"
8+
)

0 commit comments

Comments
 (0)