Migrate to pyproject.toml

This commit is contained in:
Alex Mykyta
2023-10-24 23:01:30 -07:00
parent 62518b318b
commit f2cb2425b3
3 changed files with 84 additions and 64 deletions

View File

@@ -11,6 +11,8 @@ on:
types:
- published
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
@@ -36,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:
@@ -45,7 +53,18 @@ jobs:
run: |
python -m pip install -U -r tests/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 .
@@ -120,12 +139,12 @@ jobs:
mypy --config-file tests/mypy.ini src/peakrdl_regblock
#-------------------------------------------------------------------------------
build_sdist:
build:
needs:
- test
- lint
- mypy
name: Build source distribution
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -135,17 +154,23 @@ jobs:
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install -U build
- name: Build sdist
run: python setup.py sdist
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

54
pyproject.toml Normal file
View File

@@ -0,0 +1,54 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name = "peakrdl-regblock"
dynamic = ["version"]
requires-python = ">=3.6"
dependencies = [
"systemrdl-compiler >= 1.27.0, < 2",
"Jinja2>=2.11",
]
authors = [
{name="Alex Mykyta"},
]
description = "Compile SystemRDL into a SystemVerilog control/status register (CSR) block"
readme = "README.md"
license = {file = "LICENSE"}
keywords = [
"SystmRDL", "PeakRDL", "CSR", "compiler", "tool", "registers", "generator",
"Verilog", "SystemVerilog", "register abstraction layer",
"FPGA", "ASIC",
]
classifiers = [
#"Development Status :: 5 - Production/Stable",
"Development Status :: 4 - Beta",
"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-regblock"
Tracker = "https://github.com/SystemRDL/PeakRDL-regblock/issues"
Changelog = "https://github.com/SystemRDL/PeakRDL-regblock/releases"
Documentation = "https://peakrdl-regblock.readthedocs.io/"
[tool.setuptools.dynamic]
version = {attr = "peakrdl_regblock.__about__.__version__"}
[project.entry-points."peakrdl.exporters"]
regblock = "peakrdl_regblock.__peakrdl__:Exporter"

View File

@@ -1,59 +0,0 @@
import os
import setuptools
with open("README.md", "r", encoding='utf-8') as fh:
long_description = fh.read()
with open(os.path.join("src/peakrdl_regblock", "__about__.py"), encoding='utf-8') as f:
v_dict = {}
exec(f.read(), v_dict)
version = v_dict['__version__']
setuptools.setup(
name="peakrdl-regblock",
version=version,
author="Alex Mykyta",
author_email="amykyta3@github.com",
description="Compile SystemRDL into a SystemVerilog control/status register (CSR) block",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/SystemRDL/PeakRDL-regblock",
package_dir={'': 'src'},
packages=setuptools.find_packages("src"),
include_package_data=True,
python_requires='>=3.6',
install_requires=[
"systemrdl-compiler >= 1.27.0, < 2",
"Jinja2>=2.11",
],
entry_points = {
"peakrdl.exporters": [
'regblock = peakrdl_regblock.__peakrdl__:Exporter'
]
},
classifiers=(
#"Development Status :: 5 - Production/Stable",
"Development Status :: 3 - Alpha",
"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={
"Documentation": "http://peakrdl-regblock.readthedocs.io",
"Source": "https://github.com/SystemRDL/PeakRDL-regblock",
"Tracker": "https://github.com/SystemRDL/PeakRDL-regblock/issues",
"Changelog": "https://github.com/SystemRDL/PeakRDL-regblock/releases",
},
)