Skip to content

Commit

Permalink
Merge pull request #174 from knaaptime/newinfra
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime authored May 10, 2023
2 parents 97205be + f78bfbb commit 9663a70
Show file tree
Hide file tree
Showing 22 changed files with 231 additions and 2,316 deletions.
2 changes: 1 addition & 1 deletion .ci/37.yml → .ci/310.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.7
- python=3.10
- jupyterlab
- numpy
- geopandas
Expand Down
2 changes: 1 addition & 1 deletion .ci/38.yml → .ci/311.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.8
- python=3.11
- jupyterlab
- numpy
- geopandas
Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,39 @@
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 90
timeout-minutes: 20
strategy:
matrix:
os: ['ubuntu-latest']
environment-file: [.ci/39.yml]
experimental: [false]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(matrix.environment-file) }}
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: 'latest'
channels: conda-forge
channel-priority: true
auto-update-conda: true
auto-activate-base: false
environment-file: ${{ matrix.environment-file }}
activate-environment: test
- shell: bash -l {0}
run: conda info --all
- shell: bash -l {0}
run: conda list
- shell: bash -l {0}
run: conda config --show-sources
- shell: bash -l {0}
run: conda config --show
- shell: bash -l {0}
run: pip install -e . --no-deps --force-reinstall
- shell: bash -l {0}
run: cd docs; make html
use-only-tar-bz2: true
- run: conda info --all
- run: conda list
- run: conda config --show-sources
- run: conda config --show
- run: pip install -e . --no-deps --force-reinstall
- run: cd docs; make html
- name: Commit documentation changes
run: |
git clone https://github.com/ammaraskar/sphinx-action-test.git --branch gh-pages --single-branch gh-pages
Expand Down
114 changes: 58 additions & 56 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
name: Unit Tests
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
schedule:
- cron: "0 0 * * 0"
name: Unit Tests
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
schedule:
- cron: '59 23 * * *'

jobs:
unittests:
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
runs-on: ${{ matrix.os }}
continue-on-error: true
timeout-minutes: 45
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
environment-file: [.ci/37.yml, .ci/38.yml, .ci/39.yml]
fail-fast: [false]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles(matrix.environment-file) }}
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
mamba-version: "*"
channels: conda-forge
channel-priority: true
auto-update-conda: false
auto-activate-base: false
environment-file: ${{ matrix.environment-file }}
activate-environment: test
use-only-tar-bz2: true
- run: conda info --all
- run: conda list
- run: conda config --show-sources
- run: conda config --show
- run: pip install -e . --no-deps --force-reinstall
- name: Pytest
run: py.test -v tobler --cov=tobler --cov-report=xml
- name: codecov (${{ matrix.os }}, ${{ matrix.environment-file }})
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: tobler-codecov
jobs:
unittests:
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 45
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
environment-file: [ .ci/39.yml, .ci/310.yml, .ci/311.yml]
fail-fast: false

steps:
- name: checkout repo
uses: actions/checkout@v2

- name: setup micromamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: ${{ matrix.environment-file }}
micromamba-version: 'latest'

- name: reinstall tobler - bash
shell: bash -l {0}
run: pip install -e . --no-deps --force-reinstall
if: matrix.os != 'windows-latest'

- name: reinstall tobler - powershell
shell: powershell
run: pip install -e . --no-deps --force-reinstall
if: matrix.os == 'windows-latest'

- name: run pytest - bash
shell: bash -l {0}
run: pytest -v tobler --cov=tobler --cov-report=xml
if: matrix.os != 'windows-latest'

- name: run pytest - powershell
shell: powershell
run: pytest -v tobler --cov=tobler --cov-report=xml
if: matrix.os == 'windows-latest'

- name: codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: tobler-codecov
28 changes: 9 additions & 19 deletions .github/workflows/upload_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,29 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml
python setup.py sdist bdist_wheel
python -m pip install --upgrade build twine
python -m build
twine check --strict dist/*
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}
- name: Run Changelog
run: |
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=-1 --ExecutePreprocessor.kernel_name=python3 tools/gitcount.ipynb
- name: Cat Changelog
uses: pCYSl5EDgo/cat@master
id: changetxt
with:
path: ./tools/changelog.md
env:
TEXT: ${{ steps.changetxt.outputs.text }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changetxt.outputs.text }}
release_name: Version ${{ github.ref }}
draft: false
prerelease: false
- name: Get Asset name
Expand All @@ -52,12 +42,12 @@ jobs:
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset
id: upload-release-asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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
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
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Model-based interpolation uses [spatial] statistical models to estimate a relati
```bash
$ conda env create -f environment.yml
$ conda activate tobler
$ python setup.py develop
$ pip install -e . --no-deps

```

## Contribute
Expand Down
5 changes: 0 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import sys, os
import sphinx_bootstrap_theme


sys.path.insert(0, os.path.abspath("../../"))

import tobler


Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- jupyterlab
- numpy
- geopandas
- geopandas >=0.13
- pandas
- numpy
- rasterio
Expand Down
110 changes: 110 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[build-system]
requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[project]
name = "tobler"
dynamic = ["version"]
authors = [
{ name = "Eli Knaap", email = "[email protected]" },
{ name = "Serge Rey", email = "[email protected]" },
]
maintainers = [{ name = "pysal contributors" }]
license = { text = "BSD 3-Clause" }
description = "Tobler is a Python library for areal interpolation."
keywords = [
"dasymetric mapping, spatial analysis, interpolation, change of support"
]
readme = { text = """\
Spatial interpolation, Dasymetric Mapping, & Change of Support"
""", content-type = "text/x-rst" }
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: GIS",
]
requires-python = ">=3.9"
dependencies = [
"numpy",
"pandas",
"geopandas >=0.13",
"rasterio",
"scipy",
"statsmodels",
"rasterstats",
"libpysal",
"tqdm",
"joblib"
]

[project.urls]
Home = "https://github.com/pysal/tobler/"
Repository = "https://github.com/pysal/tobler"

[project.optional-dependencies]
dev = ["pre-commit"]
docs = [
"nbsphinx",
"numpydoc",
"pandoc",
"sphinx",
"sphinxcontrib-bibtex",
"sphinx_bootstrap_theme",
"mkdocs-jupyter",
"myst-parser"
]
tests = [
"codecov",
"coverage",
"pytest",
"pytest-mpl",
"pytest-cov",
"watermark",
"h3",
"astropy"
]

[tool.setuptools.packages.find]
include = ["tobler", "tobler.*"]

[tool.black]
line-length = 88

[tool.ruff]
line-length = 88
select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"]
target-version = "py39"
ignore = [
"B006",
"B008",
"B009",
"B010",
"C408",
"E731",
"F401",
"F403",
"N803",
"N806",
"N999",
"UP007"
]
exclude = ["tobler/tests/*", "docs/*"]

[tool.coverage.run]
source = ["./tobler"]

[tool.coverage.report]
exclude_lines = [
"if self.debug:",
"pragma: no cover",
"raise NotImplementedError",
"except ModuleNotFoundError:",
"except ImportError",
]
ignore_errors = true
omit = ["tobler/tests/*", "docs/conf.py"]
Loading

0 comments on commit 9663a70

Please sign in to comment.