Skip to content

Commit

Permalink
modernize infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Sep 21, 2023
1 parent 4ff0b0d commit 0fe03b2
Show file tree
Hide file tree
Showing 21 changed files with 231 additions and 3,125 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

16 changes: 16 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- dependabot
categories:
- title: Bug Fixes
labels:
- bug
- title: Enhancements
labels:
- enhancement
- title: Other Changes
labels:
- "*"
63 changes: 33 additions & 30 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
name: Build Docs

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
version:
description: Manual Doc Build Reason
default: test
required: false
branches:
- master
- main
jobs:
docs:
name: build & push docs
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 20
strategy:
matrix:
os: ['ubuntu-latest']
environment-file: [ci/310.yaml]
environment-file: [.ci/39.yml]
experimental: [false]
defaults:
run:
shell: bash -l {0}

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

- name: setup micromamba
uses: mamba-org/provision-with-micromamba@main
- uses: actions/checkout@v2
- uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
environment-file: ${{ matrix.environment-file }}
micromamba-version: 'latest'

- name: make docs
run: cd docs; make html

- name: commit docs
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
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
cp -r docs/_build/html/* gh-pages/
Expand All @@ -47,10 +51,9 @@
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present,
# so we ignore the return code.
- name: push to gh-pages
# The above command will fail if no changes were present, so we ignore
# the return code.
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
Expand Down
103 changes: 48 additions & 55 deletions .github/workflows/release_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,52 @@
# under the user's name, not the organzation.

#--------------------------------------------------
name: Release & Publish
name: Release & Publish

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build:
name: Create release & publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml versioneer
python setup.py sdist bdist_wheel
- 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: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changetxt.outputs.text }}
body_path: ${{ steps.changetxt.outputs.path }}
name: Release ${{ env.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
version:
description: Manual Release
default: test
required: false

jobs:
build:
name: Create release & publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build twine
python -m build
twine check --strict dist/*
- name: Create Release Notes
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.ref }}",
generate_release_notes: true
});
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
matrix:
os: [ubuntu-latest]
environment-file:
- ci/38.yaml
- ci/39.yaml
- ci/310.yaml
- ci/310-BASE.yaml
- ci/310-DEV.yaml
- ci/311.yaml
include:
- environment-file: ci/310.yaml
os: macos-latest
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

24 changes: 0 additions & 24 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion ci/38.yaml → ci/311.yaml
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
# required
- libpysal
- numpy>=1.3
Expand Down
4 changes: 0 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
# 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 your package to obtain the version info to display on the docs website
import spreg

Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: notebooks-environment
name: spreg
channels:
- conda-forge
dependencies:
- python=3.10
- python>=3.10
- bokeh
- folium
- geojson
Expand Down
105 changes: 105 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[build-system]
requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]

[project]
name = "spreg"
dynamic = ["version"]
authors = [
{ name = "Luc Anselin", email = "[email protected]" },
{ name = "Serge Rey", email = "[email protected]" },
{ name = "Pedo Amaral", email = "[email protected]" },
]
maintainers = [{ name = "pysal contributors" }]
license = { text = "BSD 3-Clause" }
description = "PySAL Spatial Econometric Regression in Python"
keywords = [
"spatial econometrics, regression, statistics, spatial modeling"
]
readme = { text = """\
Spatial Econometric Regression in Python"
""", 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.8"
dependencies = [
"scipy>=0.11",
"numpy>=1.3",
"pandas",
"libpysal>=4.0.0",
"scikit-learn>=0.22",
]

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

[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",

]

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

[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 = ["spreg/tests/*", "docs/*"]

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

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

0 comments on commit 0fe03b2

Please sign in to comment.