Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Migrate to pyproject.toml #1200

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 38 additions & 21 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,41 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

validate-pyproject:
name: Validate pyproject.toml
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5

- name: Install validate-pyproject
run: pip install validate-pyproject

- name: Validate pyproject.toml
run: validate-pyproject pyproject.toml

tests-linux:
name: Unit Tests (Linux)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'

strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Fonts Cache
id: cache-fonts-linux
uses: pat-s/[email protected]
Expand All @@ -66,7 +83,7 @@ jobs:
ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/
echo "Reloading Font Cache..."
fc-cache -f -v

- name: Link Fonts
if: steps.cache-fonts-linux.outputs.cache-hit == 'true'
run: |
Expand All @@ -75,21 +92,21 @@ jobs:
ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/
echo "Reloading Font Cache..."
fc-cache -f -v

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qy groff html2text python3-cffi python3-brotli libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 libxml2-dev libxml2-utils libxslt-dev
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint==61.2" "pydyf<0.10.0"
echo "Installing test dependencies..."
python -m pip install tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint==61.2" "pydyf<0.10.0"

- name: Generate Valid Tests
run: |
make yestests || true
cp -af tests/out/. tests/valid

- name: Test with tox
env:
PLATFORM: ubuntu-latest
Expand All @@ -99,20 +116,20 @@ jobs:
name: Unit Tests (macOS)
runs-on: macos-latest
if: github.event_name == 'pull_request'

strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Fonts Cache
id: cache-fonts-mac
uses: pat-s/[email protected]
Expand All @@ -128,7 +145,7 @@ jobs:
tar zxf fonts.tar.gz -C ~/fonts
mv ~/fonts/*/noto/* /Library/Fonts/
mv ~/fonts/*/roboto_mono/* /Library/Fonts/

- name: Install dependencies
run: |
brew install make diffutils
Expand All @@ -138,16 +155,16 @@ jobs:
brew install [email protected]
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint==61.2" "pydyf<0.10.0"
echo "Installing test dependencies..."
python -m pip install tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.1.0" "weasyprint==61.2" "pydyf<0.10.0"

- name: Generate Valid Tests
run: |
export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_FALLBACK_LIBRARY_PATH
echo "/usr/local/opt/make/libexec/gnubin" >> $GITHUB_PATH
make yestests || true
cp -af tests/out/. tests/valid

- name: Test with tox
env:
PLATFORM: macos-latest
Expand Down Expand Up @@ -180,8 +197,8 @@ jobs:
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.10"
echo "Installing test dependencies..."
python -m pip install . tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=4.10"

- name: Run pytests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
source venv/bin/activate
echo "Using version $PKG_VERSION_STRICT"
sed -i -r -e "s/^__version__ += '.*'$/__version__ = '$PKG_VERSION_STRICT'/" xml2rfc/__init__.py
python -m build --sdist
python -m build

- name: Update CHANGELOG
id: changelog
Expand Down
68 changes: 67 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
[project]
name = "xml2rfc"
dynamic = ["version"]
description = "xml2rfc generates RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies."
readme = "README.md"
requires-python = ">=3.9"
license = {file = "LICENSE"}
authors = [{name = "Henrik Levkowetz"}]
maintainers = [{name = "IETF Tools", email = "[email protected]"}]
keywords = ["ietf", "rfc", "id", "internet-draft", "xml", "xml2rfc", "xmlrfc"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Topic :: Text Processing",
"Topic :: Text Processing :: Markup :: XML",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
]
dependencies = [
"platformdirs>=3.6.0",
"configargparse>=1.2.3",
"google-i18n-address>=3.0.0",
"intervaltree>=3.1.0",
"jinja2>=3.1.2",
"lxml>=5.3.0",
"pycountry>=22.3.5",
"pyyaml>=5.3.1",
"requests>=2.5.0",
"setuptools>=24.2.0",
"wcwidth>=0.2.5"
]

[project.urls]
homepage = "https://github.com/ietf-tools/xml2rfc"
source = "https://github.com/ietf-tools/xml2rfc"
changelog = "https://github.com/ietf-tools/xml2rfc/blob/main/CHANGELOG.md"
releasenotes = "https://github.com/ietf-tools/xml2rfc/releases"
documentation = "https://ietf-tools.github.io/xml2rfc/"
issues = "https://github.com/ietf-tools/xml2rfc/issues"

[project.optional-dependencies]
pdf = ["weasyprint==61.2", "pydyf<0.10.0"]

[project.scripts]
xml2rfc = "xml2rfc.run:main"

[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true

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

[tool.setuptools.package-data]
xml2rfc = ["data/*", "templates/*"]

[tool.setuptools.packages.find]
include = ["xml2rfc*"]
12 changes: 0 additions & 12 deletions requirements.txt

This file was deleted.

64 changes: 0 additions & 64 deletions setup.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py

This file was deleted.

Loading