Skip to content

Commit de2a471

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 * declare conflicting extras for uv * format pyproject.toml with Tombi Co-authored-by: Sam Arbid <samaa2@kth.se>
1 parent 92be5f3 commit de2a471

11 files changed

Lines changed: 170 additions & 169 deletions

File tree

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ indent_size = 2
2525
# Dockerfile
2626
[Dockerfile]
2727
indent_size = 4
28+
29+
# Align TOML indenting with Tombi
30+
[*.toml]
31+
indent_size = 2

.github/workflows/i18n-push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ jobs:
1414
uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-push-base.yml@master
1515
with:
1616
extract-backend: true
17+
backend-package-path: invenio_records_rest
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_records_rest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ target/
6060

6161
# Vim swapfiles
6262
.*.sw?
63+
uv.lock

.tx/config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
# Translate python strings
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_records_rest/translations/messages.pot invenio_records_rest
14+
# $ pybabel init -i invenio_records_rest/translations/messages.pot -d invenio_records_rest/translations -l <lang>
15+
# $ pybabel compile -d invenio_records_rest/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 & 25 deletions
This file was deleted.

babel.ini

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

pyproject.toml

Lines changed: 160 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,162 @@
1+
# SPDX-FileCopyrightText: 2015-2018 CERN.
2+
# SPDX-FileCopyrightText: 2017 RERO.
3+
# SPDX-FileCopyrightText: 2022-2026 Graz University of Technology.
4+
# SPDX-FileCopyrightText: 2025 KTH Royal Institute of Technology.
5+
# SPDX-FileCopyrightText: 2026 TU Wien.
6+
# SPDX-License-Identifier: MIT
7+
8+
[project]
9+
name = "invenio-records-rest"
10+
description = "REST API for invenio-records."
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+
"api",
19+
"invenio",
20+
]
21+
classifiers = [
22+
"Development Status :: 5 - Production/Stable",
23+
]
24+
dependencies = [
25+
"bleach>=2.1.3",
26+
"ftfy>=4.4.3",
27+
"invenio-base>=2.0.0,<3.0.0",
28+
"invenio-i18n>=4.0.0,<5.0.0",
29+
"invenio-indexer>=6.0.0,<7.0.0",
30+
"invenio-pidstore>=4.0.0,<5.0.0",
31+
"invenio-records>=6.0.0,<7.0.0",
32+
"invenio-rest>=4.0.0,<5.0.0",
33+
"marshmallow-utils>=0.15.0,<1.0.0",
34+
]
35+
dynamic = ["version"]
36+
37+
[project.urls]
38+
Repository = "https://github.com/inveniosoftware/invenio-records-rest"
39+
40+
[project.entry-points."invenio_base.api_apps"]
41+
invenio_records_rest = "invenio_records_rest:InvenioRecordsREST"
42+
43+
[project.entry-points."invenio_base.api_blueprints"]
44+
invenio_records_rest = "invenio_records_rest.views:create_blueprint_from_app"
45+
46+
[project.entry-points."invenio_base.api_converters"]
47+
pid = "invenio_records_rest.utils:PIDConverter"
48+
pidpath = "invenio_records_rest.utils:PIDPathConverter"
49+
50+
[project.entry-points."invenio_base.converters"]
51+
pid = "invenio_records_rest.utils:PIDConverter"
52+
pidpath = "invenio_records_rest.utils:PIDPathConverter"
53+
54+
[project.entry-points."invenio_i18n.translations"]
55+
messages = "invenio_records_rest"
56+
57+
[project.optional-dependencies]
58+
citeproc = [
59+
"citeproc-py-styles>=0.1.3",
60+
"citeproc-py>=0.6.0",
61+
]
62+
datacite = [
63+
"datacite>=1.0.1",
64+
]
65+
docs = []
66+
dublincore = [
67+
"dcxml>=0.1.2",
68+
]
69+
elasticsearch7 = [
70+
"invenio-search[elasticsearch7]>=3.0.0,<4.0.0",
71+
]
72+
jsonld = [
73+
"pyld>=1.0.5,<2",
74+
]
75+
opensearch1 = [
76+
"invenio-search[opensearch1]>=3.0.0,<4.0.0",
77+
]
78+
opensearch2 = [
79+
"invenio-search[opensearch2]>=3.0.0,<4.0.0",
80+
]
81+
tests = [
82+
"citeproc-py-styles>=0.1.3",
83+
"citeproc-py>=0.6.0",
84+
"cryptography>=2.1.4",
85+
"datacite>=1.0.1",
86+
"dcxml>=0.1.2",
87+
"flask-login>=0.3.2",
88+
"invenio-config>=1.0.2,<2.0.0",
89+
"invenio-db[mysql,postgresql]>=2.2.0,<3.0.0",
90+
"mock>=4",
91+
"pyld>=1.0.5,<2",
92+
"pytest-black>=0.6.0",
93+
"pytest-invenio>=4.0.0,<5.0.0",
94+
"sphinx>=4.5",
95+
]
96+
197
[build-system]
2-
requires = ["setuptools", "wheel", "babel>2.8"]
3-
build-backend = "setuptools.build_meta"
98+
requires = ["hatchling"]
99+
build-backend = "hatchling.build"
100+
101+
# see https://babel.pocoo.org/en/latest/messages.html#toml-configuration-format
102+
[tool.babel]
103+
[tool.babel.compile_catalog]
104+
directory = "invenio_records_rest/translations/"
105+
use_fuzzy = true
106+
107+
[tool.babel.extract_messages]
108+
copyright_holder = "CERN"
109+
msgid_bugs_address = "info@inveniosoftware.org"
110+
mapping_file = "pyproject.toml"
111+
output_file = "invenio_records_rest/translations/messages.pot"
112+
add_comments = "NOTE"
113+
114+
[tool.babel.init_catalog]
115+
input_file = "invenio_records_rest/translations/messages.pot"
116+
output_dir = "invenio_records_rest/translations/"
117+
118+
[[tool.babel.mappings]]
119+
method = "javascript"
120+
pattern = "**.js"
121+
encoding = "utf-8"
122+
extract_messages = "$._, jQuery._"
123+
124+
[[tool.babel.mappings]]
125+
method = "python"
126+
pattern = "**.py"
127+
encoding = "utf-8"
128+
129+
[[tool.babel.mappings]]
130+
method = "jinja2"
131+
pattern = "**/templates/**.html"
132+
encoding = "utf-8"
133+
134+
[tool.hatch.version]
135+
path = "invenio_records_rest/__init__.py"
136+
137+
[tool.hatch.build.targets.sdist]
138+
include = [
139+
"/invenio_records_rest",
140+
]
141+
142+
[tool.isort]
143+
profile = "black"
144+
145+
[tool.pydocstyle]
146+
add_ignore = "D401"
147+
148+
[tool.pytest.ini_options]
149+
addopts = '--black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_records_rest --cov-report=term-missing'
150+
testpaths = "tests invenio_records_rest"
151+
live_server_scope = "module"
4152

153+
# UV needs to be told explicitly which extras are conflicting:
154+
# https://docs.astral.sh/uv/concepts/projects/config/#conflicting-dependencies
155+
[tool.uv]
156+
conflicts = [
157+
[
158+
{ extra = "opensearch1" },
159+
{ extra = "opensearch2" },
160+
{ extra = "elasticsearch7" },
161+
]
162+
]

run-tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ function cleanup() {
1616
trap cleanup EXIT
1717

1818

19-
python -m check_manifest
2019
python -m sphinx.cmd.build -qnN docs docs/_build/html
2120
eval "$(docker-services-cli up --db ${DB:-postgresql} --search ${SEARCH:-opensearch} --cache ${CACHE:-redis} --mq ${MQ:-rabbitmq} --env)"
2221
python -m pytest $@

setup.cfg

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

0 commit comments

Comments
 (0)