Skip to content

Commit

Permalink
feat: modernize build system
Browse files Browse the repository at this point in the history
- use pyproject.toml instead of setup.cfg
- consistent build environment setup
  • Loading branch information
nijel committed Sep 30, 2024
1 parent 2a6e57d commit 65b0ec9
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4 # v4
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: uv pip install --system -r requirements-test.txt
run: uv pip install --system -e .[dev]
- name: build sdist
run: python -m build
- name: twine
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/submodules-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,18 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@v4 # v4
- uses: actions/checkout@v4
with:
submodules: true
- run: sudo apt-get --option="APT::Acquire::Retries=3" update
- run: sudo apt-get --option="APT::Acquire::Retries=3" install -y gettext
- run: sudo apt-get update
- run: sudo apt-get install -y gettext
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: requirements*.txt
- uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -r requirements-dev.txt
run: uv pip install --system -e .[dev]
- run: make
- name: Update renovate branch
if: github.ref != 'refs/heads/main'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4 # v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/update-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,18 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@v4 # v4
- uses: actions/checkout@v4
with:
submodules: true
- run: sudo apt-get --option="APT::Acquire::Retries=3" update
- run: sudo apt-get --option="APT::Acquire::Retries=3" install -y gettext
- run: sudo apt-get update
- run: sudo apt-get install -y gettext
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: requirements*.txt
- uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
pip install -r requirements-dev.txt
run: uv pip install --system -e .[dev]
- run: make
- name: Update renovate branch
if: github.ref != 'refs/heads/main'
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: requirements-txt-fixer
- id: check-merge-conflict
- id: check-json
- id: debug-statements
Expand Down
77 changes: 76 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,66 @@
[build-system]
build-backend = "setuptools.build_meta"
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel", "translate-toolkit"] # PEP 508 specifications.
requires = [
"setuptools>=61.2",
"translate-toolkit"
]

[project]
authors = [
{name = "Michal Čihař", email = "[email protected]"}
]
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",
"Topic :: Software Development :: Internationalization",
"Topic :: Software Development :: Localization",
"Topic :: Utilities"
]
description = "Language definitions for Weblate"
keywords = [
"i18n l10n gettext git mercurial translate"
]
name = "weblate-language-data"
requires-python = ">=3.9"
version = "2024.6"

[project.license]
text = "MIT"

[project.optional-dependencies]
dev = [
"weblate-language-data[django,lint,test]",
"translate-toolkit==3.13.4"
]
django = [
"Django"
]
lint = [
"pre-commit==3.8.0"
]
test = [
"build==1.2.2",
"twine==5.1.1"
]

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

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

[tool.black]
target-version = ['py39']
Expand Down Expand Up @@ -61,3 +121,18 @@ select = [

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

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

[tool.setuptools.package-dir]
weblate_language_data = "weblate_language_data"

[tool.setuptools.packages.find]
namespaces = true
2 changes: 0 additions & 2 deletions requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements-lint.txt

This file was deleted.

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

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

40 changes: 0 additions & 40 deletions setup.cfg

This file was deleted.

0 comments on commit 65b0ec9

Please sign in to comment.