@@ -12,6 +12,8 @@ SRC := $(PWD)/src
1212TESTS := $(PWD ) /tests
1313DOCS := $(PWD ) /docs
1414
15+ DOCS_PYTHON_VERSION := 3.12.11
16+
1517# Load env file
1618include env.make
1719export $(shell sed 's/=.*//' env.make)
@@ -36,6 +38,10 @@ test: ## run test suite
3638# RELEASE
3739# ###############################################################################
3840
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+
3945.PHONY : build
4046build : # # build the python package
4147 pipenv run python setup.py sdist bdist_wheel
@@ -48,10 +54,6 @@ clean: ## clean the build
4854 find . -type d -name __pycache__ -exec rm -rf {} +
4955 find . -type d -name ' *.egg-info' -exec rm -rf {} +
5056
51- .PHONY : bump_version
52- bump_version : # # Bump the version
53- pipenv run bump2version --dry-run release --allow-dirty --verbose
54-
5557.PHONY : upload-test
5658upload-test : # # upload package to testpypi repository
5759 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
6062upload : # # upload package to pypi repository
6163 TWINE_USERNAME=$(PYPI_USERNAME ) TWINE_PASSWORD=$(PYPI_PASSWORD ) pipenv run twine upload --skip-existing dist/*
6264
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
6688
6789.PHONY : sphinx-html
6890sphinx-html : # # build the sphinx html
69- pipenv run make -C docs html
91+ cd $( DOCS ) && .venv/bin/sphinx-build -M html . _build
7092
7193.PHONY : sphinx-rebuild
7294sphinx-rebuild : # # re-build the sphinx docs
7395 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
7599
76100.PHONY : sphinx-autobuild
77101sphinx-autobuild : # # activate autobuild of docs
78102 cd $(DOCS ) && \
79- pipenv run sphinx-autobuild . _build/html --watch $(SRC )
103+ .venv/bin/ sphinx-autobuild . _build/html --watch $(SRC )
80104
81105# ###############################################################################
82106# PRE-COMMIT HOOKS
@@ -110,24 +134,24 @@ pre-commit-run: ## run the pre-commit hooks
110134pipenv-rm : # # remove the virtual environment
111135 pipenv --rm
112136
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
115139 pipenv install --dev
116140
117141.PHONY : pipenv-install-package
118142pipenv-install-package : # # install a package (uses PACKAGE)
119143 pipenv install $(PACKAGE )
120144
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)
123147 pipenv install --dev $(PACKAGE )
124148
125- .PHONY : pipenv-packages- graph
126- pipenv-packages- graph : # # Check installed packages
149+ .PHONY : pipenv-graph
150+ pipenv-graph : # # Check installed packages
127151 pipenv graph
128152
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
131155 pipenv lock -r > requirements.txt
132156
133157.PHONY : pipenv-shell
@@ -146,7 +170,3 @@ pipenv-lock-and-install: ## Lock the pipfile and install (after updating Pipfile
146170.PHONY : pipenv-pip-freeze
147171pipenv-pip-freeze : # # Run pip freeze in the virtual environment
148172 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