Skip to content

Commit

Permalink
Rework packaging to use pyproject.toml. Add c-header
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Oct 17, 2023
1 parent 2bc5e60 commit d2cc64c
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 106 deletions.
43 changes: 35 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
types:
- published

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
test:
strategy:
Expand All @@ -22,6 +25,7 @@ jobs:
- 3.9
- "3.10"
- "3.11"
- "3.12"
include:
- os: ubuntu-latest

Expand All @@ -34,6 +38,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.7 to bootstrap py3.6
if: ${{ matrix.python-version == '3.6' }}
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -43,7 +53,18 @@ jobs:
run: |
python -m pip install -U -r test/requirements.txt
# Python 3.6 cannot install directly from a pyproject.toml
# Instead, build a wheel from py3.7 and then install it
- name: Install via wheel
if: ${{ matrix.python-version == '3.6' }}
run: |
python3.7 -m pip install build
python3.7 -m build
python --version
python -m pip install ./dist/*.whl
- name: Install
if: ${{ matrix.python-version != '3.6' }}
run: |
python -m pip install .
Expand Down Expand Up @@ -85,7 +106,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
Expand Down Expand Up @@ -118,32 +139,38 @@ jobs:
mypy --config-file test/mypy.ini src/peakrdl
#-------------------------------------------------------------------------------
build_sdist:
build:
needs:
- test
- lint
- mypy
name: Build source distribution
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: 3.8
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install -U build
- name: Build sdist
run: python setup.py sdist
- name: Build
run: python -m build

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
path: |
dist/*.tar.gz
dist/*.whl
#-------------------------------------------------------------------------------
deploy:
needs:
- build_sdist
- build

runs-on: ubuntu-latest

Expand Down
20 changes: 5 additions & 15 deletions docs/for-devs/exporter-plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,13 @@ For consistency, it is recommended to define your plugin descriptor class in a
file named ``__peakrdl__.py`` at the root of your package.

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

.. code-block:: python
:emphasize-lines: 7-11
.. code-block:: toml
import setuptools
[project.entry-points."peakrdl.exporters"]
my-exporter = "my_package.__peakrdl__:MyExporterDescriptor"
setuptools.setup(
name="my_package",
packages=["my_package"],
# ...
entry_points = {
"peakrdl.exporters": [
'my-exporter = my_package.__peakrdl__:MyExporterDescriptor'
]
}
)
* ``my_package``: The name of your installable Python module
* ``peakrdl.exporters``: This is the namespace that PeakRDL will search. Any
Expand All @@ -101,7 +91,7 @@ exporter's descriptor class inside your package's ``setup.py``:
* ``my-exporter``: The lefthand side of the assignment is your exporter's
subcommand name. This text is what is used in the command line interface.

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


Via the PeakRDL configuration file
Expand Down
20 changes: 4 additions & 16 deletions docs/for-devs/importer-plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,13 @@ For consistency, it is recommended to define your plugin descriptor class in a
file named ``__peakrdl__.py`` at the root of your package.

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

.. code-block:: python
:emphasize-lines: 7-11
.. code-block:: toml
import setuptools
[project.entry-points."peakrdl.importers"]
my-importer = "my_package.__peakrdl__:MyImporterDescriptor"
setuptools.setup(
name="my_package",
packages=["my_package"],
# ...
entry_points = {
"peakrdl.importers": [
'my-importer = my_package.__peakrdl__:MyImporterDescriptor'
]
}
)
* ``my_package``: The name of your installable Python module
* ``peakrdl.importers``: This is the namespace that PeakRDL will search. Any
Expand All @@ -99,8 +89,6 @@ importer's descriptor class inside your package's ``setup.py``:
* ``my_package.__peakrdl__:MyImporterDescriptor``: This is the import path that
points to your descriptor class definition

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



Via the PeakRDL configuration file
Expand Down
10 changes: 4 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Introduction
============

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

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

.. warning::

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


Installing
Expand Down Expand Up @@ -57,7 +54,8 @@ Links
:hidden:
:caption: Additional Exporter Docs

regblock <https://peakrdl-regblock.readthedocs.io/en/latest>
regblock <https://peakrdl-regblock.readthedocs.io>
c-header <https://peakrdl-cheader.readthedocs.io>
ip-xact <https://peakrdl-ipxact.readthedocs.io/en/latest/exporter.html>

.. toctree::
Expand Down
59 changes: 59 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "peakrdl"
dynamic = ["version"]
requires-python = ">=3.6"
dependencies = [
"systemrdl-compiler >= 1.27.1, < 2",
"peakrdl-html >= 2.10.1, < 3",
"peakrdl-ipxact >= 3.4.1, < 4",
"peakrdl-regblock >= 0.19.0, < 2",
"peakrdl-systemrdl >= 0.3.0, < 2",
"peakrdl-uvm >= 2.3.0, < 3",
"peakrdl-cheader >= 1.0.0, < 2",
"tomli;python_version<'3.11'",
]

authors = [
{name="Alex Mykyta"},
]
description = "Command-line tool for control/status register automation and code generation."
readme = "README.md"
license = {file = "LICENSE"}
keywords = [
"SystmRDL", "PeakRDL", "CSR", "compiler", "tool", "registers", "generator",
"C", "header", "software", "Verilog", "SystemVerilog", "register abstraction layer",
"FPGA", "ASIC",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
]

[project.urls]
Source = "https://github.com/SystemRDL/PeakRDL"
Tracker = "https://github.com/SystemRDL/PeakRDL/issues"
Changelog = "https://github.com/SystemRDL/PeakRDL/releases"
Documentation = "https://peakrdl.readthedocs.io/"

[tool.setuptools.dynamic]
version = {attr = "peakrdl.__about__.__version__"}

[project.scripts]
peakrdl = "peakrdl.main:main"
60 changes: 0 additions & 60 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/peakrdl/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.0"
__version__ = "1.0.0"
Empty file added src/peakrdl/py.typed
Empty file.

0 comments on commit d2cc64c

Please sign in to comment.