From e77224c2c013bab04fb4104d9a6f08ccf1fde67c Mon Sep 17 00:00:00 2001 From: knaaptime Date: Tue, 5 Nov 2024 11:20:20 -0800 Subject: [PATCH 1/2] old numpy nan --- .github/workflows/build_docs.yml | 2 +- .github/workflows/unittests.yml | 8 ++++---- ci/{310.yml => 313.yml} | 2 +- environment.yml | 2 +- pyproject.toml | 2 +- segregation/singlegroup/absolute_centralization.py | 4 ++-- segregation/singlegroup/relative_centralization.py | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) rename ci/{310.yml => 313.yml} (95%) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index d9c7e113..99b2fa12 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -13,7 +13,7 @@ strategy: matrix: os: ['ubuntu-latest'] - environment-file: [.ci/39.yml] + environment-file: [ci/312.yml] experimental: [false] defaults: run: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 13367730..aeec85f7 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -24,15 +24,15 @@ matrix: os: [ubuntu-latest] environment-file: - - ci/310.yml - ci/311.yml - ci/312.yml + - ci/313.yml include: - - environment-file: ci/311.yml + - environment-file: ci/312.yml os: macos-latest - - environment-file: ci/311.yml + - environment-file: ci/312.yml os: macos-14 # Apple Silicon - - environment-file: ci/311.yml + - environment-file: ci/312.yml os: windows-latest defaults: run: diff --git a/ci/310.yml b/ci/313.yml similarity index 95% rename from ci/310.yml rename to ci/313.yml index 5bc24a64..2d2d5b36 100644 --- a/ci/310.yml +++ b/ci/313.yml @@ -2,7 +2,7 @@ name: test channels: - conda-forge dependencies: - - python=3.10 + - python=3.13 - deprecation - geopandas>=0.9 - joblib diff --git a/environment.yml b/environment.yml index dfe61705..994d4b5e 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python=3.9 + - python>=3.12 - deprecation - geopandas>=0.9 - joblib diff --git a/pyproject.toml b/pyproject.toml index a30dd558..ef84bc77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering :: GIS", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "deprecation", "geopandas>=0.9", diff --git a/segregation/singlegroup/absolute_centralization.py b/segregation/singlegroup/absolute_centralization.py index 6dbc1b54..b5e1c13a 100644 --- a/segregation/singlegroup/absolute_centralization.py +++ b/segregation/singlegroup/absolute_centralization.py @@ -143,8 +143,8 @@ def _absolute_centralization( Xi = np.cumsum(x[asc_ind]) / X Ai = np.cumsum(area[asc_ind]) / A - ACE = np.nansum(shift(Xi, 1, cval=np.NaN) * Ai) - np.nansum( - Xi * shift(Ai, 1, cval=np.NaN) + ACE = np.nansum(shift(Xi, 1, cval=np.nan) * Ai) - np.nansum( + Xi * shift(Ai, 1, cval=np.nan) ) core_data = data[[group_pop_var, total_pop_var, data.geometry.name]] diff --git a/segregation/singlegroup/relative_centralization.py b/segregation/singlegroup/relative_centralization.py index f082d8d2..7fbd8d47 100644 --- a/segregation/singlegroup/relative_centralization.py +++ b/segregation/singlegroup/relative_centralization.py @@ -145,8 +145,8 @@ def _relative_centralization( Xi = np.cumsum(x[asc_ind]) / X Yi = np.cumsum(y[asc_ind]) / Y - RCE = np.nansum(shift(Xi, 1, cval=np.NaN) * Yi) - np.nansum( - Xi * shift(Yi, 1, cval=np.NaN) + RCE = np.nansum(shift(Xi, 1, cval=np.nan) * Yi) - np.nansum( + Xi * shift(Yi, 1, cval=np.nan) ) core_data = data[[group_pop_var, total_pop_var, data.geometry.name]] From 7df6b8ab73c3e442a30cd8798c48dd24fa14309c Mon Sep 17 00:00:00 2001 From: knaaptime Date: Tue, 5 Nov 2024 11:23:02 -0800 Subject: [PATCH 2/2] update test workflow --- .github/workflows/unittests.yml | 70 +++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index aeec85f7..9533a01a 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,71 +1,89 @@ - name: Tests + name: Continuous Integration on: push: - branches: [main] + branches: + - '*' pull_request: branches: - '*' schedule: - - cron: "0 0 * * 1,4" + - cron: '59 23 * * *' workflow_dispatch: - inputs: - version: - description: Manual Unittest Run - default: test - required: false + inputs: + version: + description: Manual CI Run + default: test + required: false jobs: - Tests: + tests: name: ${{ matrix.os }}, ${{ matrix.environment-file }} runs-on: ${{ matrix.os }} + timeout-minutes: 30 strategy: - fail-fast: false matrix: os: [ubuntu-latest] - environment-file: - - ci/311.yml - - ci/312.yml - - ci/313.yml + environment-file: [ + ci/311.yml, + ci/312.yml, + ci/313.yml, + ] include: - environment-file: ci/312.yml - os: macos-latest + os: macos-13 # Intel - environment-file: ci/312.yml - os: macos-14 # Apple Silicon + os: macos-14 # Apple Silicon - environment-file: ci/312.yml os: windows-latest + fail-fast: false + defaults: run: shell: bash -l {0} - + steps: - - uses: actions/checkout@v4 - + - 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 with: environment-file: ${{ matrix.environment-file }} micromamba-version: 'latest' - - - name: Test segregation + + - name: environment info run: | - pytest \ - segregation \ + micromamba info + micromamba list + + - name: spatial versions + run: 'python -c "import geopandas; geopandas.show_versions();"' + + - name: install package + run: 'pip install . --no-deps' + + - name: run tests + run: | + pytest segregation \ -v \ -r a \ + -n auto \ --color yes \ --cov segregation \ --cov-append \ --cov-report term-missing \ - --cov-report xml \ + --cov-report xml - name: codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml name: segregation-codecov - + - name: Generate and publish the report if: | failure()