1
+ .PHONY : lint format update build install update-clocks-notebooks update-all-clocks process-tutorials test test-tutorials docs version commit tag release
2
+
3
+ VERSION ?= v0.1.14
4
+ COMMIT_MSG ?= "Bump to $(VERSION ) "
5
+ RELEASE_MSG ?= "Release $(VERSION ) "
6
+
7
+ lint :
8
+ @echo " Running ruff for linting..."
9
+ ruff check pyaging --fix
10
+
11
+ format :
12
+ @echo " Running ruff for code formatting..."
13
+ ruff format pyaging
14
+
15
+ update :
16
+ @echo " Running poetry update..."
17
+ poetry update
18
+
19
+ build : lint format
20
+ @echo " Building the package..."
21
+ poetry build
22
+
23
+ install : build
24
+ @echo " Installing the package..."
25
+ poetry install
26
+
27
+ update-clocks-notebooks :
28
+ @echo " Updating clocks and notebooks..."
29
+ @cd clocks/notebooks && \
30
+ total=$$(ls *.ipynb | wc -l ) && \
31
+ counter=1 && \
32
+ for notebook in * .ipynb; do \
33
+ if [ " $$ notebook" = " template.ipynb" ]; then \
34
+ echo " Skipping template.ipynb" ; \
35
+ continue ; \
36
+ fi ; \
37
+ echo " Processing clock notebook ($$ counter/$$ total): $$ notebook" ; \
38
+ jupyter nbconvert --execute --inplace " $$ notebook" || { echo " Error processing $$ notebook" ; exit 1; }; \
39
+ counter=$$((counter+1 ) ); \
40
+ done && cd ../..
41
+
42
+ update-all-clocks :
43
+ @echo " Running script to update all clocks..."
44
+ @cd clocks && python3 update_all_clocks.py $(VERSION ) || { echo " Updating clocks failed" ; exit 1; } && cd ..
45
+ @echo " Reminder: Upload all clocks and metadata to S3!"
46
+
47
+ process-tutorials :
48
+ @echo " Processing tutorials..."
49
+ @cd tutorials && \
50
+ for notebook in * .ipynb; do \
51
+ echo " Processing tutorial notebook: $$ notebook" ; \
52
+ jupyter nbconvert --ExecutePreprocessor.timeout=600 --to notebook --execute --inplace " $$ notebook" || { echo " Error processing $$ notebook" ; exit 1; }; \
53
+ done && cd ..
54
+
55
+ test :
56
+ @echo " Running gold standard tests..."
57
+ poetry run pytest || { echo " Gold standard tests failed" ; exit 1; }
58
+
59
+ test-tutorials :
60
+ @echo " Running tutorial tests..."
61
+ poetry run pytest --nbmake tutorials/ || { echo " Tutorial tests failed" ; exit 1; }
62
+
63
+ docs :
64
+ @echo " Building documentation..."
65
+ cp tutorials/* .ipynb docs/source/tutorials
66
+ cp clocks/notebooks/* .ipynb docs/source/clock_notebooks
67
+ @cd docs && make html || { echo " Documentation build failed" ; exit 1; }
68
+
69
+ version :
70
+ @echo " Updating version in pyproject.toml to $( VERSION) ..."
71
+ sed -i ' ' " s/^version = \" .*\" /version = \" $( patsubst v%,%,$( VERSION) ) \" /" pyproject.toml || { echo " Error updating version in pyproject.toml" ; exit 1; }
72
+ @echo " Updating version in pyaging/__init__.py to $( VERSION) ..."
73
+ sed -i ' ' " s/^__version__ = \" .*\" /__version__ = \" $( patsubst v%,%,$( VERSION) ) \" /" pyaging/__init__.py || { echo " Error updating version in pyaging/__init__.py" ; exit 1; }
74
+
75
+ commit :
76
+ @echo " Committing and pushing changes..."
77
+ git add .
78
+ git commit -m $(COMMIT_MSG ) || { echo " Git commit failed" ; exit 1; }
79
+ git push || { echo " Git push failed" ; exit 1; }
80
+
81
+ tag :
82
+ @echo " Creating and pushing tag $( VERSION) ..."
83
+ git tag -a " $( VERSION) " -m $(RELEASE_MSG )
84
+ git push origin " $( VERSION) " || { echo " Git tag creation or push failed" ; exit 1; }
85
+
86
+ release : version lint format update build install update-clocks-notebooks update-all-clocks process-tutorials test test-tutorials docs commit tag
87
+ @echo " Release $( VERSION) completed successfully"
0 commit comments