Skip to content

Commit 5adbefd

Browse files
authored
Remove Sphinx pin + migrate to hatchling (#9)
1 parent 37bfb42 commit 5adbefd

File tree

7 files changed

+24
-26
lines changed

7 files changed

+24
-26
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ repos:
33
rev: 5.13.2
44
hooks:
55
- id: isort
6-
name: isort (python)
76

87
- repo: https://github.com/psf/black-pre-commit-mirror
98
rev: 23.12.0
@@ -24,7 +23,6 @@ repos:
2423
rev: 1.5.3
2524
hooks:
2625
- id: pyproject-fmt
27-
additional_dependencies: [tox]
2826

2927
- repo: https://github.com/abravalheri/validate-pyproject
3028
rev: v0.15

bootstrapper/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
from .bootstrapper import Bootstrapper
2+
3+
__all__ = ["Bootstrapper"]
4+
__version__ = "0.1.2"

bootstrapper/bootstrapper.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(
3636
self.readme_url = "https://raw.githubusercontent.com/egeakman/python-docs-bootstrapper/master/bootstrapper/data/README.md"
3737
self.gitignore_url = "https://raw.githubusercontent.com/egeakman/python-docs-bootstrapper/master/bootstrapper/data/.gitignore"
3838
self.makefile_url = "https://raw.githubusercontent.com/egeakman/python-docs-bootstrapper/master/bootstrapper/data/Makefile"
39+
self.data_dir = f"{os.path.dirname(__file__)}/../python-docs-bootstrapper-data"
3940

4041
def _request(self, url: str) -> str:
4142
with urllib.request.urlopen(url) as response:
@@ -126,9 +127,7 @@ def create_readme(self) -> None:
126127
self.logger.warning(
127128
"\n ⚠️ Failed to fetch README.md from GitHub, using local copy..."
128129
)
129-
readme = Path(f"{os.path.dirname(__file__)}/data/README.md").read_text(
130-
encoding="utf-8"
131-
)
130+
readme = Path(f"{self.data_dir}/README.md").read_text(encoding="utf-8")
132131
readme = readme.replace("{{translation.language}}", self.language)
133132
with open(f"{self.translation_repo}/README.md", "w", encoding="utf-8") as f:
134133
f.write(readme)
@@ -142,9 +141,7 @@ def create_gitignore(self) -> None:
142141
self.logger.warning(
143142
"\n ⚠️ Failed to fetch .gitignore from GitHub, using local copy..."
144143
)
145-
gitignore = Path(f"{os.path.dirname(__file__)}/data/.gitignore").read_text(
146-
encoding="utf-8"
147-
)
144+
gitignore = Path(f"{self.data_dir}/.gitignore").read_text(encoding="utf-8")
148145
with open(f"{self.translation_repo}/.gitignore", "w", encoding="utf-8") as f:
149146
f.write(gitignore)
150147
self.logger.info("✅\n")
@@ -157,9 +154,7 @@ def create_makefile(self) -> None:
157154
self.logger.warning(
158155
"\n ⚠️ Failed to fetch Makefile from GitHub, using local copy..."
159156
)
160-
makefile = Path(f"{os.path.dirname(__file__)}/data/Makefile").read_text(
161-
encoding="utf-8"
162-
)
157+
makefile = Path(f"{self.data_dir}/Makefile").read_text(encoding="utf-8")
163158
head = (
164159
subprocess.run(
165160
["git", "-C", self.cpython_repo, "rev-parse", "HEAD"],
File renamed without changes.
File renamed without changes.
File renamed without changes.

pyproject.toml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[build-system]
2-
build-backend = "setuptools.build_meta"
2+
build-backend = "hatchling.build"
33
requires = [
4-
"setuptools>=61.2",
4+
"hatchling",
55
]
66

77
[project]
88
name = "python-docs-bootstrapper"
9-
version = "0.1.2"
109
description = "Bootstrapper for Python documentation translations"
1110
readme = "README.md"
1211
keywords = [
@@ -35,8 +34,11 @@ classifiers = [
3534
"Programming Language :: Python :: 3.12",
3635
"Topic :: Utilities",
3736
]
37+
dynamic = [
38+
"version",
39+
]
3840
dependencies = [
39-
"sphinx==4.5",
41+
"sphinx",
4042
]
4143
[project.urls]
4244
Homepage = "https://github.com/egeakman/python-docs-bootstrapper"
@@ -45,16 +47,16 @@ Releases = "https://github.com/egeakman/python-docs-bootstrapper/releases"
4547
[project.scripts]
4648
bootstrapper = "bootstrapper.bootstrapper:main"
4749

48-
[tool.setuptools]
49-
include-package-data = true
50+
[tool.hatch.build]
51+
packages = ["bootstrapper"]
52+
isolated = true
5053

51-
[tool.setuptools.packages.find]
52-
where = ["."]
53-
namespaces = false
54+
[tool.hatch.build.force-include]
55+
"data" = "python-docs-bootstrapper-data"
5456

55-
[tool.setuptools.package-data]
56-
bootstrapper = [
57-
"data/.gitignore",
58-
"data/Makefile",
59-
"data/README.md",
60-
]
57+
[tool.hatch.version]
58+
path = "bootstrapper/__init__.py"
59+
60+
[tool.isort]
61+
profile = "black"
62+
known_first_party = "bootstrapper"

0 commit comments

Comments
 (0)