Skip to content
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

Add a "doc" extra for documentation build dependencies #1872

Merged
merged 3 commits into from
Mar 14, 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: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,5 @@ jobs:

- name: Documentation
run: |
pip install -r doc/requirements.txt
pip install ".[doc]"
make -C doc html
3 changes: 2 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ python:
install:
- method: pip
path: .
- requirements: doc/requirements.txt
extra_requirements:
- doc
30 changes: 17 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
#!/usr/bin/env python

import os
import sys
from pathlib import Path
from typing import Sequence

from setuptools import setup, find_packages
from setuptools.command.build_py import build_py as _build_py
from setuptools.command.sdist import sdist as _sdist
import os
import sys

with open(os.path.join(os.path.dirname(__file__), "VERSION"), encoding="utf-8") as ver_file:
VERSION = ver_file.readline().strip()

with open("requirements.txt", encoding="utf-8") as reqs_file:
requirements = reqs_file.read().splitlines()
def _read_content(path: str) -> str:
return (Path(__file__).parent / path).read_text(encoding="utf-8")

with open("test-requirements.txt", encoding="utf-8") as reqs_file:
test_requirements = reqs_file.read().splitlines()

with open("README.md", encoding="utf-8") as rm_file:
long_description = rm_file.read()
version = _read_content("VERSION").strip()
requirements = _read_content("requirements.txt").splitlines()
test_requirements = _read_content("test-requirements.txt").splitlines()
doc_requirements = _read_content("doc/requirements.txt").splitlines()
long_description = _read_content("README.md")


class build_py(_build_py):
Expand Down Expand Up @@ -48,7 +49,7 @@ def _stamp_version(filename: str) -> None:
with open(filename) as f:
for line in f:
if "__version__ =" in line:
line = line.replace('"git"', "'%s'" % VERSION)
line = line.replace('"git"', "'%s'" % version)
found = True
out.append(line)
except OSError:
Expand All @@ -64,7 +65,7 @@ def _stamp_version(filename: str) -> None:
setup(
name="GitPython",
cmdclass={"build_py": build_py, "sdist": sdist},
version=VERSION,
version=version,
description="GitPython is a Python library used to interact with Git repositories",
author="Sebastian Thiel, Michael Trier",
author_email="byronimo@gmail.com, mtrier@gmail.com",
Expand All @@ -75,7 +76,10 @@ def _stamp_version(filename: str) -> None:
package_dir={"git": "git"},
python_requires=">=3.7",
install_requires=requirements,
extras_require={"test": test_requirements},
extras_require={
"test": test_requirements,
"doc": doc_requirements,
},
zip_safe=False,
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ignore_outcome = true
[testenv:html]
description = Build HTML documentation
base_python = py{39,310,311,312,38,37}
deps = -r doc/requirements.txt
extras = doc
allowlist_externals = make
commands =
make BUILDDIR={env_tmp_dir}/doc/build -C doc clean
Expand Down
Loading