Skip to content

Commit

Permalink
proplot optional
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Sep 20, 2023
1 parent da41d4f commit 3ad3721
Show file tree
Hide file tree
Showing 25 changed files with 270 additions and 233 deletions.
4 changes: 0 additions & 4 deletions .ci/310.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ dependencies:
- seaborn
- pyarrow >=0.14.1
- platformdirs
- dash
- dash-bootstrap-components
- palettable
- pip
- tqdm
Expand All @@ -26,7 +24,6 @@ dependencies:
- fsspec
- s3fs
- segregation >=2.0
- versioneer
- pyproj >=3
- pandana
- pooch
Expand All @@ -39,7 +36,6 @@ dependencies:
- coverage
- coveralls
- python-wget
- proplot
- contextily
- scikit-plot
- python-graphviz
6 changes: 1 addition & 5 deletions .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
- pandas
- giddy >=2.2.1
- libpysal
Expand All @@ -14,8 +14,6 @@ dependencies:
- seaborn
- pyarrow >=0.14.1
- platformdirs
- dash
- dash-bootstrap-components
- palettable
- pip
- tqdm
Expand All @@ -26,7 +24,6 @@ dependencies:
- fsspec
- s3fs
- segregation >=2.0
- versioneer
- pyproj >=3
- pandana
- pooch
Expand All @@ -39,7 +36,6 @@ dependencies:
- coverage
- coveralls
- python-wget
- proplot
- contextily
- scikit-plot
- python-graphviz
4 changes: 0 additions & 4 deletions .ci/39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ dependencies:
- hdbscan
- pyarrow >=0.14.1
- platformdirs
- dash
- dash-bootstrap-components
- palettable
- pip
- tqdm
Expand All @@ -26,7 +24,6 @@ dependencies:
- fsspec
- s3fs
- segregation >=2.0
- versioneer
- pyproj >=3
- pandana
- pooch
Expand All @@ -39,7 +36,6 @@ dependencies:
- coverage
- coveralls
- python-wget
- proplot
- contextily
- scikit-plot
- python-graphviz
Expand Down
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:
- "*"
52 changes: 30 additions & 22 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,42 @@
docs:
name: CI (${{ matrix.os }}-${{ matrix.environment-file }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 20
strategy:
matrix:
os: ['ubuntu-latest']
environment-file: [.ci/39.yml]

experimental: [false]
defaults:
run:
shell: bash -l {0}
steps:
- name: checkout repo
uses: actions/checkout@v2

- 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'
mamba-version: "*"
channels: conda-forge
channel-priority: true

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

- name: build docs
shell: bash -l {0}
run: cd docs; make html

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
Expand All @@ -46,7 +55,6 @@
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 changes
uses: ad-m/github-push-action@master
with:
Expand Down
94 changes: 40 additions & 54 deletions .github/workflows/upload_package.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,50 @@

name: Release Package
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
- "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:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
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 develop --no-deps
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
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 }}
draft: false
prerelease: false
- name: Get Asset name
run: |
export PKG=$(ls dist/)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: 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
asset_path: dist/${{ env.name }}
asset_name: ${{ env.name }}
asset_content_type: application/zip
- 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 }}
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ The package supports social scientists examining questions such as:
## Installation

The recommended method for installing geosnap is with
[anaconda](https://www.anaconda.com/download/).
[anaconda](https://www.anaconda.com/download/). In particular, we recommend the [mambaforge distribution](https://github.com/conda-forge/miniforge#mambaforge)

```bash
conda install -c conda-forge geosnap
mamba install -c conda-forge geosnap
```

`geosnap` is alaso available on PyPI and can be install with pip via
Expand Down Expand Up @@ -100,7 +100,7 @@ following commands:
```bash
conda env create -f environment.yml
conda activate geosnap
python setup.py develop
pip install -e . --no-deps
```

This will download the appropriate dependencies and install geosnap in its own conda environment.
Expand Down
18 changes: 17 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,25 @@
"sphinx.ext.intersphinx",
"numpydoc",
"matplotlib.sphinxext.plot_directive",
"myst-parser"
]


myst_enable_extensions = [
"amsmath",
"attrs_inline",
"colon_fence",
"deflist",
"dollarmath",
"fieldlist",
"html_admonition",
"html_image",
"linkify",
"replacements",
"smartquotes",
"strikethrough",
"substitution",
"tasklist",
]

# sphinx_gallery_conf = {
# # path to your examples scripts
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ dependencies:
- spopt >=0.3.0
- s3fs
- segregation >=2.0
- versioneer
- pyproj >=3
- pandana
- pooch
7 changes: 4 additions & 3 deletions geosnap/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def __init__(self, *args, **kwargs):
super(_Map, self).__init__(*args, **kwargs)
for arg in args:
if isinstance(arg, dict):
for k, v in arg.iteritems():
for k, v in arg.items():
self[k] = v

if kwargs:
for k, v in kwargs.iteritems():
for k, v in kwargs.items():
self[k] = v

def __getattr__(self, attr):
Expand Down Expand Up @@ -184,7 +184,8 @@ def seda(
assert pooling in [
"pool",
"long",
], "`pool` argument must be either 'pool' or 'long'"
"poolsub"
], "`pool` argument must be either 'pool', 'long', or 'poolsub'"
assert standardize in [
"gcs",
"cs",
Expand Down
8 changes: 4 additions & 4 deletions geosnap/analyze/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .geodemo import cluster, regionalize, ModelResults, find_k, find_region_k
from .dynamics import sequence, transition, predict_markov_labels
from .incs import linc, lincs_from_gdf
from . import segdyn
from .network import compute_travel_cost_adjlist, isochrone, isochrones
from .dynamics import predict_markov_labels, sequence, transition
from .geodemo import ModelResults, cluster, find_k, find_region_k, regionalize
from .incs import linc, lincs_from_gdf
from .network import compute_travel_cost_adjlist, isochrone, isochrones
4 changes: 2 additions & 2 deletions geosnap/analyze/_cluster_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
def _import_tryer(package, func, name):
try:
return exec(f"from {package} import {func}", globals(), globals())
except ImportError:
except ImportError as e:
raise ImportError(
f"You must have the {name} package installed to use this clusterer "
"but it could not be imported."
)
) from e


# Sklearn a-spatial models
Expand Down
2 changes: 1 addition & 1 deletion geosnap/analyze/_model_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def plot_next_best_label(
ncols=None,
save_fig=None,
alpha=0.5,
cmap="set1",
cmap="Set1",
title="Next-Best Label",
dpi=500,
plot_kwargs=None,
Expand Down
Loading

0 comments on commit 3ad3721

Please sign in to comment.