Skip to content

Commit 258c853

Browse files
max-moserSamk13
andcommitted
chore(setup): migrate from setuptools to hatchling
* remove MANIFEST.in because that's only relevant for setuptools * translate the i18n/translation mechanisms as well * bump requires-python due to dependencies requiring 3.9+ * declare conflicting extras for uv * format pyproject.toml with Tombi Co-authored-by: Sam Arbid <samaa2@kth.se>
1 parent cad03f1 commit 258c853

11 files changed

Lines changed: 158 additions & 174 deletions

File tree

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ indent_size = 2
3434
# Dockerfile
3535
[Dockerfile]
3636
indent_size = 4
37+
38+
# Align TOML indenting with Tombi
39+
[*.toml]
40+
indent_size = 2

.github/workflows/i18n-push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ jobs:
1313
uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-push-base.yml@master
1414
with:
1515
extract-backend: true
16+
backend-package-path: invenio_administration
1617
frontend-package-path: invenio_administration/assets/semantic-ui/translations/invenio_administration
1718
secrets: inherit

.github/workflows/pypi-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ jobs:
1111
secrets: inherit
1212
with:
1313
babel-compile-catalog: true
14+
backend-package-path: invenio_administration

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var/
2727
*.egg
2828
Pipfile
2929
Pipfile.lock
30-
pyproject.toml
30+
uv.lock
3131

3232
# PyInstaller
3333
# Usually these files are written by a python script from a template

.tx/config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# TODO: Transifex integration
1111
#
1212
# 1) Create message catalog:
13-
# $ python setup.py extract_messages
14-
# $ python setup.py init_catalog -l <lang>
15-
# $ python setup.py compile_catalog
13+
# $ pybabel extract -F pyproject.toml -o invenio_administration/translations/messages.pot invenio_administration
14+
# $ pybabel init -i invenio_administration/translations/messages.pot -d invenio_administration/translations -l <lang>
15+
# $ pybabel compile -d invenio_administration/translations --use-fuzzy
1616
# 2) Ensure project has been created on Transifex under the inveniosoftware
1717
# organisation.
1818
# 3) Install the transifex-client

MANIFEST.in

Lines changed: 0 additions & 34 deletions
This file was deleted.

babel.ini

Lines changed: 0 additions & 18 deletions
This file was deleted.

