Skip to content

Commit 2fe9574

Browse files
committed
FIX(build,site,TC) import sphinx & call (vs build_sphinx); >
- fix(build) add build-backend in pyproject.toml, reported a missing when pip-installing project. - DROP(CI) site step (since it's included by `pytest`). - drop(build) `sphinx[setuptools]` never really worked, and now is missing.
1 parent ca3301d commit 2fe9574

File tree

7 files changed

+43
-17
lines changed

7 files changed

+43
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ jobs:
4949
# fail_ci_if_error: true # optional (default = false)
5050
# verbose: true # optional (default = false)
5151

52-
- name: site
53-
run: |
54-
python setup.py build_sphinx
55-
5652
- name: build
5753
run: |
5854
python -m build

bin/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# clean, or invalid files in packages
44
rm -vrf ./build/* ./dist/* ./*.pyc ./*.tgz ./*.egg-info
5-
python setup.py sdist bdist_wheel
6-
5+
python -m build
6+
sphinx-build -Wj auto -D graphtik_warning_is_error=true docs/source/ docs/build/

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def _make_py_item_url(fn):
9797
return f"../reference.html#{fn_name}"
9898

9999

100+
graphtik_warning_is_error = False
100101
plotter = plot.get_active_plotter()
101102
plot.set_active_plotter(
102103
plotter.with_styles(

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[build-system]
2-
requires = ["setuptools>=30.3.0", "build"]
2+
requires = ["setuptools>=30.3.0"]
3+
build-backend = "setuptools.build_meta"
34

45
[tool.black]
56
## Also `.gitignore` is sourced.

requirements.txt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ bleach==6.0.0
1717
boltons==23.0.0
1818
# via graphtik (setup.py)
1919
build==0.10.0
20-
# via graphtik (setup.py)
20+
# via
21+
# graphtik (setup.py)
22+
# pip-tools
2123
certifi==2022.12.7
2224
# via requests
2325
charset-normalizer==3.1.0
2426
# via requests
2527
click==8.1.3
26-
# via black
28+
# via
29+
# black
30+
# pip-tools
2731
contourpy==1.0.7
2832
# via matplotlib
2933
coverage[toml]==7.2.3
@@ -63,7 +67,9 @@ markupsafe==2.1.2
6367
# graphtik (setup.py)
6468
# jinja2
6569
matplotlib==3.7.1
66-
# via graphtik (setup.py)
70+
# via
71+
# graphtik (setup.py)
72+
# sphinxext-opengraph
6773
mccabe==0.7.0
6874
# via pylint
6975
mypy==1.2.0
@@ -72,7 +78,7 @@ mypy-extensions==1.0.0
7278
# via
7379
# black
7480
# mypy
75-
networkx==3.1 ; python_version >= "3.5"
81+
networkx==3.1
7682
# via graphtik (setup.py)
7783
numpy==1.24.3
7884
# via
@@ -93,6 +99,8 @@ pathspec==0.11.1
9399
# via black
94100
pillow==9.5.0
95101
# via matplotlib
102+
pip-tools==6.13.0
103+
# via graphtik (setup.py)
96104
platformdirs==3.4.0
97105
# via
98106
# black
@@ -144,10 +152,11 @@ six==1.16.0
144152
# python-dateutil
145153
snowballstemmer==2.2.0
146154
# via sphinx
147-
sphinx[setuptools]==6.2.1
155+
sphinx==6.2.1
148156
# via
149157
# graphtik (setup.py)
150158
# sphinxcontrib-spelling
159+
# sphinxext-opengraph
151160
sphinxcontrib-applehelp==1.0.4
152161
# via sphinx
153162
sphinxcontrib-devhelp==1.0.2
@@ -162,6 +171,8 @@ sphinxcontrib-serializinghtml==1.1.5
162171
# via sphinx
163172
sphinxcontrib-spelling==8.0.0
164173
# via graphtik (setup.py)
174+
sphinxext-opengraph==0.8.2
175+
# via graphtik (setup.py)
165176
termcolor==2.3.0
166177
# via pytest-sugar
167178
tomlkit==0.11.7
@@ -176,5 +187,11 @@ webencodings==0.5.1
176187
# via
177188
# bleach
178189
# html5lib
190+
wheel==0.40.0
191+
# via pip-tools
179192
wrapt==1.15.0
180193
# via astroid
194+
195+
# The following packages are considered to be unsafe in a requirements file:
196+
# pip
197+
# setuptools

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _ask_git_version() -> Optional[str]:
5252
"MarkupSafe",
5353
]
5454
matplot_deps = plot_deps + ["matplotlib"]
55-
sphinx_deps = plot_deps + ["sphinx[setuptools] >=2", "sphinxext-opengraph"]
55+
sphinx_deps = plot_deps + ["sphinx >=2", "sphinxext-opengraph"]
5656
test_deps = list(
5757
set(
5858
matplot_deps

test/test_site.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,22 @@ def test_README_as_PyPi_landing_page(monkeypatch):
7070

7171

7272
def test_sphinx_html(monkeypatch):
73+
from sphinx.cmd import build
74+
7375
# Fail on warnings, but don't rebuild all files (no `-a`),
7476
# rm -r ./build/sphinx/ # to fully test site.
75-
site_args = list("setup.py build_sphinx -W".split())
77+
build_options = [
78+
"-W",
79+
# "-E",
80+
"-D",
81+
"graphtik_warning_is_error=true",
82+
"--color",
83+
"-j",
84+
"auto",
85+
]
7686
if logging.getLogger(__name__).isEnabledFor(logging.INFO):
77-
site_args.append("-v")
78-
monkeypatch.setattr(sys, "argv", site_args)
87+
build_options.append("-v")
88+
site_args = [*build_options, "docs/source/", "docs/build"]
7989
monkeypatch.chdir(proj_path)
80-
importlib.import_module("setup")
90+
ret = build.build_main(site_args)
91+
assert not ret

0 commit comments

Comments
 (0)