Skip to content

Commit d66881d

Browse files
committed
Migrate to the PDM build system.
1 parent 2f2ad5c commit d66881d

File tree

6 files changed

+40
-19
lines changed

6 files changed

+40
-19
lines changed

.git_archival.txt

-4
This file was deleted.

.gitattributes

-1
This file was deleted.

.github/workflows/main.yaml

+15-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ on:
33
pull_request:
44
schedule:
55
- cron: '0 0 * * *' # test daily against git HEAD of dependencies
6+
67
name: CI
78
jobs:
9+
810
test:
911
runs-on: ubuntu-latest
1012
strategy:
@@ -18,10 +20,16 @@ jobs:
1820
steps:
1921
- name: Check out source code
2022
uses: actions/checkout@v3
21-
- name: Set up Python
22-
uses: actions/setup-python@v4
23+
with:
24+
fetch-depth: 0
25+
- name: Set up PDM
26+
uses: pdm-project/setup-pdm@v3
2327
with:
2428
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
pip install codecov
32+
pdm install --dev
2533
- name: Install Amaranth release
2634
if: ${{ matrix.amaranth-version != 'git' }}
2735
run: |
@@ -30,9 +38,12 @@ jobs:
3038
if: ${{ matrix.amaranth-version == 'git' }}
3139
run: |
3240
pip install git+https://github.com/amaranth-lang/amaranth.git
33-
- name: Test
41+
- name: Run tests
3442
run: |
35-
python -m unittest discover
43+
pdm run test
44+
- name: Submit code coverage
45+
run:
46+
codecov
3647

3748
required: # group all required workflows into one for the required status check
3849
needs:

pdm_build.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from pdm.backend._vendor.packaging.version import Version
2+
3+
4+
# This is done in a PDM build hook without specifying `dynamic = [..., "version"]` to put all
5+
# of the static metadata into pyproject.toml. Tools other than PDM will not execute this script
6+
# and will use the generic version of the documentation URL (which redirects to /latest).
7+
def pdm_build_initialize(context):
8+
version = Version(context.config.metadata["version"])
9+
if version.is_prerelease:
10+
url_version = "latest"
11+
else:
12+
url_version = f"v{version}"
13+
context.config.metadata["urls"]["Documentation"] += url_version

pyproject.toml

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Project metadata
22

3+
[tool.pdm.version]
4+
source = "scm"
5+
36
[project]
47
dynamic = ["version"]
58

@@ -15,17 +18,16 @@ dependencies = [
1518
]
1619

1720
[project.urls]
21+
"Homepage" = "https://amaranth-lang.org/"
22+
"Documentation" = "https://amaranth-lang.org/docs/amaranth-soc/" # modified in pdm_build.py
1823
"Source Code" = "https://github.com/amaranth-lang/amaranth-soc"
1924
"Bug Tracker" = "https://github.com/amaranth-lang/amaranth-soc/issues"
2025

2126
# Build system configuration
2227

2328
[build-system]
24-
requires = ["wheel", "setuptools>=67.0", "setuptools_scm[toml]>=6.2"]
25-
build-backend = "setuptools.build_meta"
26-
27-
[tool.setuptools_scm]
28-
local_scheme = "node-and-timestamp"
29+
requires = ["pdm-backend"]
30+
build-backend = "pdm.backend"
2931

3032
# Development workflow configuration
3133

@@ -34,7 +36,7 @@ test = [
3436
"coverage",
3537
]
3638
docs = [
37-
"sphinx~=5.3",
39+
"sphinx~=7.1",
3840
"sphinx-rtd-theme~=1.2",
3941
"sphinx-autobuild",
4042
]
@@ -43,3 +45,7 @@ docs = [
4345
test.composite = ["test-code"]
4446
test-code.env = {PYTHONWARNINGS = "error"}
4547
test-code.cmd = "python -m coverage run -m unittest discover -t . -s tests -v"
48+
test-docs.cmd = "sphinx-build -b doctest docs docs/_build"
49+
50+
document.cmd = "sphinx-build docs docs/_build"
51+
document-live.cmd = "sphinx-autobuild docs docs/_build --watch amaranth"

setup.py

-4
This file was deleted.

0 commit comments

Comments
 (0)