pyproject.toml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# SPDX-FileCopyrightText: 2015-2024 CERN.
2+
# SPDX-FileCopyrightText: 2022-2026 Graz University of Technology.
3+
# SPDX-FileCopyrightText: 2023-2025 KTH Royal Institute of Technology.
4+
# SPDX-FileCopyrightText: 2025 Northwestern University.
5+
# SPDX-FileCopyrightText: 2026 TU Wien.
6+
# SPDX-License-Identifier: MIT
7+
8+
[project]
9+
name = "invenio-administration"
10+
description = "Invenio module that adds administration panel to the system."
11+
readme = "README.rst"
12+
requires-python = ">=3.9"
13+
license = "MIT"
14+
authors = [
15+
{ name = "CERN", email = "info@inveniosoftware.org" },
16+
]
17+
keywords = [
18+
"admin",
19+
"administration",
20+
"backoffice",
21+
"invenio",
22+
]
23+
classifiers = [
24+
"Development Status :: 5 - Production/Stable",
25+
]
26+
dependencies = [
27+
"flask-menu>=0.5.0",
28+
"flask-principal>=0.4.0",
29+
"invenio-accounts>=9.0.0,<10.0.0",
30+
"invenio-base>=2.3.0,<3.0.0",
31+
"invenio-db[postgresql,mysql]>=2.2.0,<3.0.0",
32+
"invenio-i18n>=4.0.0,<5.0.0",
33+
"invenio-records-resources>=11.0.0,<12.0.0",
34+
"invenio-search-ui>=5.0.0,<6.0.0",
35+
"invenio-theme>=5.0.0,<6.0.0",
36+
]
37+
dynamic = ["version"]
38+
39+
[project.urls]
40+
Repository = "https://github.com/inveniosoftware/invenio-administration"
41+
42+
[project.entry-points."invenio_access.actions"]
43+
administration_access_action = "invenio_administration.permissions:administration_access_action"
44+
administration_view_action = "invenio_administration.permissions:administration_view_action"
45+
46+
[project.entry-points."invenio_assets.webpack"]
47+
invenio_administration = "invenio_administration.webpack:theme"
48+
49+
[project.entry-points."invenio_base.api_apps"]
50+
invenio_administration = "invenio_administration:InvenioAdministration"
51+
52+
[project.entry-points."invenio_base.apps"]
53+
invenio_administration = "invenio_administration:InvenioAdministration"
54+
55+
[project.entry-points."invenio_base.blueprints"]
56+
invenio_administration = "invenio_administration.views:get_administration_panel_bp"
57+
58+
[project.entry-points."invenio_base.finalize_app"]
59+
finalize_app = "invenio_administration.ext:finalize_app"
60+
61+
[project.entry-points."invenio_i18n.translations"]
62+
messages = "invenio_administration"
63+
64+
[project.optional-dependencies]
65+
elasticsearch7 = [
66+
"invenio-search[elasticsearch7]>=3.0.0,<4.0.0",
67+
]
68+
opensearch1 = [
69+
"invenio-search[opensearch1]>=3.0.0,<4.0.0",
70+
]
71+
opensearch2 = [
72+
"invenio-search[opensearch2]>=3.0.0,<4.0.0",
73+
]
74+
tests = [
75+
"invenio-access>=7.0.0,<8.0.0",
76+
"invenio-app>=3.0.0,<4.0.0",
77+
"pytest-black>=0.6.0",
78+
"pytest-invenio>=4.0.0,<5.0.0",
79+
"sphinx>=4.5",
80+
]
81+
82+
[build-system]
83+
requires = ["hatchling"]
84+
build-backend = "hatchling.build"
85+
86+
# see https://babel.pocoo.org/en/latest/messages.html#toml-configuration-format
87+
[tool.babel]
88+
[tool.babel.compile_catalog]
89+
directory = "invenio_administration/translations/"
90+
use_fuzzy = true
91+
92+
[tool.babel.extract_messages]
93+
copyright_holder = "CERN"
94+
msgid_bugs_address = "info@inveniosoftware.org"
95+
mapping_file = "pyproject.toml"
96+
output_file = "invenio_administration/translations/messages.pot"
97+
add_comments = "NOTE"
98+
99+
[tool.babel.init_catalog]
100+
input_file = "invenio_administration/translations/messages.pot"
101+
output_dir = "invenio_administration/translations/"
102+
103+
[[tool.babel.mappings]]
104+
method = "javascript"
105+
pattern = "**.js"
106+
encoding = "utf-8"
107+
extract_messages = "$._, jQuery._"
108+
109+
[[tool.babel.mappings]]
110+
method = "python"
111+
pattern = "**.py"
112+
encoding = "utf-8"
113+
114+
[[tool.babel.mappings]]
115+
method = "jinja2"
116+
pattern = "**/templates/**.html"
117+
encoding = "utf-8"
118+
119+
[tool.hatch.version]
120+
path = "invenio_administration/__init__.py"
121+
122+
[tool.hatch.build.targets.sdist]
123+
include = [
124+
"/invenio_administration",
125+
]
126+
127+
[tool.isort]
128+
profile = "black"
129+
130+
[tool.pydocstyle]
131+
add_ignore = "D401"
132+
133+
[tool.pytest.ini_options]
134+
addopts = '--black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_administration --cov-report=term-missing'
135+
filterwarnings = ["ignore::pytest.PytestDeprecationWarning"]
136+
testpaths = "tests invenio_administration"
137+
live_server_scope = "module"
138+
139+
# UV needs to be told explicitly which extras are conflicting:
140+
# https://docs.astral.sh/uv/concepts/projects/config/#conflicting-dependencies
141+
[tool.uv]
142+
conflicts = [
143+
[
144+
{ extra = "opensearch1" },
145+
{ extra = "opensearch2" },
146+
{ extra = "elasticsearch7" },
147+
]
148+
]

run-tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ if [[ ${keep_services} -eq 0 ]]; then
3939
trap cleanup EXIT
4040
fi
4141

42-
python -m check_manifest --ignore ".*-requirements.txt"
4342
python -m sphinx.cmd.build -qnNW docs docs/_build/html
4443
# TODO: Remove services below that are not neeed (fix also the usage note).
4544
eval "$(docker-services-cli up --db ${DB:-postgresql} --search ${SEARCH:-opensearch} --cache ${CACHE:-redis} --mq ${MQ:-rabbitmq} --env)"

setup.cfg

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)