@@ -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)
@@ -36,6 +38,10 @@ test: ## run test suite
36
38
# RELEASE
37
39
# ###############################################################################
38
40
41
+ .PHONY : bump-version
42
+ bump-version : # # bump the package version (uses VERSION)
43
+ sed -i ' ' " s/__version__ = \" .*\" /__version__ = \" $( VERSION) \" /" $(SRC ) /dependency_injection/_version.py
44
+
39
45
.PHONY : build
40
46
build : # # build the python package
41
47
pipenv run python setup.py sdist bdist_wheel
@@ -48,10 +54,6 @@ clean: ## clean the build
48
54
find . -type d -name __pycache__ -exec rm -rf {} +
49
55
find . -type d -name ' *.egg-info' -exec rm -rf {} +
50
56
51
- .PHONY : bump_version
52
- bump_version : # # Bump the version
53
- pipenv run bump2version --dry-run release --allow-dirty --verbose
54
-
55
57
.PHONY : upload-test
56
58
upload-test : # # upload package to testpypi repository
57
59
TWINE_USERNAME=$(PYPI_USERNAME_TEST ) TWINE_PASSWORD=$(PYPI_PASSWORD_TEST ) pipenv run twine upload --repository testpypi --skip-existing --repository-url https://test.pypi.org/legacy/ dist/*
@@ -60,23 +62,45 @@ 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-quickstart
64
- sphinx-quickstart : # # run the sphinx quickstart
65
- pipenv run docker run -it --rm -v $(PWD ) /docs:/docs sphinxdoc/sphinx sphinx-quickstart
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
66
88
67
89
.PHONY : sphinx-html
68
90
sphinx-html : # # build the sphinx html
69
- pipenv run make -C docs html
91
+ cd $( DOCS ) && .venv/bin/sphinx-build -M html . _build
70
92
71
93
.PHONY : sphinx-rebuild
72
94
sphinx-rebuild : # # re-build the sphinx docs
73
95
cd $(DOCS ) && \
74
- pipenv run make clean && pipenv run make html
96
+ rm -rf _build/.doctrees && \
97
+ .venv/bin/sphinx-build -M clean . _build && \
98
+ .venv/bin/sphinx-build -M html . _build
75
99
76
100
.PHONY : sphinx-autobuild
77
101
sphinx-autobuild : # # activate autobuild of docs
78
102
cd $(DOCS ) && \
79
- pipenv run sphinx-autobuild . _build/html --watch $(SRC )
103
+ .venv/bin/ sphinx-autobuild . _build/html --watch $(SRC )
80
104
81
105
# ###############################################################################
82
106
# PRE-COMMIT HOOKS
@@ -110,24 +134,24 @@ pre-commit-run: ## run the pre-commit hooks
110
134
pipenv-rm : # # remove the virtual environment
111
135
pipenv --rm
112
136
113
- .PHONY : pipenv-install
114
- pipenv-install : # # setup the virtual environment
137
+ .PHONY : pipenv-install-dev
138
+ pipenv-install-dev : # # setup the virtual environment, with dev packages
115
139
pipenv install --dev
116
140
117
141
.PHONY : pipenv-install-package
118
142
pipenv-install-package : # # install a package (uses PACKAGE)
119
143
pipenv install $(PACKAGE )
120
144
121
- .PHONY : pipenv-install-package- dev
122
- pipenv-install-package- dev : # # install a dev package (uses PACKAGE)
145
+ .PHONY : pipenv-install-dev-package
146
+ pipenv-install-dev-package : # # install a dev package (uses PACKAGE)
123
147
pipenv install --dev $(PACKAGE )
124
148
125
- .PHONY : pipenv-packages- graph
126
- pipenv-packages- graph : # # Check installed packages
149
+ .PHONY : pipenv-graph
150
+ pipenv-graph : # # Check installed packages
127
151
pipenv graph
128
152
129
- .PHONY : pipenv-requirements- generate
130
- pipenv-requirements- generate : # # Check a requirements.txt
153
+ .PHONY : pipenv-generate-requirements
154
+ pipenv-generate-requirements : # # Check a requirements.txt
131
155
pipenv lock -r > requirements.txt
132
156
133
157
.PHONY : pipenv-shell
@@ -146,7 +170,3 @@ pipenv-lock-and-install: ## Lock the pipfile and install (after updating Pipfile
146
170
.PHONY : pipenv-pip-freeze
147
171
pipenv-pip-freeze : # # Run pip freeze in the virtual environment
148
172
pipenv run pip freeze
149
-
150
- .PHONY : pipenv-setup-sync
151
- pipenv-setup-sync : # # Sync dependencies between Pipfile and setup.py
152
- pipenv run pipenv-setup sync
0 commit comments