Skip to content

Commit 9663a70

Browse files
authored
Merge pull request #174 from knaaptime/newinfra
2 parents 97205be + f78bfbb commit 9663a70

22 files changed

+231
-2316
lines changed

.ci/37.yml renamed to .ci/310.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: test
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.7
5+
- python=3.10
66
- jupyterlab
77
- numpy
88
- geopandas

.ci/38.yml renamed to .ci/311.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: test
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.8
5+
- python=3.11
66
- jupyterlab
77
- numpy
88
- geopandas

.github/workflows/build_docs.yml

+19-13
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,39 @@
99
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
1010
runs-on: ${{ matrix.os }}
1111
continue-on-error: ${{ matrix.experimental }}
12-
timeout-minutes: 90
12+
timeout-minutes: 20
1313
strategy:
1414
matrix:
1515
os: ['ubuntu-latest']
1616
environment-file: [.ci/39.yml]
1717
experimental: [false]
18+
defaults:
19+
run:
20+
shell: bash -l {0}
1821
steps:
1922
- uses: actions/checkout@v2
23+
- uses: actions/cache@v2
24+
env:
25+
CACHE_NUMBER: 0
26+
with:
27+
path: ~/conda_pkgs_dir
28+
key: ${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(matrix.environment-file) }}
2029
- uses: conda-incubator/setup-miniconda@v2
2130
with:
2231
miniconda-version: 'latest'
32+
channels: conda-forge
33+
channel-priority: true
2334
auto-update-conda: true
2435
auto-activate-base: false
2536
environment-file: ${{ matrix.environment-file }}
2637
activate-environment: test
27-
- shell: bash -l {0}
28-
run: conda info --all
29-
- shell: bash -l {0}
30-
run: conda list
31-
- shell: bash -l {0}
32-
run: conda config --show-sources
33-
- shell: bash -l {0}
34-
run: conda config --show
35-
- shell: bash -l {0}
36-
run: pip install -e . --no-deps --force-reinstall
37-
- shell: bash -l {0}
38-
run: cd docs; make html
38+
use-only-tar-bz2: true
39+
- run: conda info --all
40+
- run: conda list
41+
- run: conda config --show-sources
42+
- run: conda config --show
43+
- run: pip install -e . --no-deps --force-reinstall
44+
- run: cd docs; make html
3945
- name: Commit documentation changes
4046
run: |
4147
git clone https://github.com/ammaraskar/sphinx-action-test.git --branch gh-pages --single-branch gh-pages

.github/workflows/unittests.yml

+58-56
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,59 @@
1-
name: Unit Tests
2-
on:
3-
push:
4-
branches:
5-
- "*"
6-
pull_request:
7-
branches:
8-
- "*"
9-
schedule:
10-
- cron: "0 0 * * 0"
1+
name: Unit Tests
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
pull_request:
7+
branches:
8+
- '*'
9+
schedule:
10+
- cron: '59 23 * * *'
1111

