Skip to content

Commit d2cc64c

Browse files
committed
Rework packaging to use pyproject.toml. Add c-header
1 parent 2bc5e60 commit d2cc64c

File tree

8 files changed

+108
-106
lines changed

8 files changed

+108
-106
lines changed

.github/workflows/build.yml

+35-8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
types:
1212
- published
1313

14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
1417
jobs:
1518
test:
1619
strategy:
@@ -22,6 +25,7 @@ jobs:
2225
- 3.9
2326
- "3.10"
2427
- "3.11"
28+
- "3.12"
2529
include:
2630
- os: ubuntu-latest
2731

@@ -34,6 +38,12 @@ jobs:
3438
steps:
3539
- uses: actions/checkout@v3
3640

41+
- name: Set up Python 3.7 to bootstrap py3.6
42+
if: ${{ matrix.python-version == '3.6' }}
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version: 3.7
46+
3747
- name: Set up Python ${{ matrix.python-version }}
3848
uses: actions/setup-python@v4
3949
with:
@@ -43,7 +53,18 @@ jobs:
4353
run: |
4454
python -m pip install -U -r test/requirements.txt
4555
56+
# Python 3.6 cannot install directly from a pyproject.toml
57+
# Instead, build a wheel from py3.7 and then install it
58+
- name: Install via wheel
59+
if: ${{ matrix.python-version == '3.6' }}
60+
run: |
61+
python3.7 -m pip install build
62+
python3.7 -m build
63+
python --version
64+
python -m pip install ./dist/*.whl
65+
4666
- name: Install
67+
if: ${{ matrix.python-version != '3.6' }}
4768
run: |
4869
python -m pip install .
4970
@@ -85,7 +106,7 @@ jobs:
85106
- name: Set up Python
86107
uses: actions/setup-python@v4
87108
with:
88-
python-version: 3.8
109+
python-version: "3.10"
89110

90111
- name: Install dependencies
91112
run: |
@@ -118,32 +139,38 @@ jobs:
118139
mypy --config-file test/mypy.ini src/peakrdl
119140
120141
#-------------------------------------------------------------------------------
121-
build_sdist:
142+
build:
122143
needs:
123144
- test
124145
- lint
125146
- mypy
126-
name: Build source distribution
147+
name: Build distributions
127148
runs-on: ubuntu-latest
128149
steps:
129150
- uses: actions/checkout@v3
130151

131152
- uses: actions/setup-python@v4
132153
name: Install Python
133154
with:
134-
python-version: 3.8
155+
python-version: "3.10"
156+
157+
- name: Install dependencies
158+
run: |
159+
python -m pip install -U build
135160
136-
- name: Build sdist
137-
run: python setup.py sdist
161+
- name: Build
162+
run: python -m build
138163

139164
- uses: actions/upload-artifact@v3
140165
with:
141-
path: dist/*.tar.gz
166+
path: |
167+
dist/*.tar.gz
168+
dist/*.whl
142169
143170
#-------------------------------------------------------------------------------
144171
deploy:
145172
needs:
146-
- build_sdist
173+
- build
147174

148175
runs-on: ubuntu-latest
149176

docs/for-devs/exporter-plugin.rst

+5-15
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,13 @@ For consistency, it is recommended to define your plugin descriptor class in a
7474
file named ``__peakrdl__.py`` at the root of your package.
7575

7676
The example below shows how you would provide an entry point linkage to your
77-
exporter's descriptor class inside your package's ``setup.py``:
77+
exporter's descriptor class inside your package's ``pyproject.toml``:
7878

79-
.. code-block:: python
80-
:emphasize-lines: 7-11
79+
.. code-block:: toml
8180
82-
import setuptools
81+
[project.entry-points."peakrdl.exporters"]
82+
my-exporter = "my_package.__peakrdl__:MyExporterDescriptor"
8383
84-
setuptools.setup(
85-
name="my_package",
86-
packages=["my_package"],
87-
# ...
88-
entry_points = {
89-
"peakrdl.exporters": [
90-
'my-exporter = my_package.__peakrdl__:MyExporterDescriptor'
91-
]
92-
}
93-
)
9484
9585
* ``my_package``: The name of your installable Python module
9686
* ``peakrdl.exporters``: This is the namespace that PeakRDL will search. Any
@@ -101,7 +91,7 @@ exporter's descriptor class inside your package's ``setup.py``:
10191
* ``my-exporter``: The lefthand side of the assignment is your exporter's
10292
subcommand name. This text is what is used in the command line interface.
10393

104-
For a complete example, see `PeakRDL-ipxact's setup.py file <https://github.com/SystemRDL/PeakRDL-ipxact/blob/main/setup.py>`_.
94+
For a complete example, see `PeakRDL-cheader's pyproject.toml file <https://github.com/SystemRDL/PeakRDL-cheader/blob/main/pyproject.toml>`_.
10595

10696

10797
Via the PeakRDL configuration file

docs/for-devs/importer-plugin.rst

+4-16
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,13 @@ For consistency, it is recommended to define your plugin descriptor class in a
7474
file named ``__peakrdl__.py`` at the root of your package.
7575

7676
The example below shows how you would provide an entry point linkage to your
77-
importer's descriptor class inside your package's ``setup.py``:
77+
importer's descriptor class inside your package's ``pyproject.toml``:
7878

79-
.. code-block:: python
80-
:emphasize-lines: 7-11
79+
.. code-block:: toml
8180
82-
import setuptools
81+
[project.entry-points."peakrdl.importers"]
82+
my-importer = "my_package.__peakrdl__:MyImporterDescriptor"
8383
84-
setuptools.setup(
85-
name="my_package",
86-
packages=["my_package"],
87-
# ...
88-
entry_points = {
89-
"peakrdl.importers": [
90-
'my-importer = my_package.__peakrdl__:MyImporterDescriptor'
91-
]
92-
}
93-
)
9484
9585
* ``my_package``: The name of your installable Python module
9686
* ``peakrdl.importers``: This is the namespace that PeakRDL will search. Any
@@ -99,8 +89,6 @@ importer's descriptor class inside your package's ``setup.py``:
9989
* ``my_package.__peakrdl__:MyImporterDescriptor``: This is the import path that
10090
points to your descriptor class definition
10191

102-
For a complete example, see `PeakRDL-ipxact's setup.py file <https://github.com/SystemRDL/PeakRDL-ipxact/blob/main/setup.py>`_.
103-
10492

10593

10694
Via the PeakRDL configuration file

docs/index.rst

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Introduction
22
============
33

44
PeakRDL is a free and open-source control & status register (CSR) toolchain.
5-
This projects provides a command-line tool that unifies many aspects of register
5+
This project provides a command-line tool that unifies many aspects of register
66
automation centered around the SystemRDL register description language.
77

88
This tool can:
@@ -12,12 +12,9 @@ This tool can:
1212
* Generate synthesizable SystemVerilog RTL register blocks.
1313
* Create rich and dynamic HTML documentation.
1414
* Build a UVM register model abstraction layer.
15+
* Generate a C register abstraction header for software.
1516
* ... or extended this tool with your own plugins
1617

17-
.. warning::
18-
19-
The PeakRDL command line tool is still in pre-production (v0.x version numbers).
20-
During this time, I may decide to refactor things which could break compatibility.
2118

2219

2320
Installing
@@ -57,7 +54,8 @@ Links
5754
:hidden:
5855
:caption: Additional Exporter Docs
5956

60-
regblock <https://peakrdl-regblock.readthedocs.io/en/latest>
57+
regblock <https://peakrdl-regblock.readthedocs.io>
58+
c-header <https://peakrdl-cheader.readthedocs.io>
6159
ip-xact <https://peakrdl-ipxact.readthedocs.io/en/latest/exporter.html>
6260

6361
.. toctree::

pyproject.toml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[build-system]
2+
requires = ["setuptools", "setuptools-scm"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "peakrdl"
7+
dynamic = ["version"]
8+
requires-python = ">=3.6"
9+
dependencies = [
10+
"systemrdl-compiler >= 1.27.1, < 2",
11+
"peakrdl-html >= 2.10.1, < 3",
12+
"peakrdl-ipxact >= 3.4.1, < 4",
13+
"peakrdl-regblock >= 0.19.0, < 2",
14+
"peakrdl-systemrdl >= 0.3.0, < 2",
15+
"peakrdl-uvm >= 2.3.0, < 3",
16+
"peakrdl-cheader >= 1.0.0, < 2",
17+
"tomli;python_version<'3.11'",
18+
]
19+
20+
authors = [
21+
{name="Alex Mykyta"},
22+
]
23+
description = "Command-line tool for control/status register automation and code generation."
24+
readme = "README.md"
25+
license = {file = "LICENSE"}
26+
keywords = [
27+
"SystmRDL", "PeakRDL", "CSR", "compiler", "tool", "registers", "generator",
28+
"C", "header", "software", "Verilog", "SystemVerilog", "register abstraction layer",
29+
"FPGA", "ASIC",
30+
]
31+
classifiers = [
32+
"Development Status :: 5 - Production/Stable",
33+
"Programming Language :: Python",
34+
"Programming Language :: Python :: 3",
35+
"Programming Language :: Python :: 3.6",
36+
"Programming Language :: Python :: 3.7",
37+
"Programming Language :: Python :: 3.8",
38+
"Programming Language :: Python :: 3.9",
39+
"Programming Language :: Python :: 3.10",
40+
"Programming Language :: Python :: 3.11",
41+
"Programming Language :: Python :: 3.12",
42+
"Programming Language :: Python :: 3 :: Only",
43+
"Intended Audience :: Developers",
44+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
45+
"Operating System :: OS Independent",
46+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
47+
]
48+
49+
[project.urls]
50+
Source = "https://github.com/SystemRDL/PeakRDL"
51+
Tracker = "https://github.com/SystemRDL/PeakRDL/issues"
52+
Changelog = "https://github.com/SystemRDL/PeakRDL/releases"
53+
Documentation = "https://peakrdl.readthedocs.io/"
54+
55+
[tool.setuptools.dynamic]
56+
version = {attr = "peakrdl.__about__.__version__"}
57+
58+
[project.scripts]
59+
peakrdl = "peakrdl.main:main"

setup.py

-60
This file was deleted.

src/peakrdl/__about__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.9.0"
1+
__version__ = "1.0.0"

src/peakrdl/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)