@@ -30,83 +30,60 @@ help:
3030
3131.PHONY : test
3232test : # # run test suite
33- PYTHONPATH=$(SRC ) :$(TESTS ) pipenv run pytest $(TESTS )
33+ PYTHONPATH=$(SRC ) :$(TESTS ) poetry run pytest $(TESTS )
3434
3535.PHONY : test-all-versions
36- test-all-versions : # # Run tests across all supported Python versions with pyenv + pipenv
36+ test-all-versions : # # Run tests across all supported Python versions with pyenv + poetry
3737 @for PY in 3.9 3.10 3.11 3.12; do \
3838 echo " \n>>> Running tests with Python $$ PY" ; \
3939 PYTHON_BIN=$$(pyenv prefix $$PY ) /bin/python; \
4040 VENV_DIR=.venv-$$ PY; \
4141 $$ PYTHON_BIN -m venv $$ VENV_DIR && \
42- $$ VENV_DIR/bin/pip install --upgrade pip && \
43- $$ VENV_DIR/bin/ pip install pipenv && \
44- cd $( PWD ) && \
45- $$ VENV_DIR/bin/pipenv install --dev --deploy && \
46- PYTHONPATH=./src:./tests $$ VENV_DIR/bin/pipenv run pytest ./tests/unit || exit 1; \
47- rm -rf $$ VENV_DIR; \
42+ . $$ VENV_DIR/bin/activate && \
43+ pip install --upgrade pip && \
44+ pip install poetry && \
45+ poetry install --with dev && \
46+ PYTHONPATH=./src:./tests poetry run pytest ./tests || exit 1; \
47+ deactivate && rm -rf $$ VENV_DIR; \
4848 done
4949
5050.PHONY : test-version
51- test-version : # # Run tests with a specific Python version via pyenv + pipenv . Usage: make test-version PY=3.10
51+ test-version : # # Run tests with a specific Python version via pyenv + poetry . Usage: make test-version PY=3.10
5252 @if [ -z " $( PY) " ]; then \
5353 echo " ❌ PY is required. Usage: make test-version PY=3.10" ; exit 1; \
5454 fi
5555 PYTHON_BIN=$$(pyenv prefix $(PY ) ) /bin/python; \
5656 VENV_DIR=.venv-$(PY ) ; \
5757 $$ PYTHON_BIN -m venv $$ VENV_DIR && \
58- $$ VENV_DIR/bin/pip install --upgrade pip && \
59- $$ VENV_DIR/bin/pip install pipenv && \
60- cd $(PWD ) && \
61- $$ VENV_DIR/bin/pipenv install --dev --deploy && \
62- PYTHONPATH=./src:./tests $$ VENV_DIR/bin/pipenv run pytest ./tests/unit || exit 1; \
63- rm -rf $$ VENV_DIR
64-
65- # #########################################################################
66- # DOCS
67- # #########################################################################
68-
69- .PHONY : sphinx-quickstart
70- sphinx-quickstart : # # run the sphinx quickstart
71- pipenv run docker run -it --rm -v $(PWD ) /docs:/docs sphinxdoc/sphinx sphinx-quickstart
72-
73- .PHONY : sphinx-html
74- sphinx-html : # # build the sphinx html
75- pipenv run make -C docs html
76-
77- .PHONY : sphinx-rebuild
78- sphinx-rebuild : # # re-build the sphinx docs
79- cd $(DOCS ) && \
80- pipenv run make clean && pipenv run make html
81-
82- .PHONY : sphinx-autobuild
83- sphinx-autobuild : # # activate autobuild of docs
84- cd $(DOCS ) && \
85- pipenv run sphinx-autobuild . _build/html --watch $(SRC )
58+ . $$ VENV_DIR/bin/activate && \
59+ pip install --upgrade pip && \
60+ pip install poetry && \
61+ poetry install --with dev && \
62+ PYTHONPATH=./src:./tests poetry run pytest ./tests || exit 1; \
63+ deactivate && rm -rf $$ VENV_DIR
8664
8765# ###############################################################################
88- # RELEASE (LOCALLY)
66+ # RELEASE
8967# ###############################################################################
9068
9169.PHONY : build
9270build : # # build the python package
93- pipenv run python setup.py sdist bdist_wheel
71+ poetry build
9472
9573.PHONY : clean
9674clean : # # clean the build
97- python setup.py clean
9875 rm -rf build dist
9976 find . -type f -name ' *.py[co]' -delete
10077 find . -type d -name __pycache__ -exec rm -rf {} +
10178 find . -type d -name ' *.egg-info' -exec rm -rf {} +
10279
10380.PHONY : upload-test
104- upload-test : # # upload package to testpypi repository
105- 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/ *
81+ upload-test : # # upload package to test.pypi.org
82+ poetry publish --repository testpypi
10683
10784.PHONY : upload
108- upload : # # upload package to pypi repository
109- TWINE_USERNAME= $( PYPI_USERNAME ) TWINE_PASSWORD= $( PYPI_PASSWORD ) pipenv run twine upload --skip-existing dist/ *
85+ upload : # # upload package to PyPI
86+ poetry publish
11087
11188.PHONY : act-release
11289act-release : # # Run release workflow locally with act
@@ -115,17 +92,21 @@ act-release: ## Run release workflow locally with act
11592.PHONY : test-install-all-py
11693test-install-all-py :
11794 @for PY in 3.9 3.10 3.11 3.12; do \
118- echo " \n>>> Testing with Python $$ PY" ; \
119- PYTHON_BIN=$$(pyenv prefix $$PY ) /bin/python; \
120- VENV_DIR=.venv-$$ PY; \
121- $$ PYTHON_BIN -m venv $$ VENV_DIR && \
122- $$ VENV_DIR/bin/pip install --upgrade pip && \
123- $$ VENV_DIR/bin/pip install --index-url https://test.pypi.org/simple/ \
124- --extra-index-url https://pypi.org/simple \
125- codius && \
126- mkdir -p /tmp/test-codius && \
127- $$ VENV_DIR/bin/codius /tmp/test-codius --version || echo " ❌ Failed to run codius with Python $$ PY" ; \
128- rm -rf $$ VENV_DIR /tmp/test-codius; \
95+ ( \
96+ set -e; \
97+ echo " \n>>> Testing with Python $$ PY" ; \
98+ PYTHON_BIN=$$(pyenv prefix $$PY ) /bin/python; \
99+ VENV_DIR=.venv-$$ PY; \
100+ TRAP_CMD=" rm -rf $$ VENV_DIR /tmp/test-codius" ; \
101+ trap " $$ TRAP_CMD" EXIT; \
102+ $$ PYTHON_BIN -m venv $$ VENV_DIR; \
103+ $$ VENV_DIR/bin/pip install --upgrade pip; \
104+ $$ VENV_DIR/bin/pip install --index-url https://test.pypi.org/simple/ \
105+ --extra-index-url https://pypi.org/simple \
106+ codius; \
107+ mkdir -p /tmp/test-codius; \
108+ $$ VENV_DIR/bin/codius /tmp/test-codius --version; \
109+ ) || exit 1; \
129110 done
130111
131112.PHONY : test-install-version
@@ -150,78 +131,66 @@ test-install-version: ## Test installing package from TestPyPI with a specific P
150131
151132.PHONY : black
152133black : # # format code using black
153- pipenv run black --line-length 88 $(SRC )
134+ poetry run black --line-length 88 $(SRC )
154135
155136.PHONY : black-check
156137black-check : # # check code don't violate black formatting rules
157- pipenv run black --check --line-length 88 $(SRC )
138+ poetry run black --check --line-length 88 $(SRC )
158139
159140.PHONY : flake
160141flake : # # lint code with flake
161- pipenv run flake8 --max-line-length=200 $(SRC )
142+ poetry run flake8 --max-line-length=200 $(SRC )
162143
163144.PHONY : pre-commit-install
164145pre-commit-install : # # install the pre-commit git hook
165- pipenv run pre-commit install
146+ poetry run pre-commit install
166147
167148.PHONY : pre-commit-run
168149pre-commit-run : # # run the pre-commit hooks
169- pipenv run pre-commit run --all-files
150+ poetry run pre-commit run --all-files
170151
171152# ###############################################################################
172- # PIPENV
153+ # POETRY
173154# ###############################################################################
174155
175- .PHONY : pipenv-rm
176- pipenv-rm : # # remove the virtual environment
177- pipenv --rm
178-
179- .PHONY : pipenv-install
180- pipenv-install : # # setup the virtual environment
181- pipenv install --dev
182-
183- .PHONY : pipenv-install-package
184- pipenv-install-package : # # install a package (uses PACKAGE)
185- pipenv install $(PACKAGE )
186-
187- .PHONY : pipenv-install-package-dev
188- pipenv-install-package-dev : # # install a dev package (uses PACKAGE)
189- pipenv install --dev $(PACKAGE )
156+ .PHONY : poetry-install-with-dev
157+ poetry-install-with-dev : # # Install all dependencies including dev group
158+ poetry install --with dev
190159
191- .PHONY : pipenv-graph
192- pipenv-graph : # # Check installed packages
193- pipenv graph
160+ .PHONY : poetry-env-remove
161+ poetry-env-remove : # # Remove the Poetry virtual environment
162+ poetry env info --path > /dev/null 2>&1 && poetry env remove python || echo " No Poetry environment found. "
194163
195- .PHONY : pipenv-generate-requirements
196- pipenv-generate-requirements : # # Check a requirements.txt
197- pipenv lock -r > requirements.txt
164+ .PHONY : poetry-shell
165+ poetry-shell : # # Activate the Poetry virtual environment
166+ poetry shell
198167
199- .PHONY : pipenv-shell
200- pipenv-shell : # # Activate the virtual environment
201- pipenv shell
168+ .PHONY : poetry-env-info-path
169+ poetry-env-info-path : # # Show the path to the Poetry virtual environment
170+ poetry env info --path
202171
203- .PHONY : pipenv-venv
204- pipenv-venv : # # Show the path to the venv
205- pipenv --venv
206-
207- .PHONY : pipenv-lock-and-install
208- pipenv-lock-and-install : # # Lock the pipfile and install (after updating Pipfile)
209- pipenv lock && \
210- pipenv install --dev
211-
212- .PHONY : pipenv-pip-freeze
213- pipenv-pip-freeze : # # Run pip freeze in the virtual environment
214- pipenv run pip freeze
172+ .PHONY : poetry-add
173+ poetry-add : # # Install a runtime package (uses PACKAGE)
174+ @if [ -z " $( PACKAGE) " ]; then \
175+ echo " ❌ PACKAGE is required. Usage: make poetry-add PACKAGE=your-package" ; exit 1; \
176+ fi
177+ poetry add $(PACKAGE )
215178
216- .PHONY : pipenv-sync-setup
217- pipenv-sync-setup : # # Update install_requires in setup.py from Pipfile
218- pipenv run python scripts/sync_setup.py --sync Pipfile setup.py
179+ .PHONY : poetry-add-dev
180+ poetry-add-dev : # # Install a dev package (uses PACKAGE)
181+ @if [ -z " $( PACKAGE) " ]; then \
182+ echo " ❌ PACKAGE is required. Usage: make poetry-add-dev PACKAGE=your-package" ; exit 1; \
183+ fi
184+ poetry add --group dev $(PACKAGE )
219185
220- .PHONY : pipenv-sync-setup-dry-run
221- pipenv-sync-setup-dry-run : # # Dry run: preview install_requires from Pipfile
222- pipenv run python scripts/sync_setup.py --dry-run Pipfile setup.py
186+ .PHONY : poetry-show-tree
187+ poetry-show-tree : # # Show dependency tree
188+ poetry show --tree
223189
224- .PHONY : pipenv-install-cli-editable
225- pipenv-install-cli-editable : # # Install the package in editable mode (for CLI use )
226- pipenv run pip install -e .
190+ .PHONY : poetry-export-requirements-txt
191+ poetry-export-requirements-txt : # # Export requirements.txt (for Docker or CI )
192+ poetry export --without-hashes --format=requirements.txt > requirements.txt
227193
194+ .PHONY : poetry-show-codius
195+ poetry-show-codius : # # Show installed details for the codius package
196+ poetry run pip show -f codius || echo " ❌ codius is not installed yet. Run 'make poetry-install'"
0 commit comments