12-
jobs:
13-
unittests:
14-
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
15-
runs-on: ${{ matrix.os }}
16-
continue-on-error: true
17-
timeout-minutes: 45
18-
strategy:
19-
matrix:
20-
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
21-
environment-file: [.ci/37.yml, .ci/38.yml, .ci/39.yml]
22-
fail-fast: [false]
23-
defaults:
24-
run:
25-
shell: bash -l {0}
26-
steps:
27-
- uses: actions/checkout@v2
28-
- uses: actions/cache@v2
29-
env:
30-
CACHE_NUMBER: 0
31-
with:
32-
path: ~/conda_pkgs_dir
33-
key: ${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(matrix.environment-file) }}
34-
- uses: conda-incubator/setup-miniconda@v2
35-
with:
36-
miniconda-version: "latest"
37-
mamba-version: "*"
38-
channels: conda-forge
39-
channel-priority: true
40-
auto-update-conda: false
41-
auto-activate-base: false
42-
environment-file: ${{ matrix.environment-file }}
43-
activate-environment: test
44-
use-only-tar-bz2: true
45-
- run: conda info --all
46-
- run: conda list
47-
- run: conda config --show-sources
48-
- run: conda config --show
49-
- run: pip install -e . --no-deps --force-reinstall
50-
- name: Pytest
51-
run: py.test -v tobler --cov=tobler --cov-report=xml
52-
- name: codecov (${{ matrix.os }}, ${{ matrix.environment-file }})
53-
uses: codecov/codecov-action@v1
54-
with:
55-
token: ${{ secrets.CODECOV_TOKEN }}
56-
file: ./coverage.xml
57-
name: tobler-codecov
12+
jobs:
13+
unittests:
14+
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
15+
runs-on: ${{ matrix.os }}
16+
continue-on-error: false
17+
timeout-minutes: 45
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
environment-file: [ .ci/39.yml, .ci/310.yml, .ci/311.yml]
22+
fail-fast: false
23+
24+
steps:
25+
- name: checkout repo
26+
uses: actions/checkout@v2
27+
28+
- name: setup micromamba
29+
uses: mamba-org/provision-with-micromamba@main
30+
with:
31+
environment-file: ${{ matrix.environment-file }}
32+
micromamba-version: 'latest'
33+
34+
- name: reinstall tobler - bash
35+
shell: bash -l {0}
36+
run: pip install -e . --no-deps --force-reinstall
37+
if: matrix.os != 'windows-latest'
38+
39+
- name: reinstall tobler - powershell
40+
shell: powershell
41+
run: pip install -e . --no-deps --force-reinstall
42+
if: matrix.os == 'windows-latest'
43+
44+
- name: run pytest - bash
45+
shell: bash -l {0}
46+
run: pytest -v tobler --cov=tobler --cov-report=xml
47+
if: matrix.os != 'windows-latest'
48+
49+
- name: run pytest - powershell
50+
shell: powershell
51+
run: pytest -v tobler --cov=tobler --cov-report=xml
52+
if: matrix.os == 'windows-latest'
53+
54+
- name: codecov
55+
uses: codecov/codecov-action@v1
56+
with:
57+
token: ${{ secrets.CODECOV_TOKEN }}
58+
file: ./coverage.xml
59+
name: tobler-codecov

.github/workflows/upload_package.yml

