diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2864d2c..55cd09f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,10 +18,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge + miniforge-variant: Miniforge3 miniforge-version: latest activate-environment: climateset use-mamba: true @@ -32,7 +32,7 @@ jobs: shell: bash - name: Cache Conda env - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.CONDA }}/envs key: diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml index a248e70..8b6a139 100644 --- a/.github/workflows/precommit.yml +++ b/.github/workflows/precommit.yml @@ -18,10 +18,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Mambaforge + - name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge + miniforge-variant: Miniforge3 miniforge-version: latest activate-environment: climateset use-mamba: true @@ -32,7 +32,7 @@ jobs: shell: bash - name: Cache Conda env - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.CONDA }}/envs key: diff --git a/.make/base.make b/.make/base.make index 358ce87..9342369 100644 --- a/.make/base.make +++ b/.make/base.make @@ -1,3 +1,4 @@ +######################################################################################## # DO NOT MODIFY!!! # If necessary, override the corresponding variable and/or target, or create new ones # in one of the following files, depending on the nature of the override : @@ -8,13 +9,14 @@ # files to include. # # Please report bugs to francis.pelletier@mila.quebec +######################################################################################## # Basic variables PROJECT_PATH := $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) MAKEFILE_NAME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) SHELL := /usr/bin/env bash BUMP_TOOL := bump-my-version -APP_VERSION := 0.0.0 +MAKEFILE_VERSION := 0.2.0 DOCKER_COMPOSE ?= docker compose AUTO_INSTALL ?= @@ -94,8 +96,8 @@ conda-install: ## Install Conda on your local machine echo "Fetching and installing miniconda"; \ echo " "; \ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh; \ - bash ~/miniconda.sh -b -p ${HOME}/.conda; \ - export PATH=${HOME}/.conda/bin:$PATH; \ + bash ~/miniconda.sh -b -p $${HOME}/.conda; \ + export PATH=$${HOME}/.conda/bin:$$PATH; \ conda init; \ /usr/bin/rm ~/miniconda.sh; \ ;; \ @@ -118,9 +120,13 @@ conda-env-info: ## Print information about active Conda environment using .PHONY: check-lint check-lint: ## Check code linting (black, isort, flake8, docformatter and pylint) - poetry run tox -e black,isort,flake8,docformatter,pylint + poetry run nox -s check .PHONY: check-pylint -check-pylint: ## Check code with pylint - poetry run tox -e pylint +check-pylint: ## Check code linting with pylint + poetry run nox -s pylint .PHONY: fix-lint fix-lint: ## Fix code linting (black, isort, flynt, docformatter) - poetry run tox -e fix + poetry run nox -s fix .PHONY: precommit precommit: ## Run Pre-commit on all files manually - poetry run tox -e precommit + poetry run nox -s precommit + ## -- Tests targets ------------------------------------------------------------------------------------------------- ## .PHONY: test test: ## Run all tests - poetry run tox -e test + poetry run nox -s test TEST_ARGS ?= MARKER_TEST_ARGS = -m "$(TEST_ARGS)" @@ -421,9 +428,9 @@ SPECIFIC_TEST_ARGS = -k "$(TEST_ARGS)" CUSTOM_TEST_ARGS = "$(TEST_ARGS)" .PHONY: test-marker -test-marker: ## Run tests using pytest markers. Ex. make test-tag TEST_ARGS="" +test-marker: ## Run tests using pytest markers. Ex. make test-marker TEST_ARGS="" @if [ -n "$(TEST_ARGS)" ]; then \ - poetry run tox -e test-custom -- -- $(MARKER_TEST_ARGS); \ + poetry run nox -s test_custom -- -- $(MARKER_TEST_ARGS); \ else \ echo "" ; \ 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="=0.7.6)", "git-fame (>=1.12.2)", "pip-tools", "pre- docs = ["Sphinx (>=4.3.0)", "furo", "ghp-import", "linkify-it-py", "myst-parser", "sphinx-autodoc-typehints", "sphinx-autodoc2", "sphinx-click", "sphinx-copybutton"] test = ["coverage", "pre-commit", "pytest", "pytest-cov", "pytest-mock"] -[[package]] -name = "cachetools" -version = "5.3.3" -description = "Extensible memoizing collections and decorators" -optional = false -python-versions = ">=3.7" -files = [ - {file = "cachetools-5.3.3-py3-none-any.whl", hash = "sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945"}, - {file = "cachetools-5.3.3.tar.gz", hash = "sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105"}, -] - [[package]] name = "cattrs" version = "23.2.3" @@ -491,17 +494,6 @@ files = [ [package.dependencies] numpy = {version = ">1.13.3", markers = "python_version < \"3.12.0.rc1\""} -[[package]] -name = "chardet" -version = "5.2.0" -description = "Universal encoding detector for Python 3" -optional = false -python-versions = ">=3.7" -files = [ - {file = "chardet-5.2.0-py3-none-any.whl", hash = "sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970"}, - {file = "chardet-5.2.0.tar.gz", hash = "sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7"}, -] - [[package]] name = "charset-normalizer" version = "3.3.2" @@ -637,6 +629,23 @@ files = [ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +[[package]] +name = "colorlog" +version = "6.8.2" +description = "Add colours to the output of Python's logging module." +optional = false +python-versions = ">=3.6" +files = [ + {file = "colorlog-6.8.2-py3-none-any.whl", hash = "sha256:4dcbb62368e2800cb3c5abd348da7e53f6c362dda502ec27c560b2e58a66bd33"}, + {file = "colorlog-6.8.2.tar.gz", hash = "sha256:3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} + +[package.extras] +development = ["black", "flake8", "mypy", "pytest", "types-colorama"] + [[package]] name = "comm" version = "0.2.2" @@ -829,6 +838,7 @@ files = [ [package.dependencies] charset_normalizer = ">=3.0.0,<4.0.0" +tomli = {version = ">=2.0.0,<3.0.0", optional = true, markers = "python_version < \"3.11\" and extra == \"tomli\""} untokenize = ">=0.1.1,<0.2.0" [package.extras] @@ -2002,6 +2012,28 @@ jupyter-server = ">=1.8,<3" [package.extras] test = ["pytest", "pytest-console-scripts", "pytest-jupyter", "pytest-tornasync"] +[[package]] +name = "nox" +version = "2024.4.15" +description = "Flexible test automation." +optional = false +python-versions = ">=3.7" +files = [ + {file = "nox-2024.4.15-py3-none-any.whl", hash = "sha256:6492236efa15a460ecb98e7b67562a28b70da006ab0be164e8821177577c0565"}, + {file = "nox-2024.4.15.tar.gz", hash = "sha256:ecf6700199cdfa9e5ea0a41ff5e6ef4641d09508eda6edb89d9987864115817f"}, +] + +[package.dependencies] +argcomplete = ">=1.9.4,<4.0" +colorlog = ">=2.6.1,<7.0.0" +packaging = ">=20.9" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} +virtualenv = ">=20.14.1" + +[package.extras] +tox-to-nox = ["jinja2", "tox"] +uv = ["uv (>=0.1.6)"] + [[package]] name = "numba" version = "0.59.1" @@ -2639,25 +2671,6 @@ cryptography = ">=41.0.5,<43" docs = ["sphinx (!=5.2.0,!=5.2.0.post0,!=7.2.5)", "sphinx-rtd-theme"] test = ["pretend", "pytest (>=3.0.1)", "pytest-rerunfailures"] -[[package]] -name = "pyproject-api" -version = "1.6.1" -description = "API to interact with the python pyproject.toml based projects" -optional = false -python-versions = ">=3.8" -files = [ - {file = "pyproject_api-1.6.1-py3-none-any.whl", hash = "sha256:4c0116d60476b0786c88692cf4e325a9814965e2469c5998b830bba16b183675"}, - {file = "pyproject_api-1.6.1.tar.gz", hash = "sha256:1817dc018adc0d1ff9ca1ed8c60e1623d5aaca40814b953af14a9cf9a5cae538"}, -] - -[package.dependencies] -packaging = ">=23.1" -tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} - -[package.extras] -docs = ["furo (>=2023.8.19)", "sphinx (<7.2)", "sphinx-autodoc-typehints (>=1.24)"] -testing = ["covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "setuptools (>=68.1.2)", "wheel (>=0.41.2)"] - [[package]] name = "pytest" version = "7.4.4" @@ -3461,33 +3474,6 @@ files = [ {file = "tornado-6.4.tar.gz", hash = "sha256:72291fa6e6bc84e626589f1c29d90a5a6d593ef5ae68052ee2ef000dfd273dee"}, ] -[[package]] -name = "tox" -version = "4.15.0" -description = "tox is a generic virtualenv management and test command line tool" -optional = false -python-versions = ">=3.8" -files = [ - {file = "tox-4.15.0-py3-none-any.whl", hash = "sha256:300055f335d855b2ab1b12c5802de7f62a36d4fd53f30bd2835f6a201dda46ea"}, - {file = "tox-4.15.0.tar.gz", hash = "sha256:7a0beeef166fbe566f54f795b4906c31b428eddafc0102ac00d20998dd1933f6"}, -] - -[package.dependencies] -cachetools = ">=5.3.2" -chardet = ">=5.2" -colorama = ">=0.4.6" -filelock = ">=3.13.1" -packaging = ">=23.2" -platformdirs = ">=4.1" -pluggy = ">=1.3" -pyproject-api = ">=1.6.1" -tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} -virtualenv = ">=20.25" - -[package.extras] -docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-argparse-cli (>=1.11.1)", "sphinx-autodoc-typehints (>=1.25.2)", "sphinx-copybutton (>=0.5.2)", "sphinx-inline-tabs (>=2023.4.21)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.11)"] -testing = ["build[virtualenv] (>=1.0.3)", "covdefaults (>=2.3)", "detect-test-pollution (>=1.2)", "devpi-process (>=1)", "diff-cover (>=8.0.2)", "distlib (>=0.3.8)", "flaky (>=3.7)", "hatch-vcs (>=0.4)", "hatchling (>=1.21)", "psutil (>=5.9.7)", "pytest (>=7.4.4)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-xdist (>=3.5)", "re-assert (>=1.1)", "time-machine (>=2.13)", "wheel (>=0.42)"] - [[package]] name = "tqdm" version = "4.66.4" @@ -3826,4 +3812,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.12" -content-hash = "37e6b99df4033a199590905ead26bb5f1dda8a03bdac776eaf6e87bdcc87bb51" +content-hash = "b23f5b772785333d4ce28cd3913d23550db992fb92e8b9b67956716e551822a9" diff --git a/pyproject.toml b/pyproject.toml index e896455..0ab6883 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,12 +33,13 @@ pytest = "^7.4.4" pylint = "^3.0.3" isort = "^5.13.2" bump-my-version = "^0.16.2" -tox = "^4.12.0" flynt = "^1.0.1" flake8 = "^7.0.0" pre-commit = "^3.7.0" flake8-pyproject = "^1.2.3" black = "^24.4.2" +nox = "^2024.4.15" +docformatter = {extras = ["tomli"], version = "^1.7.5"} [tool.poetry.group.lab.dependencies] jupyterlab = "^4.0.10" @@ -99,6 +100,13 @@ replace = ''' disable = "C0114,C0115,C0116,R0903,R1710,W1203,W0511,W0718" max-line-length = 120 max-locals = 20 +max-args = 16 +max-attributes = 20 +ignore = [ + ".git", + "migrations", + "__pycache__" +] [tool.flake8] max-line-length = 120 diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 91bb015..0000000 --- a/tox.ini +++ /dev/null @@ -1,59 +0,0 @@ -[tox] -isolated_build = true -basepython = py311 -envlist = precommit -skipsdist = true - -[isort] -profile = black - -[testenv] -allowlist_externals = poetry -commands_pre = - poetry install - -file_and_folder_all = climateset/ tests/ scripts/ -file_and_folder_scripts_modules = climateset/ scripts/ - -[testenv:pylint] -commands = - poetry run pylint {[testenv]file_and_folder_all} - -[testenv:flake8] -commands = - poetry run flake8 {[testenv]file_and_folder_all} - -[testenv:docformatter] -commands = - poetry run docformatter {[testenv]file_and_folder_all} - -[testenv:fix] -commands = - poetry run black {[testenv]file_and_folder_all} - poetry run isort {[testenv]file_and_folder_all} - poetry run flynt {[testenv]file_and_folder_all} - poetry run docformatter -i {[testenv]file_and_folder_all} - -[testenv:precommit] -commands = - poetry run pre-commit run --all-files - -[testenv:black] -commands = - poetry run black --check {[testenv]file_and_folder_all} - -[testenv:isort] -commands = - poetry run isort {[testenv]file_and_folder_all} --check - -[testenv:flynt] -commands = - poetry run flynt {[testenv]file_and_folder_all} - -[testenv:test] -commands = - poetry run pytest - -[testenv:test-custom] -commands = - poetry run pytest {posargs} \ No newline at end of file