From ea324f6ddb715d0612e7861cca727652642ad0f9 Mon Sep 17 00:00:00 2001 From: James Gaboardi Date: Sun, 14 Jul 2024 13:10:23 -0400 Subject: [PATCH 1/2] infra update - CI, names, linting, format, etc. --- .github/workflows/build_docs.yml | 4 +- .github/workflows/testing.yml | 50 +++++++++++++------- .pre-commit-config.yaml | 8 +--- README.md | 3 +- ci/{310.yaml => 310-latest.yaml} | 0 ci/{310-numba.yaml => 310-numba-latest.yaml} | 0 ci/310-oldest.yaml | 19 ++++++++ ci/{311.yaml => 311-latest.yaml} | 7 --- ci/{311-numba.yaml => 311-numba-latest.yaml} | 0 ci/{312.yaml => 312-latest.yaml} | 0 ci/{312-numba.yaml => 312-numba-latest.yaml} | 0 ci/{39-numba.yaml => 39-numba-latest.yaml} | 0 ci/{39-min.yaml => 39-oldest.yaml} | 0 ci/{39.yaml => 39_latest.yaml} | 0 docs/installation.rst | 3 +- environment.yml | 2 +- pyproject.toml | 22 ++++----- 17 files changed, 70 insertions(+), 48 deletions(-) rename ci/{310.yaml => 310-latest.yaml} (100%) rename ci/{310-numba.yaml => 310-numba-latest.yaml} (100%) create mode 100644 ci/310-oldest.yaml rename ci/{311.yaml => 311-latest.yaml} (69%) rename ci/{311-numba.yaml => 311-numba-latest.yaml} (100%) rename ci/{312.yaml => 312-latest.yaml} (100%) rename ci/{312-numba.yaml => 312-numba-latest.yaml} (100%) rename ci/{39-numba.yaml => 39-numba-latest.yaml} (100%) rename ci/{39-min.yaml => 39-oldest.yaml} (100%) rename ci/{39.yaml => 39_latest.yaml} (100%) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 4d42cf22..8e0535d6 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -21,7 +21,7 @@ strategy: matrix: os: ['ubuntu-latest'] - environment-file: [ci/311.yaml] + environment-file: [ci/312-latest.yaml] experimental: [false] defaults: run: @@ -30,6 +30,8 @@ steps: - name: Checkout repo uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. - name: Setup micromamba uses: mamba-org/setup-micromamba@v1 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 18b1331b..0e4a21d4 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -22,35 +22,38 @@ jobs: os: ["ubuntu-latest"] environment-file: [ - ci/39-min.yaml, - ci/39.yaml, - ci/39-numba.yaml, - ci/310.yaml, - ci/310-numba.yaml, - ci/311.yaml, - ci/311-numba.yaml, - ci/312.yaml, - ci/312-numba.yaml, + ci/39-oldest.yaml, + ci/39-latest.yaml, + ci/39-numba-latest.yaml, + ci/310-oldest.yaml, + ci/310-latest.yaml, + ci/310-numba-latest.yaml, + ci/311-latest.yaml, + ci/311-numba-latest.yaml, + ci/312-latest.yaml, + ci/312-numba-latest.yaml, ci/312-dev.yaml, ] include: - - environment-file: ci/312.yaml + - environment-file: ci/312-latest.yaml os: macos-13 # Intel - - environment-file: ci/312-numba.yaml + - environment-file: ci/312-numba-latest.yaml os: macos-13 # Intel - - environment-file: ci/312.yaml + - environment-file: ci/312-latest.yaml os: macos-14 # Apple Silicon - - environment-file: ci/312-numba.yaml + - environment-file: ci/312-numba-latest.yaml os: macos-14 # Apple Silicon - - environment-file: ci/312.yaml + - environment-file: ci/312-latest.yaml os: windows-latest - - environment-file: ci/312-numba.yaml + - environment-file: ci/312-numba-latest.yaml os: windows-latest fail-fast: false steps: - name: checkout repo uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches and tags. - name: setup micromamba uses: mamba-org/setup-micromamba@v1 @@ -69,17 +72,28 @@ jobs: - name: Run pytest run: | - pytest mapclassify -r a -v -n auto --cov mapclassify --cov-report xml --color yes --cov-append --cov-report term-missing + pytest \ + mapclassify \ + -r a \ + -v \ + -n auto \ + --color yes \ + --cov-append \ + --cov mapclassify \ + --cov-report xml \ + --cov-report term-missing - name: run docstring tests - if: contains(matrix.environment-file, '312-numba') && contains(matrix.os, 'ubuntu') + if: contains(matrix.environment-file, '312-numba-latest') && contains(matrix.os, 'ubuntu') run: | pytest \ -v \ -r a \ -n auto \ --color yes \ - --cov mapclassify --cov-report xml --cov-append \ + --cov-append \ + --cov mapclassify \ + --cov-report xml \ --doctest-only \ --mpl mapclassify diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea9b0372..6b54aac6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,10 @@ files: 'mapclassify\/' repos: - - repo: https://github.com/psf/black - rev: "24.4.2" - hooks: - - id: black - language_version: python3 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.5.0" + rev: "v0.5.1" hooks: - id: ruff + - id: ruff-format ci: autofix_prs: false diff --git a/README.md b/README.md index 9f73d132..04ccaa63 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![PyPI version](https://badge.fury.io/py/mapclassify.svg)](https://badge.fury.io/py/mapclassify) [![DOI](https://zenodo.org/badge/88918063.svg)](https://zenodo.org/badge/latestdoi/88918063) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pysal/mapclassify/main) `mapclassify` implements a family of classification schemes for choropleth maps. @@ -418,4 +418,3 @@ conda activate mapclassify conda remove -n mapclassify mapclassify pip install -e . ``` - diff --git a/ci/310.yaml b/ci/310-latest.yaml similarity index 100% rename from ci/310.yaml rename to ci/310-latest.yaml diff --git a/ci/310-numba.yaml b/ci/310-numba-latest.yaml similarity index 100% rename from ci/310-numba.yaml rename to ci/310-numba-latest.yaml diff --git a/ci/310-oldest.yaml b/ci/310-oldest.yaml new file mode 100644 index 00000000..8f13717c --- /dev/null +++ b/ci/310-oldest.yaml @@ -0,0 +1,19 @@ +name: test +channels: + - conda-forge +dependencies: + - python=3.10 + # required + - networkx=2.7 + - numpy=1.23 + - pandas=1.4 + - scikit-learn=1.0 + - scipy=1.8 + # testing + - geopandas<1 + - libpysal + - pytest + - pytest-cov + - pytest-xdist + - codecov + - matplotlib=3.5 diff --git a/ci/311.yaml b/ci/311-latest.yaml similarity index 69% rename from ci/311.yaml rename to ci/311-latest.yaml index 2f5d309b..628956a8 100644 --- a/ci/311.yaml +++ b/ci/311-latest.yaml @@ -18,10 +18,3 @@ dependencies: - pytest-mpl - codecov - matplotlib - # docs - - nbsphinx - - numpydoc - - sphinx - - sphinx-gallery - - sphinxcontrib-bibtex - - sphinx_bootstrap_theme diff --git a/ci/311-numba.yaml b/ci/311-numba-latest.yaml similarity index 100% rename from ci/311-numba.yaml rename to ci/311-numba-latest.yaml diff --git a/ci/312.yaml b/ci/312-latest.yaml similarity index 100% rename from ci/312.yaml rename to ci/312-latest.yaml diff --git a/ci/312-numba.yaml b/ci/312-numba-latest.yaml similarity index 100% rename from ci/312-numba.yaml rename to ci/312-numba-latest.yaml diff --git a/ci/39-numba.yaml b/ci/39-numba-latest.yaml similarity index 100% rename from ci/39-numba.yaml rename to ci/39-numba-latest.yaml diff --git a/ci/39-min.yaml b/ci/39-oldest.yaml similarity index 100% rename from ci/39-min.yaml rename to ci/39-oldest.yaml diff --git a/ci/39.yaml b/ci/39_latest.yaml similarity index 100% rename from ci/39.yaml rename to ci/39_latest.yaml diff --git a/docs/installation.rst b/docs/installation.rst index ac5be1ef..f54e92b6 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -3,7 +3,7 @@ Installation ============ -mapclassify supports python `3.9`_, `3.10`_, and `3.11`_. Please make sure that you are +mapclassify supports python `3.9`_, `3.10`_, `3.11`_, and `3.12`_. Please make sure that you are operating in a python 3 environment. Installing released version @@ -44,6 +44,7 @@ contribute to mapclassify development. .. _3.9: https://docs.python.org/3.9/ .. _3.10: https://docs.python.org/3.10/ .. _3.11: https://docs.python.org/3.11/ +.. _3.12: https://docs.python.org/3.12/ .. _conda: https://docs.conda.io/en/latest/ .. _conda-forge: https://anaconda.org/conda-forge/mapclassify .. _Python Package Index: https://pypi.org/project/mapclassify/ diff --git a/environment.yml b/environment.yml index 8fad48b5..fdcfc4c3 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ name: mapclassify channels: - conda-forge dependencies: - - python=3.11 + - python - geopandas - git - ipywidgets diff --git a/pyproject.toml b/pyproject.toml index 5aba00a8..72bcb889 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,8 +52,14 @@ Home = "https://pysal.org/mapclassify/" Repository = "https://github.com/pysal/mapclassify" [project.optional-dependencies] -speedups = ["numba>=0.54"] -dev = ["black", "ruff", "pre-commit"] +speedups = [ + "numba>=0.54" +] +dev = [ + "ruff", + "pre-commit", + "watermark", +] docs = [ "nbsphinx", "numpydoc", @@ -77,18 +83,10 @@ all = ["numba[speedups,dev,docs,tests]"] [tool.setuptools.packages.find] include = ["mapclassify", "mapclassify.*"] -[tool.black] -line-length = 88 -extend-exclude = ''' -( - docs/conf.py -) -#''' - [tool.ruff] line-length = 88 -select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] -ignore = [ +lint.select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] +lint.ignore = [ "B006", "B008", "B009", From 8571a71e0a26c052982f4682fcf00e9677a09231 Mon Sep 17 00:00:00 2001 From: James Gaboardi Date: Sun, 14 Jul 2024 13:16:17 -0400 Subject: [PATCH 2/2] correct 39 env name --- ci/{39_latest.yaml => 39-latest.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ci/{39_latest.yaml => 39-latest.yaml} (100%) diff --git a/ci/39_latest.yaml b/ci/39-latest.yaml similarity index 100% rename from ci/39_latest.yaml rename to ci/39-latest.yaml