1
+ POETRY_HOME := $(HOME ) /.poetry
2
+ POETRY := $(POETRY_HOME ) /bin/poetry
3
+
1
4
.PHONY : pre-install
2
5
pre-install :
3
6
@echo " 🐍 Checking if Python is installed"
4
7
@command -v python3 > /dev/null 2>&1 || { echo >&2 " Python is not installed. Aborting." ; exit 1; }
5
- @echo " 📦 Checking if pip is installed"
6
- @command -v pip3 > /dev/null 2>&1 || { echo >&2 " pip is not installed. Installing pip." ; python3 -m ensurepip; }
7
- @echo " 📦 Checking if Poetry is installed"
8
- @command -v poetry > /dev/null 2>&1 || { echo >&2 " Poetry is not installed. Installing Poetry." ; pip3 install poetry; }
9
8
@echo " 🐍 Checking Python version"
10
9
@python3 --version | grep -E " Python 3\.(10|[1-9][1-9])" > /dev/null 2>&1 || { echo >&2 " Python version 3.10 or higher is required. Aborting." ; exit 1; }
11
- @echo " 📦 Checking Poetry version "
12
- @poetry --version | grep -E " Poetry (1\.[8-9]\.[5-9]|[2-9]\.[0-9]) " > /dev/null 2>&1 || { echo >&2 " Poetry version > 1.8.4 is required. Aborting. " ; exit 1 ; }
10
+ @echo " 📦 Checking if Poetry is installed "
11
+ @command -v poetry > /dev/null 2>&1 || { echo >&2 " Poetry is not installed. Installing Poetry. " ; curl -sSL https://install.python-poetry.org | POETRY_HOME= $( POETRY_HOME ) python3 - ; }
13
12
14
13
.PHONY : install
15
- install : # # Install the poetry environment and install the pre-commit hooks
16
- pre-install
14
+ install : pre-install # # Install the poetry environment and install the pre-commit hooks
15
+ @echo " 📦 Installing dependencies with Poetry"
16
+ @$(POETRY ) install --with core
17
+ @echo " 🔧 Installing pre-commit hooks"
18
+ @$(POETRY ) run pre-commit install
19
+ @echo " 🐚 Activating virtual environment"
20
+ @$(POETRY ) shell
21
+
22
+ .PHONY : full-install
23
+ full-install : pre-install # # Install the poetry environment and install the pre-commit hooks
17
24
@echo " 📦 Installing dependencies with Poetry"
18
- @poetry install
25
+ @$( POETRY ) install --with core,docs,dev
19
26
@echo " 🔧 Installing pre-commit hooks"
20
- @poetry run pre-commit install
27
+ @$( POETRY ) run pre-commit install
21
28
@echo " 🐚 Activating virtual environment"
22
- @poetry shell
29
+ @$( POETRY ) shell
23
30
24
31
.PHONY : check
25
32
check : # # Run code quality tools.
26
33
@echo " 🛠️ Running code quality checks"
27
34
@echo " 🔍 Checking Poetry lock file consistency"
28
- @poetry check --lock
35
+ @$( POETRY ) check --lock
29
36
@echo " 🚨 Linting code with pre-commit"
30
- @poetry run pre-commit run -a
37
+ @$( POETRY ) run pre-commit run -a
31
38
32
39
.PHONY : check-plus
33
40
check-plus : check # # Run additional code quality tools.
34
41
@echo " 🔍 Checking code formatting with black
35
- @poetry run black --check ."
42
+ @$( POETRY ) run black --check ."
36
43
@echo " ⚙️ Static type checking with mypy"
37
- @poetry run mypy
44
+ @$( POETRY ) run mypy
38
45
@echo " 🔎 Checking for obsolete dependencies"
39
- @poetry run deptry .
46
+ @$( POETRY ) run deptry .
40
47
41
48
.PHONY : build
42
49
build : clean-build # # Build wheel file using poetry
43
50
@echo " 🚀 Creating wheel file"
44
- @poetry build
51
+ @$( POETRY ) build
45
52
46
53
.PHONY : clean-build
47
54
clean-build : # # clean build artifacts
@@ -50,31 +57,31 @@ clean-build: ## clean build artifacts
50
57
.PHONY : publish
51
58
publish : # # publish a release to pypi.
52
59
@echo " 🚀 Publishing: Dry run."
53
- @poetry config pypi-token.pypi $(PYPI_TOKEN )
54
- @poetry publish --dry-run
60
+ @$( POETRY ) config pypi-token.pypi $(PYPI_TOKEN )
61
+ @$( POETRY ) publish --dry-run
55
62
@echo " 🚀 Publishing."
56
- @poetry publish
63
+ @$( POETRY ) publish
57
64
58
65
.PHONY : build-and-publish
59
66
build-and-publish : build publish # # Build and publish.
60
67
61
68
.PHONY : doc-test
62
69
doc-test : # # Test if documentation can be built without warnings or errors
63
- @poetry run mkdocs build -f docs/mkdocs.yml -d _build -s
70
+ @$( POETRY ) run mkdocs build -f docs/mkdocs.yml -d _build -s
64
71
65
72
.PHONY : doc-build
66
73
doc-build : # # Build the documentation
67
- @poetry run mkdocs build -f docs/mkdocs.yml -d _build
74
+ @$( POETRY ) run mkdocs build -f docs/mkdocs.yml -d _build
68
75
69
76
.PHONY : doc-serve
70
77
doc-serve : # # Build and serve the documentation
71
- @poetry run mkdocs serve -f docs/mkdocs.yml
78
+ @$( POETRY ) run mkdocs serve -f docs/mkdocs.yml
72
79
73
80
.PHONY : format
74
81
format : # # Format code with black and isort
75
82
@echo " 🎨 Formatting code"
76
- @poetry run black .
77
- @poetry run isort .
83
+ @$( POETRY ) run black .
84
+ @$( POETRY ) run isort .
78
85
79
86
.PHONY : clean
80
87
clean : clean-build # # Clean up build artifacts and cache files
0 commit comments