Skip to content

Commit 6e00dc2

Browse files
authored
Merge branch 'amaranth-lang:main' into main
2 parents 2669265 + fcafad1 commit 6e00dc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+9331
-4697
lines changed

.git_archival.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
.git_archival.txt export-subst
21
/amaranth/vendor/* -linguist-vendored

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @whitequark

.github/workflows/main.yaml

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
on: [push, pull_request]
1+
on:
2+
push:
3+
pull_request:
4+
merge_group:
5+
26
name: CI
37
jobs:
8+
49
test:
510
runs-on: ubuntu-latest
611
strategy:
712
matrix:
813
python-version:
9-
- '3.7'
1014
- '3.8'
1115
- '3.9'
1216
- '3.10'
1317
- '3.11'
14-
- 'pypy-3.7-v7.3.3'
18+
- 'pypy-3.8'
19+
- 'pypy-3.9'
1520
allow-failure:
1621
- false
1722
include:
@@ -20,12 +25,19 @@ jobs:
2025
continue-on-error: '${{ matrix.allow-failure }}'
2126
name: 'test (${{ matrix.python-version }})'
2227
steps:
28+
- name: Preserve Wasm cache
29+
uses: actions/cache@v3
30+
with:
31+
path: |
32+
~/.cache/wasmtime
33+
~/.cache/YoWASP
34+
key: ${{ runner.os }}-wasm
2335
- name: Check out source code
2436
uses: actions/checkout@v3
2537
with:
2638
fetch-depth: 0
27-
- name: Set up Python
28-
uses: actions/setup-python@v4
39+
- name: Set up PDM
40+
uses: pdm-project/setup-pdm@v3
2941
with:
3042
python-version: ${{ matrix.python-version }}
3143
- name: Install dependencies
@@ -34,25 +46,21 @@ jobs:
3446
sudo add-apt-repository 'deb http://ppa.launchpad.net/sri-csl/formal-methods/ubuntu bionic main'
3547
sudo apt-get update
3648
sudo apt-get install yices2
37-
pip install coverage codecov
38-
pip install yowasp-yosys==0.20.* # last version compatible with Python 3.7
39-
pip install -e .[builtin-yosys]
40-
pip install -r docs/requirements.txt
41-
- name: Preserve Wasm cache
42-
uses: actions/cache@v3
43-
with:
44-
path: |
45-
~/.cache/wasmtime
46-
~/.cache/yowasp
47-
key: ${{ runner.os }}-wasm
49+
pip install codecov yowasp-yosys
50+
pdm install --dev
4851
- name: Run tests
52+
env:
53+
YOSYS: yowasp-yosys
54+
NEXTPNR_ICE40: yowasp-nextpnr-ice40
55+
ICEPACK: yowasp-icepack
56+
SBY: yowasp-sby
57+
SMTBMC: yowasp-yosys-smtbmc
4958
run: |
50-
export AMARANTH_USE_YOSYS=builtin YOSYS=yowasp-yosys SBY=yowasp-sby SMTBMC=yowasp-yosys-smtbmc
51-
export PYTHONWARNINGS=error
52-
python -m coverage run -m unittest discover -t . -s tests
53-
unset PYTHONWARNINGS
54-
sphinx-build -b doctest docs/ docs/_build
59+
pdm run test
60+
- name: Submit code coverage
61+
run:
5562
codecov
63+
5664
document:
5765
runs-on: ubuntu-latest
5866
steps:
@@ -63,22 +71,31 @@ jobs:
6371
- name: Fetch tags from upstream repository
6472
run: |
6573
git fetch --tags https://github.com/amaranth-lang/amaranth.git
66-
- name: Set up Python
67-
uses: actions/setup-python@v4
74+
- name: Set up PDM
75+
uses: pdm-project/setup-pdm@v3
6876
with:
6977
python-version: '3.11'
7078
- name: Install dependencies
7179
run: |
72-
pip install -r docs/requirements.txt
73-
pip install .
80+
pdm install --dev
7481
- name: Build documentation
7582
run: |
76-
sphinx-build docs docs/_build
83+
pdm run document
7784
- name: Upload documentation archive
7885
uses: actions/upload-artifact@v3
7986
with:
8087
name: docs
8188
path: docs/_build
89+
90+
required: # group all required workflows into one for the required status check
91+
needs:
92+
- test
93+
- document
94+
runs-on: ubuntu-latest
95+
steps:
96+
- run: |
97+
true
98+
8299
publish-docs:
83100
needs: document
84101
if: github.repository == 'amaranth-lang/amaranth'
@@ -111,6 +128,7 @@ jobs:
111128
branch: main
112129
folder: docs/
113130
target-folder: docs/amaranth/${{ github.ref_name }}/
131+
114132
publish-docs-dev:
115133
needs: document
116134
if: github.repository != 'amaranth-lang/amaranth'

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Python
22
__pycache__/
3-
/*.egg-info
4-
/.eggs
3+
*.egg-info
54
/dist
65

6+
# pdm
7+
/.pdm-plugins
8+
/.pdm-python
9+
/.venv
10+
/pdm.lock
11+
712
# coverage
813
/.coverage
914
/htmlcov

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ FOSS toolchains are listed in **bold**.
4141

4242
## Community
4343

44-
Amaranth has a dedicated IRC channel, [#amaranth-lang at libera.chat](https://web.libera.chat/#amaranth-lang). Feel free to join to ask questions about using Amaranth or discuss ongoing development of Amaranth and its related projects.
44+
Amaranth has a dedicated IRC channel, [#amaranth-lang at libera.chat](https://web.libera.chat/#amaranth-lang), which is _bridged_[^1] to Matrix at [#amaranth-lang:matrix.org](https://matrix.to/#/#amaranth-lang:matrix.org). Feel free to join to ask questions about using Amaranth or discuss ongoing development of Amaranth and its related projects.
45+
46+
[^1]: The same messages appear on IRC and on Matrix, and one can participate in the discussion equally using either communication system.
4547

4648
## License
4749

amaranth/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
# Extract version for this package from the environment package metadata. This used to be a lot
2+
# more difficult in earlier Python versions, and the `__version__` field is a legacy of that time.
3+
import importlib.metadata
14
try:
2-
try:
3-
from importlib import metadata as importlib_metadata # py3.8+ stdlib
4-
except ImportError:
5-
import importlib_metadata # py3.7- shim
6-
__version__ = importlib_metadata.version(__package__)
7-
except ImportError:
8-
# No importlib_metadata. This shouldn't normally happen, but some people prefer not installing
9-
# packages via pip at all, instead using PYTHONPATH directly or copying the package files into
10-
# `lib/pythonX.Y/site-packages`. Although not a recommended way, we still try to support it.
5+
__version__ = importlib.metadata.version(__package__)
6+
except importlib.metadata.PackageNotFoundError:
7+
# No importlib metadata for this package. This shouldn't normally happen, but some people
8+
# prefer not installing packages via pip at all. Although not recommended we still support it.
119
__version__ = "unknown" # :nocov:
10+
del importlib
1211

1312

1413
from .hdl import *

amaranth/_toolchain/cxx.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

amaranth/_toolchain/yosys.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44
import subprocess
55
import warnings
66
import pathlib
7-
try:
8-
from importlib import metadata as importlib_metadata # py3.8+ stdlib
9-
except ImportError:
10-
try:
11-
import importlib_metadata # py3.7- shim
12-
except ImportError:
13-
importlib_metadata = None # not installed
7+
from importlib import metadata as importlib_metadata
148
try:
159
from importlib import resources as importlib_resources
1610
try:

amaranth/_unused.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __new__(cls, *args, src_loc_at=0, **kwargs):
2828
def __del__(self):
2929
if self._MustUse__silence:
3030
return
31+
if getattr(self._MustUse__warning, "_MustUse__silence", False):
32+
return
3133
if hasattr(self, "_MustUse__used") and not self._MustUse__used:
3234
if get_linter_option(self._MustUse__context["filename"],
3335
self._MustUse__warning.__name__, bool, True):

0 commit comments

Comments
 (0)