Skip to content

Commit 7ec8bd9

Browse files
committedApr 3, 2025
chore: move to uv
1 parent 4f2eb18 commit 7ec8bd9

File tree

3 files changed

+925
-58
lines changed

3 files changed

+925
-58
lines changed
 

‎doc/conf.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env python3
22

3+
import datetime
34
import os
45
import sys
6+
from importlib import metadata
57
from unittest import mock
68

7-
import toml
8-
99
sys.path.insert(0, os.path.abspath(".."))
1010
sys.path.insert(0, os.path.abspath("../slapd"))
1111

@@ -19,7 +19,6 @@ def __getattr__(cls, name):
1919
MOCK_MODULES = ["ldap"]
2020
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
2121

22-
config = toml.load("../pyproject.toml")
2322

2423
# -- General configuration ------------------------------------------------
2524

@@ -38,12 +37,11 @@ def __getattr__(cls, name):
3837
source_suffix = [".rst"]
3938
master_doc = "index"
4039
project = "slapd"
41-
copyright = "2020, python-ldap"
40+
year = datetime.datetime.now().strftime("%Y")
41+
copyright = f"{year}, python-ldap"
4242
author = "python-ldap"
4343

44-
release = config["tool"]["poetry"]["version"]
45-
version = ".".join(tuple(map(int, release.split(".")[:2])))
46-
language = None
44+
version = metadata.version("slapd")
4745
exclude_patterns = []
4846
pygments_style = "sphinx"
4947
todo_include_todos = False
@@ -71,7 +69,7 @@ def __getattr__(cls, name):
7169

7270
latex_elements = {}
7371
latex_documents = [
74-
(master_doc, "slapd.tex", "slapd Documentation", "python-ldap", "manual")
72+
(master_doc, "slapd.tex", "slapd Documentation", "python-slapd", "manual")
7573
]
7674

7775
# -- Options for manual page output ---------------------------------------

‎pyproject.toml

+58-50
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[build-system]
2-
requires = ["poetry-core>=1.0.0"]
3-
build-backend = "poetry.core.masonry.api"
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
44

5-
[tool]
6-
[tool.poetry]
5+
[project]
76
name = "slapd"
87
version = "0.1.5"
98
description = "Controls a slapd process in a pythonic way"
@@ -20,33 +19,41 @@ classifiers = [
2019
"License :: OSI Approved :: MIT License",
2120
"Topic :: Software Development :: Libraries :: Python Modules",
2221
]
23-
authors = ["python-ldap team <python-ldap@python.org>"]
24-
maintainers = [
25-
"Éloi Rivard <eloi.rivard@aquilenet.fr>",
26-
]
27-
homepage = "https://slapd.readthedocs.io/en/latest/"
28-
documentation = "https://slapd.readthedocs.io/en/latest/"
29-
repository = "https://gitlab.com/python-ldap/python-slapd"
22+
authors = [{name="python-ldap team", email="python-ldap@python.org"}]
23+
maintainers = [{name="Éloi Rivard", email="eloi.rivard@aquilenet.fr"}]
3024
readme = "README.md"
25+
requires-python = ">=3.9"
3126

32-
[tool.poetry.dependencies]
33-
python = "^3.8"
27+
[project.urls]
28+
homepage = "https://slapd.readthedocs.io/en/latest"
29+
documentation = "https://slapd.readthedocs.io/en/latest"
30+
repository = "https://gitlab.com/python-ldap/python-slapd"
3431

35-
[tool.poetry.group.dev.dependencies]
36-
coverage = "*"
37-
pytest = "*"
38-
pytest-cov = "*"
39-
tox = "*"
40-
mock = "*"
32+
[dependency-groups]
33+
dev = [
34+
"coverage",
35+
"pytest",
36+
"pytest-cov",
37+
"tox",
38+
"mock",
39+
]
4140

42-
[tool.poetry.group.doc]
43-
optional = true
41+
doc = [
42+
"recommonmark",
43+
"sphinx",
44+
"sphinx-rtd-theme",
45+
"sphinx-issues",
46+
]
4447

45-
[tool.poetry.group.doc.dependencies]
46-
recommonmark = "*"
47-
sphinx = "*"
48-
sphinx-rtd-theme = "*"
49-
sphinx-issues = "*"
48+
[tool.hatch.build]
49+
include = [
50+
"slapd/",
51+
"doc/",
52+
"tests/",
53+
"CHANGES.rst",
54+
"LICENSE.md",
55+
"README.md",
56+
]
5057

5158
[tool.coverage.run]
5259
source = [
@@ -94,30 +101,31 @@ norecursedirs = ".tox tests/perf .eggs .git build doc"
94101
doctest_optionflags= "ALLOW_UNICODE IGNORE_EXCEPTION_DETAIL ELLIPSIS"
95102

96103
[tool.tox]
97-
legacy_tox_ini = """
98-
[tox]
99-
isolated_build = true
100-
envlist = doc,py38,py39,py310,py311,py312,coverage
101-
skipsdist=true
104+
env_list = [
105+
"style",
106+
"py39",
107+
"py310",
108+
"py311",
109+
"py312",
110+
"py313",
111+
"doc",
112+
"coverage",
113+
]
102114

103-
[testenv]
104-
whitelist_externals = poetry
105-
commands =
106-
pip install poetry
107-
poetry install
108-
poetry run pytest {posargs}
115+
[tool.tox.env_run_base]
116+
dependency_groups = ["dev"]
117+
commands = [
118+
["pytest", "{posargs}"],
119+
]
109120

110-
[testenv:doc]
111-
commands =
112-
pip install poetry
113-
poetry install --only doc
114-
poetry run sphinx-build doc build/sphinx/html
121+
[tool.tox.env.doc]
122+
dependency_groups = ["doc"]
123+
commands = [
124+
["sphinx-build", "--builder", "html", "--fail-on-warning", "doc", "build/sphinx/html"],
125+
]
115126

116-
[testenv:coverage]
117-
commands =
118-
pip install poetry
119-
poetry install
120-
poetry run coverage erase
121-
poetry run pytest --cov {posargs}
122-
poetry run coverage html
123-
"""
127+
[tool.tox.env.coverage]
128+
commands = [
129+
["pytest", "--cov", "--cov-report", "term:skip-covered", "{posargs}"],
130+
["coverage", "html"],
131+
]

0 commit comments

Comments
 (0)
Please sign in to comment.