Skip to content

Commit

Permalink
chore: improve packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Nov 6, 2024
1 parent d2241a7 commit 3f77bfb
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 34 deletions.
26 changes: 0 additions & 26 deletions .coveragerc

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright © Michal Čihař <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later

name: Distribution

on: [push, pull_request]

jobs:
setup:
runs-on: ubuntu-24.04
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: astral-sh/setup-uv@v3
- name: build
run: uv build
- name: twine
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')
run: uv publish --trusted-publishing always
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
include README.md
include README.rst
include SECURITY.md
include manage.py
recursive-include wlhosted *.py
recursive-include wlhosted/error *.html
recursive-include wlhosted/integrations/templates *.html
recursive-include wlhosted/integrations/templates *.txt
recursive-include wlhosted/legal/templates *.html
recursive-include wlhosted/payments/templates *.html
global-exclude *.swp *.swo
Expand Down
86 changes: 79 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ requires = ["setuptools>=61.2"]

[project]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Internationalization",
"Topic :: Software Development :: Localization",
"Topic :: Internet :: WWW/HTTP",
Expand All @@ -30,8 +34,15 @@ dependencies = [
"Weblate>=5.5.3"
]
description = "Hosted Weblate Customization"
keywords = [
"i18n",
"l10n",
"gettext",
"git",
"mercurial",
"translate"
]
name = "wlhosted"
readme = "README.rst"
requires-python = ">=3.11"
version = "2024.10"

Expand All @@ -46,20 +57,76 @@ text = "GPLv3+"
dev = [
"wlhosted[lint,test]"
]
lint = ["pre-commit==4.0.1"]
lint = [
"pre-commit==4.0.1"
]
test = [
"httpretty",
"coverage",
"build==1.2.2.post1",
"twine==5.1.1"
]

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

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

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

[tool.check-wheel-contents]
ignore = [
"W004" # Django migrations fail here
]

[tool.black]
target-version = ['py311']
[tool.coverage.paths]
source = [
"."
]

[tool.coverage.report]
exclude_also = [
"@(abc\\.)?abstractmethod",
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
# Type checking
"if TYPE_CHECKING:"
]

[tool.coverage.run]
branch = true
concurrency = ["thread", "multiprocessing"]
omit = [
".venv*/*"
]

[tool.isort]
profile = "black"
Expand Down Expand Up @@ -128,5 +195,10 @@ max-complexity = 16

[tool.setuptools]
include-package-data = true
packages = ["wlhosted"]
zip-safe = true

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

[tool.setuptools.packages.find]
namespaces = true

0 comments on commit 3f77bfb

Please sign in to comment.