Skip to content

Commit

Permalink
feat: modernize package build
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Nov 7, 2024
1 parent 9db3bba commit b9e5b6a
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 40 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,28 @@ on: [push, pull_request]
jobs:
setup:
runs-on: ubuntu-24.04
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-setup-${{ hashFiles('**/requirements*.txt') }}
- 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 --upgrade https://github.com/WeblateOrg/language-data/archive/main.zip
pip install -r requirements-dev.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 README.rst
include *.rst
include *.md
include LICENSE
include CHANGES.rst
include MANIFEST.in
include requirements.txt
include requirements-test.txt
include translation_finder/*.py
include translation_finder/discovery/*.py
recursive-include translation_finder/test_data *
123 changes: 120 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,112 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=61.2"
]

[project]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"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 = [
"charset-normalizer>2.0,<4.0",
"ruamel.yaml",
"weblate-language-data>=2021.2"
]
description = "A translation file finder used in Weblate."
keywords = [
"i18n",
"l10n",
"gettext",
"weblate",
"translate"
]
name = "translation-finder"
requires-python = ">=3.9"
version = "2.17"

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

[project.license]
text = "GPL-3.0-or-later"

[project.optional-dependencies]
dev = [
"translation-finder[lint,test]"
]
lint = [
"pre-commit==4.0.1"
]
test = [
"pytest",
"pytest-cov"
]

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

[project.scripts]
weblate-discover = "translation_finder.api:cli"

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

[tool.black]
target-version = ['py39']

[tool.check-manifest]
ignore = [
"LICENSES/*",
"json/*",
".reuse/dep5",
"scripts/*",
"*.toml",
"*.yml",
"*.yaml",
"*.json",
".editorconfig",
".weblate",
"weblate-discovery",
# Symlink causes issues
"translation_finder/test_data/linked",
"translation_finder/test_data/linked/*"
]

[tool.check-wheel-contents]
ignore = [
"W002" # Duplicate test files
]

[tool.isort]
profile = "black"

[tool.ruff]
[tool.pytest.ini_options]
doctest_optionflags = "NORMALIZE_WHITESPACE ALLOW_UNICODE"

[tool.ruff.lint]
ignore = [
"D10", # TODO: we are missing many docstrings
"D203", # CONFIG: incompatible with D211
Expand Down Expand Up @@ -47,7 +149,22 @@ 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"
]
packages = [
"translation_finder",
"translation_finder.discovery"
]
platforms = [
"any"
]

[tool.setuptools.package-dir]
translation_finder = "translation_finder"
2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

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

from setuptools import setup

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

setup(
install_requires=REQUIRES,
)
setup()

0 comments on commit b9e5b6a

Please sign in to comment.