Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 883b03a

Browse filesBrowse files
authored
Merge pull request #1872 from EliahKagan/doc-extra
Add a "doc" extra for documentation build dependencies
2 parents fc669cc + 74df5a8 commit 883b03a
Copy full SHA for 883b03a

File tree

4 files changed

+21
-16
lines changed
Filter options

4 files changed

+21
-16
lines changed

‎.github/workflows/pythonpackage.yml

Copy file name to clipboardExpand all lines: .github/workflows/pythonpackage.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ jobs:
100100

101101
- name: Documentation
102102
run: |
103-
pip install -r doc/requirements.txt
103+
pip install ".[doc]"
104104
make -C doc html

‎.readthedocs.yaml

Copy file name to clipboardExpand all lines: .readthedocs.yaml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ python:
3232
install:
3333
- method: pip
3434
path: .
35-
- requirements: doc/requirements.txt
35+
extra_requirements:
36+
- doc

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+17-13Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
#!/usr/bin/env python
22

3+
import os
4+
import sys
5+
from pathlib import Path
36
from typing import Sequence
7+
48
from setuptools import setup, find_packages
59
from setuptools.command.build_py import build_py as _build_py
610
from setuptools.command.sdist import sdist as _sdist
7-
import os
8-
import sys
911

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

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

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

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

2223

2324
class build_py(_build_py):
@@ -48,7 +49,7 @@ def _stamp_version(filename: str) -> None:
4849
with open(filename) as f:
4950
for line in f:
5051
if "__version__ =" in line:
51-
line = line.replace('"git"', "'%s'" % VERSION)
52+
line = line.replace('"git"', "'%s'" % version)
5253
found = True
5354
out.append(line)
5455
except OSError:
@@ -64,7 +65,7 @@ def _stamp_version(filename: str) -> None:
6465
setup(
6566
name="GitPython",
6667
cmdclass={"build_py": build_py, "sdist": sdist},
67-
version=VERSION,
68+
version=version,
6869
description="GitPython is a Python library used to interact with Git repositories",
6970
author="Sebastian Thiel, Michael Trier",
7071
author_email="byronimo@gmail.com, mtrier@gmail.com",
@@ -75,7 +76,10 @@ def _stamp_version(filename: str) -> None:
7576
package_dir={"git": "git"},
7677
python_requires=">=3.7",
7778
install_requires=requirements,
78-
extras_require={"test": test_requirements},
79+
extras_require={
80+
"test": test_requirements,
81+
"doc": doc_requirements,
82+
},
7983
zip_safe=False,
8084
long_description=long_description,
8185
long_description_content_type="text/markdown",

‎tox.ini

Copy file name to clipboardExpand all lines: tox.ini
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ignore_outcome = true
3636
[testenv:html]
3737
description = Build HTML documentation
3838
base_python = py{39,310,311,312,38,37}
39-
deps = -r doc/requirements.txt
39+
extras = doc
4040
allowlist_externals = make
4141
commands =
4242
make BUILDDIR={env_tmp_dir}/doc/build -C doc clean

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.