Skip to content

Remove sphinx's version pin + migrate to hatchling #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ repos:
rev: 5.13.2
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.0
Expand All @@ -24,7 +23,6 @@ repos:
rev: 1.5.3
hooks:
- id: pyproject-fmt
additional_dependencies: [tox]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
Expand Down
3 changes: 3 additions & 0 deletions bootstrapper/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from .bootstrapper import Bootstrapper

__all__ = ["Bootstrapper"]
__version__ = "0.1.2"
13 changes: 4 additions & 9 deletions bootstrapper/bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(
self.readme_url = "https://raw.githubusercontent.com/egeakman/python-docs-bootstrapper/master/bootstrapper/data/README.md"
self.gitignore_url = "https://raw.githubusercontent.com/egeakman/python-docs-bootstrapper/master/bootstrapper/data/.gitignore"
self.makefile_url = "https://raw.githubusercontent.com/egeakman/python-docs-bootstrapper/master/bootstrapper/data/Makefile"
self.data_dir = f"{os.path.dirname(__file__)}/../python-docs-bootstrapper-data"

def _request(self, url: str) -> str:
with urllib.request.urlopen(url) as response:
Expand Down Expand Up @@ -126,9 +127,7 @@ def create_readme(self) -> None:
self.logger.warning(
"\n ⚠️ Failed to fetch README.md from GitHub, using local copy..."
)
readme = Path(f"{os.path.dirname(__file__)}/data/README.md").read_text(
encoding="utf-8"
)
readme = Path(f"{self.data_dir}/README.md").read_text(encoding="utf-8")
readme = readme.replace("{{translation.language}}", self.language)
with open(f"{self.translation_repo}/README.md", "w", encoding="utf-8") as f:
f.write(readme)
Expand All @@ -142,9 +141,7 @@ def create_gitignore(self) -> None:
self.logger.warning(
"\n ⚠️ Failed to fetch .gitignore from GitHub, using local copy..."
)
gitignore = Path(f"{os.path.dirname(__file__)}/data/.gitignore").read_text(
encoding="utf-8"
)
gitignore = Path(f"{self.data_dir}/.gitignore").read_text(encoding="utf-8")
with open(f"{self.translation_repo}/.gitignore", "w", encoding="utf-8") as f:
f.write(gitignore)
self.logger.info("✅\n")
Expand All @@ -157,9 +154,7 @@ def create_makefile(self) -> None:
self.logger.warning(
"\n ⚠️ Failed to fetch Makefile from GitHub, using local copy..."
)
makefile = Path(f"{os.path.dirname(__file__)}/data/Makefile").read_text(
encoding="utf-8"
)
makefile = Path(f"{self.data_dir}/Makefile").read_text(encoding="utf-8")
head = (
subprocess.run(
["git", "-C", self.cpython_repo, "rev-parse", "HEAD"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 17 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[build-system]
build-backend = "setuptools.build_meta"
build-backend = "hatchling.build"
requires = [
"setuptools>=61.2",
"hatchling",
]

[project]
name = "python-docs-bootstrapper"
version = "0.1.2"
description = "Bootstrapper for Python documentation translations"
readme = "README.md"
keywords = [
Expand Down Expand Up @@ -35,8 +34,11 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Topic :: Utilities",
]
dynamic = [
"version",
]
dependencies = [
"sphinx==4.5",
"sphinx",
]
[project.urls]
Homepage = "https://github.com/egeakman/python-docs-bootstrapper"
Expand All @@ -45,16 +47,16 @@ Releases = "https://github.com/egeakman/python-docs-bootstrapper/releases"
[project.scripts]
bootstrapper = "bootstrapper.bootstrapper:main"

[tool.setuptools]
include-package-data = true
[tool.hatch.build]
packages = ["bootstrapper"]
isolated = true

[tool.setuptools.packages.find]
where = ["."]
namespaces = false
[tool.hatch.build.force-include]
"data" = "python-docs-bootstrapper-data"

[tool.setuptools.package-data]
bootstrapper = [
"data/.gitignore",
"data/Makefile",
"data/README.md",
]
[tool.hatch.version]
path = "bootstrapper/__init__.py"

[tool.isort]
profile = "black"
known_first_party = "bootstrapper"