@@ -12,6 +12,8 @@ SRC := $(PWD)/src
12
12
TESTS := $(PWD ) /tests
13
13
DOCS := $(PWD ) /docs
14
14
15
+ DOCS_PYTHON_VERSION := 3.12.11
16
+
15
17
# Load env file
16
18
include env.make
17
19
export $(shell sed 's/=.*//' env.make)
@@ -60,28 +62,44 @@ upload-test: ## upload package to testpypi repository
60
62
upload : # # upload package to pypi repository
61
63
TWINE_USERNAME=$(PYPI_USERNAME ) TWINE_PASSWORD=$(PYPI_PASSWORD ) pipenv run twine upload --skip-existing dist/*
62
64
63
- .PHONY : sphinx-generate-requirements
64
- sphinx-generate-requirements : # # Export sphinx-related deps from Pipfile to docs/requirements.txt for Read the Docs
65
- @echo " # Auto-generated for Read the Docs. Do not edit manually." > docs/requirements.txt
66
- @grep -A 1000 ' ^\[dev-packages\]' Pipfile \
67
- | grep ' ^sphinx' \
68
- | sed ' s/ *= */==/' \
69
- | tr -d ' "' \
70
- >> docs/requirements.txt
65
+ # ###############################################################################
66
+ # DOCS
67
+ # ###############################################################################
68
+
69
+ .PHONY : sphinx-venv-init
70
+ sphinx-venv-init : # # Init venv for docs (requires pyenv $(DOCS_PYTHON_VERSION))
71
+ cd $(DOCS ) && \
72
+ command -v pyenv > /dev/null || { echo " pyenv not found" ; exit 1; } && \
73
+ pyenv versions --bare | grep -q " ^$( DOCS_PYTHON_VERSION) $$ " || { echo " pyenv $( DOCS_PYTHON_VERSION) not installed" ; exit 1; } && \
74
+ PYENV_PYTHON=$$(pyenv root ) /versions/$(DOCS_PYTHON_VERSION ) /bin/python && \
75
+ $$ PYENV_PYTHON -m venv .venv && \
76
+ .venv/bin/pip install --upgrade pip && \
77
+ .venv/bin/pip install -r requirements.txt
78
+
79
+ .PHONY : sphinx-venv-install
80
+ sphinx-venv-install : # # Install or update docs venv from requirements.txt
81
+ cd $(DOCS ) && \
82
+ [ -d .venv ] || { echo " Missing .venv — run sphinx-venv-init first." ; exit 1; } && \
83
+ .venv/bin/pip install -r requirements.txt
84
+
85
+ .PHONY : sphinx-venv-rm
86
+ sphinx-venv-rm : # # Remove docs venv
87
+ rm -rf $(DOCS ) /.venv
71
88
72
89
.PHONY : sphinx-html
73
90
sphinx-html : # # build the sphinx html
74
- pipenv run make -C docs html
91
+ cd $( DOCS ) && .venv/bin/sphinx-build -M html . _build
75
92
76
93
.PHONY : sphinx-rebuild
77
94
sphinx-rebuild : # # re-build the sphinx docs
78
95
cd $(DOCS ) && \
79
- pipenv run make clean && pipenv run make html
96
+ .venv/bin/sphinx-build -M clean . _build && \
97
+ .venv/bin/sphinx-build -M html . _build
80
98
81
99
.PHONY : sphinx-autobuild
82
100
sphinx-autobuild : # # activate autobuild of docs
83
101
cd $(DOCS ) && \
84
- pipenv run sphinx-autobuild . _build/html --watch $(SRC )
102
+ .venv/bin/ sphinx-autobuild . _build/html --watch $(SRC )
85
103
86
104
# ###############################################################################
87
105
# PRE-COMMIT HOOKS
@@ -115,16 +133,16 @@ pre-commit-run: ## run the pre-commit hooks
115
133
pipenv-rm : # # remove the virtual environment
116
134
pipenv --rm
117
135
118
- .PHONY : pipenv-install
119
- pipenv-install : # # setup the virtual environment
136
+ .PHONY : pipenv-install-dev
137
+ pipenv-install-dev : # # setup the virtual environment, with dev packages
120
138
pipenv install --dev
121
139
122
140
.PHONY : pipenv-install-package
123
141
pipenv-install-package : # # install a package (uses PACKAGE)
124
142
pipenv install $(PACKAGE )
125
143
126
- .PHONY : pipenv-install-package- dev
127
- pipenv-install-package- dev : # # install a dev package (uses PACKAGE)
144
+ .PHONY : pipenv-install-dev-package
145
+ pipenv-install-dev-package : # # install a dev package (uses PACKAGE)
128
146
pipenv install --dev $(PACKAGE )
129
147
130
148
.PHONY : pipenv-graph
0 commit comments