+9-19
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,29 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v2
1515
- name: Set up Python
16-
uses: actions/setup-python@v1
16+
uses: actions/setup-python@v2
1717
with:
1818
python-version: '3.x'
1919
- name: Install dependencies
2020
run: |
2121
python -m pip install --upgrade pip
22-
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml
23-
python setup.py sdist bdist_wheel
22+
python -m pip install --upgrade build twine
23+
python -m build
24+
twine check --strict dist/*
2425
- name: Publish distribution 📦 to PyPI
25-
uses: pypa/gh-action-pypi-publish@master
26+
uses: pypa/gh-action-pypi-publish@release/v1
2627
with:
2728
password: ${{ secrets.pypi_password }}
28-
- name: Run Changelog
29-
run: |
30-
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=-1 --ExecutePreprocessor.kernel_name=python3 tools/gitcount.ipynb
31-
- name: Cat Changelog
32-
uses: pCYSl5EDgo/cat@master
33-
id: changetxt
34-
with:
35-
path: ./tools/changelog.md
36-
env:
37-
TEXT: ${{ steps.changetxt.outputs.text }}
3829
- name: Create Release
3930
id: create_release
4031
uses: actions/create-release@v1
4132
env:
4233
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
4334
with:
4435
tag_name: ${{ github.ref }}
45-
release_name: Release ${{ github.ref }}
46-
body: ${{ steps.changetxt.outputs.text }}
36+
release_name: Version ${{ github.ref }}
4737
draft: false
4838
prerelease: false
4939
- name: Get Asset name
@@ -52,12 +42,12 @@ jobs:
5242
set -- $PKG
5343
echo "name=$1" >> $GITHUB_ENV
5444
- name: Upload Release Asset
55-
id: upload-release-asset
45+
id: upload-release-asset
5646
uses: actions/upload-release-asset@v1
5747
env:
5848
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5949
with:
60-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
50+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
6151
asset_path: dist/${{ env.name }}
6252
asset_name: ${{ env.name }}
6353
asset_content_type: application/zip

MANIFEST.in

-3
This file was deleted.

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ Model-based interpolation uses [spatial] statistical models to estimate a relati
5050
```bash
5151
$ conda env create -f environment.yml
5252
$ conda activate tobler
53-
$ python setup.py develop
53+
$ pip install -e . --no-deps
54+
5455
```
5556

5657
## Contribute

docs/conf.py

-5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
# add these directories to sys.path here. If the directory is relative to the
1717
# documentation root, use os.path.abspath to make it absolute, like shown here.
1818
#
19-
import sys, os
2019
import sphinx_bootstrap_theme
21-
22-
23-
sys.path.insert(0, os.path.abspath("../../"))
24-
2520
import tobler
2621

2722

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
dependencies:
55
- jupyterlab
66
- numpy
7-
- geopandas
7+
- geopandas >=0.13
88
- pandas
99
- numpy
1010
- rasterio

pyproject.toml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
7+
[project]
8+
name = "tobler"
9+
dynamic = ["version"]
10+
authors = [
11+
{ name = "Eli Knaap", email = "[email protected]" },
12+
{ name = "Serge Rey", email = "[email protected]" },
13+
]
14+
maintainers = [{ name = "pysal contributors" }]
15+
license = { text = "BSD 3-Clause" }
16+
description = "Tobler is a Python library for areal interpolation."
17+
keywords = [
18+
"dasymetric mapping, spatial analysis, interpolation, change of support"
19+
]
20+
readme = { text = """\
21+
Spatial interpolation, Dasymetric Mapping, & Change of Support"
22+
23+
""", content-type = "text/x-rst" }
24+
classifiers = [
25+
"Programming Language :: Python :: 3",
26+
"License :: OSI Approved :: BSD License",
27+
"Operating System :: OS Independent",
28+
"Intended Audience :: Science/Research",
29+
"Topic :: Scientific/Engineering :: GIS",
30+
]
31+
requires-python = ">=3.9"
32+
dependencies = [
33+
"numpy",
34+
"pandas",
35+
"geopandas >=0.13",
36+
"rasterio",
37+
"scipy",
38+
"statsmodels",
39+
"rasterstats",
40+
"libpysal",
41+
"tqdm",
42+
"joblib"
43+
]
44+
45+
[project.urls]
46+
Home = "https://github.com/pysal/tobler/"
47+
Repository = "https://github.com/pysal/tobler"
48+
49+
[project.optional-dependencies]
50+
dev = ["pre-commit"]
51+
docs = [
52+
"nbsphinx",
53+
"numpydoc",
54+
"pandoc",
55+
"sphinx",
56+
"sphinxcontrib-bibtex",
57+
"sphinx_bootstrap_theme",
58+
"mkdocs-jupyter",
59+
"myst-parser"
60+
]
61+
tests = [
62+
"codecov",
63+
"coverage",
64+
"pytest",
65+
"pytest-mpl",
66+
"pytest-cov",
67+
"watermark",
68+
"h3",
69+
"astropy"
70+
]
71+
72+
[tool.setuptools.packages.find]
73+
include = ["tobler", "tobler.*"]
74+
75+
[tool.black]
76+
line-length = 88
77+
78+
[tool.ruff]
79+
line-length = 88
80+
select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"]
81+
target-version = "py39"
82+
ignore = [
83+
"B006",
84+
"B008",
85+
"B009",
86+
"B010",
87+
"C408",
88+
"E731",
89+
"F401",
90+
"F403",
91+
"N803",
92+
"N806",
93+
"N999",
94+
"UP007"
95+
]
96+
exclude = ["tobler/tests/*", "docs/*"]
97+
98+
[tool.coverage.run]
99+
source = ["./tobler"]
100+
101+
[tool.coverage.report]
102+
exclude_lines = [
103+
"if self.debug:",
104+
"pragma: no cover",
105+
"raise NotImplementedError",
106+
"except ModuleNotFoundError:",
107+
"except ImportError",
108+
]
109+
ignore_errors = true
110+
omit = ["tobler/tests/*", "docs/conf.py"]

0 commit comments

Comments
 (0)