Skip to content

Commit

Permalink
feat: modernize packaging
Browse files Browse the repository at this point in the history
- use pyproject.toml
- use uv to build and publish package
- use trusted publishing
  • Loading branch information
nijel committed Nov 6, 2024
1 parent 73b608e commit e2806a2
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 97 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ on: [push, pull_request]
jobs:
setup:
runs-on: ubuntu-24.04
permissions:
id-token: write

steps:
- uses: actions/checkout@v4 # v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-setup-${{ hashFiles('**/requirements*.txt') }}
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements-test.txt
- uses: astral-sh/setup-uv@v3
- name: build
run: python -m build
run: uv build
- name: twine
run: twine check dist/*
run: uvx twine check dist/*
- name: pydistcheck
run: uvx pydistcheck --inspect dist/*
- name: pyroma
run: uvx pyroma dist/*.tar.gz
- name: check-wheel-contents
run: uvx check-wheel-contents dist/*.whl
- name: check-manifest
run: uvx check-manifest -v
- name: Publish package
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
run: uv publish --trusted-publishing always
6 changes: 2 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
include LICENSE
include ChangeLog
include README.rst
include CHANGES.rst
include requirements-test.txt
include requirements.txt
include *.rst
include *.md
include weblate_schemas/*.py
recursive-include weblate_schemas/schemas *
global-exclude *.swp *.swo
112 changes: 107 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,100 @@
[tool.black]
target-version = ['py39']
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=61.2"
]

[project]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
"Topic :: Software Development :: Internationalization",
"Topic :: Software Development :: Localization",
"Topic :: Utilities"
]
dependencies = [
"fqdn>=1.5.1",
"jsonschema>=4.23.0",
"rfc3987>=1.3.8",
"strict-rfc3339>=0.7"
]
description = "A collection of JSON schemas used by Weblate"
keywords = [
"i18n",
"l10n",
"gettext",
"weblate",
"translate"
]
name = "weblate_schemas"
requires-python = ">=3.9"
version = "2024.1"

[[project.authors]]
email = "[email protected]"
name = "Michal Čihař"

[project.entry-points."fedora.messages"]
"weblate.message.v1" = "weblate_schemas.messages:WeblateV1Message"

[project.license]
text = "MIT"

[project.optional-dependencies]
dev = [
"weblate_schemas[lint,test]"
]
lint = [
"pre-commit==4.0.1"
]
test = [
"pytest",
"pytest-cov",
"fedora-messaging",
"jsonschema[format]"
]

[project.readme]
content-type = "text/x-rst"
file = "README.rst"

[project.urls]
Documentation = "https://docs.weblate.org/"
Download = "https://github.com/WeblateOrg/weblate_schemas"
Funding = "https://weblate.org/donate/"
Homepage = "https://weblate.org/"
"Issue Tracker" = "https://github.com/WeblateOrg/weblate_schemas/issues"
"Source Code" = "https://github.com/WeblateOrg/weblate_schemas"
Twitter = "https://twitter.com/WeblateOrg"

[tool.check-manifest]
ignore = [
"LICENSES/*",
"json/*",
".reuse/dep5",
"scripts/*",
"*.toml",
"*.yml",
"*.yaml",
"*.json",
".editorconfig",
".weblate"
]

[tool.isort]
profile = "black"

[tool.ruff]
[tool.ruff.lint]
ignore = [
"D203", # CONFIG: incompatible with D211
"D212" # CONFIG: incompatible with D213
Expand Down Expand Up @@ -43,7 +133,19 @@ select = [
"SLF",
"N"
]
target-version = "py39"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 16

[tool.setuptools]
include-package-data = true
license-files = [
"LICENSE"
]
platforms = [
"any"
]
zip-safe = false

[tool.setuptools.packages.find]
namespaces = true
1 change: 0 additions & 1 deletion requirements-lint.txt

This file was deleted.

7 changes: 0 additions & 7 deletions requirements-test.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

57 changes: 0 additions & 57 deletions setup.cfg

This file was deleted.

5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@

from setuptools import setup

with open("requirements.txt") as handle:
REQUIRES = list(handle.read().splitlines())

setup(install_requires=REQUIRES)
setup()

0 comments on commit e2806a2

Please sign in to comment.