1
+ # #######################################################################################
1
2
# DO NOT MODIFY!!!
2
3
# If necessary, override the corresponding variable and/or target, or create new ones
3
4
# in one of the following files, depending on the nature of the override :
8
9
# files to include.
9
10
#
10
11
# Please report bugs to francis.pelletier@mila.quebec
12
+ # #######################################################################################
11
13
12
14
# Basic variables
13
15
PROJECT_PATH := $(dir $(abspath $(firstword $(MAKEFILE_LIST ) ) ) )
14
16
MAKEFILE_NAME := $(word $(words $(MAKEFILE_LIST ) ) ,$(MAKEFILE_LIST ) )
15
17
SHELL := /usr/bin/env bash
16
18
BUMP_TOOL := bump-my-version
17
- APP_VERSION := 0.0 .0
19
+ MAKEFILE_VERSION := 0.2 .0
18
20
DOCKER_COMPOSE ?= docker compose
19
21
AUTO_INSTALL ?=
20
22
@@ -94,8 +96,8 @@ conda-install: ## Install Conda on your local machine
94
96
echo " Fetching and installing miniconda" ; \
95
97
echo " " ; \
96
98
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~ /miniconda.sh; \
97
- bash ~/miniconda.sh -b -p ${HOME}/.conda; \
98
- export PATH=${HOME}/.conda/bin :$PATH; \
99
+ bash ~/miniconda.sh -b -p $$ {HOME}/.conda; \
100
+ export PATH=$$ {HOME}/.conda/bin :$ $PATH; \
99
101
conda init; \
100
102
/usr/bin/rm ~/miniconda.sh; \
101
103
;; \
@@ -118,9 +120,13 @@ conda-env-info: ## Print information about active Conda environment using <CONDA
118
120
119
121
.PHONY : _conda-poetry-install
120
122
_conda-poetry-install :
121
- $(CONDA_TOOL ) run -n $(CONDA_ENVIRONMENT ) $(CONDA_TOOL ) install -c conda-forge -y poetry; \
122
-
123
-
123
+ $(CONDA_TOOL ) run -n $(CONDA_ENVIRONMENT ) $(CONDA_TOOL ) install -c conda-forge poetry; \
124
+ CURRENT_VERSION=$$(poetry --version | awk '{print $$NF}' | tr -d ' ) ' ); \
125
+ REQUIRED_VERSION=" 1.6.0" ; \
126
+ if [ " $$ (printf '%s\n' " $$ REQUIRED_VERSION" " $$ CURRENT_VERSION" | sort -V | head -n1)" != " $$ REQUIRED_VERSION" ]; then \
127
+ echo " Poetry installed version $$ CURRENT_VERSION is less than minimal version $$ REQUIRED_VERSION, fixing urllib3 version to prevent problems" ; \
128
+ poetry add " urllib3<2.0.0" ; \
129
+ fi ;
124
130
125
131
.PHONY :conda-poetry-install
126
132
conda-poetry-install : # # Install Poetry in currently active Conda environment. Will fail if Conda is not found
@@ -395,35 +401,36 @@ bump-patch: ## Bump application patch version <0.0.X>
395
401
396
402
.PHONY : check-lint
397
403
check-lint : # # Check code linting (black, isort, flake8, docformatter and pylint)
398
- poetry run tox -e black,isort,flake8,docformatter,pylint
404
+ poetry run nox -s check
399
405
400
406
.PHONY : check-pylint
401
- check-pylint : # # Check code with pylint
402
- poetry run tox -e pylint
407
+ check-pylint : # # Check code linting with pylint
408
+ poetry run nox -s pylint
403
409
404
410
.PHONY : fix-lint
405
411
fix-lint : # # Fix code linting (black, isort, flynt, docformatter)
406
- poetry run tox -e fix
412
+ poetry run nox -s fix
407
413
408
414
.PHONY : precommit
409
415
precommit : # # Run Pre-commit on all files manually
410
- poetry run tox -e precommit
416
+ poetry run nox -s precommit
417
+
411
418
412
419
# # -- Tests targets ------------------------------------------------------------------------------------------------- ##
413
420
414
421
.PHONY : test
415
422
test : # # Run all tests
416
- poetry run tox -e test
423
+ poetry run nox -s test
417
424
418
425
TEST_ARGS ?=
419
426
MARKER_TEST_ARGS = -m "$(TEST_ARGS ) "
420
427
SPECIFIC_TEST_ARGS = -k "$(TEST_ARGS ) "
421
428
CUSTOM_TEST_ARGS = "$(TEST_ARGS ) "
422
429
423
430
.PHONY : test-marker
424
- test-marker : # # Run tests using pytest markers. Ex. make test-tag TEST_ARGS="<marker>"
431
+ test-marker : # # Run tests using pytest markers. Ex. make test-marker TEST_ARGS="<marker>"
425
432
@if [ -n " $( TEST_ARGS) " ]; then \
426
- poetry run tox -e test-custom -- -- $(MARKER_TEST_ARGS ) ; \
433
+ poetry run nox -s test_custom -- -- $(MARKER_TEST_ARGS ) ; \
427
434
else \
428
435
echo " " ; \
429
436
echo 'ERROR : Variable TEST_ARGS has not been set, please rerun the command like so :' ; \
@@ -434,7 +441,7 @@ test-marker: ## Run tests using pytest markers. Ex. make test-tag TEST_ARGS="<ma
434
441
.PHONY : test-specific
435
442
test-specific : # # Run specific tests using the -k option. Ex. make test-specific TEST_ARGS="<name-of-test>"
436
443
@if [ -n " $( TEST_ARGS) " ]; then \
437
- poetry run tox -e test-custom -- -- $(SPECIFIC_TEST_ARGS); \
444
+ poetry run nox -s test_custom -- -- $(SPECIFIC_TEST_ARGS); \
438
445
else \
439
446
echo "" ; \
440
447
echo 'ERROR : Variable TEST_ARGS has not been set, please rerun the command like so :' ; \
@@ -446,7 +453,7 @@ test-specific: ## Run specific tests using the -k option. Ex. make test-specific
446
453
.PHONY : test-custom
447
454
test-custom : # # Run tests with custom args. Ex. make test-custom TEST_ARGS="-m 'not offline'"
448
455
@if [ -n " $( TEST_ARGS) " ]; then \
449
- poetry run tox -e test-custom -- -- $(CUSTOM_TEST_ARGS); \
456
+ poetry run nox -s test_custom -- -- $(CUSTOM_TEST_ARGS); \
450
457
else \
451
458
echo "" ; \
452
459
echo 'ERROR : Variable TEST_ARGS has not been set, please rerun the command like so :' ; \
0 commit comments