Skip to content

Commit

Permalink
Merge pull request #203 from jGaboardi/migrate_to_pyproject
Browse files Browse the repository at this point in the history
Migrate to `pyproject.toml`
  • Loading branch information
weikang9009 authored Oct 24, 2023
2 parents 711fa81 + e6cedb3 commit 7496b86
Show file tree
Hide file tree
Showing 25 changed files with 268 additions and 944 deletions.
28 changes: 0 additions & 28 deletions .coveragerc

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:
- "*"
95 changes: 26 additions & 69 deletions .github/workflows/release_and_publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# Release package on GitHub and publish to PyPI
# IMPORTANT -- 1 MANUAL STEP
# * FOLLOWING TAGGED RELEASE
# - update CHANGELOG.md
#--------------------------------------------------

name: Build, Release, and publish
name: Release Package

on:
push:
Expand All @@ -20,69 +14,32 @@ on:

jobs:
build:
name: Create release & publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Build source and wheel distributions
run: |
python -m pip install --upgrade build twine
python -m build
twine check --strict dist/*
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- 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: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine jupyter urllib3 pandas pyyaml
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: 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: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # token is provided by GHA, DO NOT create
# 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: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ on:

jobs:
unittests:
env:
RUN_TEST: pytest giddy --cov giddy -v -n auto -r a --cov-config .coveragerc --cov-report xml --color yes --cov-append --cov-report term-missing
name: ${{ matrix.os }}, ${{ matrix.environment-file }}
runs-on: ${{ matrix.os }}
defaults:
Expand All @@ -30,7 +28,7 @@ jobs:
matrix:
os: [ubuntu-latest]
environment-file:
- ci/39.yaml
- ci/39-MIN.yaml
- ci/310.yaml
- ci/311.yaml
- ci/311-DEV.yaml
Expand Down Expand Up @@ -72,7 +70,7 @@ jobs:
if: contains(matrix.environment-file, 'DEV')

- name: run tests
run: ${{ env.RUN_TEST }}
run: pytest giddy --cov giddy -v -n auto -r a --doctest-modules --color yes --cov-report term-missing --cov-report xml

- name: codecov
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: black
language_version: python3
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.292"
rev: "v0.1.0"
hooks:
- id: ruff

Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

37 changes: 17 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
PySAL-giddy for exploratory spatiotemporal data analysis
========================================================
============================================

[![Continuous Integration](https://github.com/pysal/giddy/actions/workflows/unittests.yml/badge.svg)](https://github.com/pysal/giddy/actions/workflows/unittests.yml)
[![codecov](https://codecov.io/gh/pysal/giddy/branch/master/graph/badge.svg)](https://codecov.io/gh/pysal/giddy)
[![Continuous Integration](https://github.com/pysal/giddy/actions/workflows/testing.yml/badge.svg)](https://github.com/pysal/giddy/actions/workflows/testing.yml)
[![codecov](https://codecov.io/gh/pysal/giddy/branch/main/graph/badge.svg)](https://codecov.io/gh/pysal/giddy)
[![Gitter room](https://badges.gitter.im/pysal/giddy.svg)](https://gitter.im/pysal/giddy)
[![PyPI version](https://badge.fury.io/py/giddy.svg)](https://badge.fury.io/py/giddy)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7693957.svg)](https://doi.org/10.5281/zenodo.7693957)
[![badge](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pysal/giddy/master)
[![badge](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pysal/giddy/main)
[![Downloads](https://static.pepy.tech/badge/giddy)](https://pepy.tech/project/giddy)

Giddy is an open-source python library for exploratory spatiotemporal data analysis and the analysis of
geospatial distribution dynamics.
It is under active development
for the inclusion of newly proposed analytics that consider the
role of space in the evolution of distributions over time.
Giddy is an open-source python library for exploratory spatiotemporal data analysis and the analysis of geospatial distribution dynamics. It is under active development for the inclusion of newly proposed analytics that consider the role of space in the evolution of distributions over time.

*Below are six choropleth maps of U.S. state per-capita incomes from 1929 to 2004 at a fifteen-year interval.*

![us_qunitile_maps](figs/us_qunitile_maps.png)

Documentation
-------------
--------------------

Online documentation is available [here](http://pysal.org/giddy/).


Features
--------
------------

- Directional LISA, inference and visualization as rose diagram

[![rose_conditional](figs/rose_conditional.png)](notebooks/DirectionalLISA.ipynb)
Expand All @@ -50,7 +47,7 @@ Features


Examples
--------
-------------

* [Directional LISA](notebooks/DirectionalLISA.ipynb)
* [Markov based methods](notebooks/MarkovBasedMethods.ipynb)
Expand All @@ -60,7 +57,7 @@ Examples
* [Sequence methods (Optimal matching)](notebooks/Sequence.ipynb)

Installation
------------
--------------

Install the stable version released on the [Python Package Index](https://pypi.org/project/giddy/) from the command line:

Expand All @@ -71,7 +68,7 @@ pip install giddy
Install the development version on [pysal/giddy](https://github.com/pysal/giddy):

```
pip install https://github.com/pysal/giddy/archive/main.zip
pip install git+https://github.com/pysal/giddy
```

#### Requirements
Expand All @@ -83,25 +80,25 @@ pip install https://github.com/pysal/giddy/archive/main.zip
- quantecon>=0.4.7

Contribute
----------
--------------

PySAL-giddy is under active development and contributors are welcome.

If you have any suggestion, feature request, or bug report, please open a new [issue](https://github.com/pysal/giddy/issues) on GitHub. To submit patches, please follow the PySAL development [guidelines](https://github.com/pysal/pysal/wiki) and open a [pull request](https://github.com/pysal/giddy). Once your changes get merged, you’ll automatically be added to the [Contributors List](https://github.com/pysal/giddy/graphs/contributors).

Support
-------
-----------

If you are having issues, please talk to us in the [gitter room](https://gitter.im/pysal/giddy).

License
-------
----------

The project is licensed under the [BSD license](https://github.com/pysal/giddy/blob/master/LICENSE.txt).
The project is licensed under the [BSD license](https://github.com/pysal/giddy/blob/main/LICENSE.txt).


BibTeX Citation
---------------
---------------------

```
@software{wei_kang_2023_7693957,
Expand All @@ -126,6 +123,6 @@ BibTeX Citation
```

Funding
-------
-----------

<img src="figs/nsf_logo.jpg" width="50"> Award #1421935 [New Approaches to Spatial Distribution Dynamics](https://www.nsf.gov/awardsearch/showAward?AWD_ID=1421935)
File renamed without changes.
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
codecov:
notify:
after_n_builds: 16
after_n_builds: 5
coverage:
range: 50..95
round: nearest
Expand All @@ -18,5 +18,5 @@ coverage:
comment:
layout: "reach, diff, files"
behavior: once
after_n_builds: 16
after_n_builds: 5
require_changes: true
17 changes: 7 additions & 10 deletions giddy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
__version__ = "2.3.4"
# __version__ has to be defined in the first line

"""
:mod:`giddy` --- Spatial Dynamics and Mobility
==============================================
"""

from . import directional
from . import ergodic
from . import markov
from . import mobility
from . import rank
from . import util
from . import sequence
import contextlib
from importlib.metadata import PackageNotFoundError, version

from . import directional, ergodic, markov, mobility, rank, sequence, util

with contextlib.suppress(PackageNotFoundError):
__version__ = version("giddy")
4 changes: 2 additions & 2 deletions giddy/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def is_component(w, ids):
"""

components = 0
marks = dict([(node, 0) for node in ids])
marks = {node: 0 for node in ids}
q = []
for node in ids:
if marks[node] == 0:
Expand Down Expand Up @@ -103,7 +103,7 @@ def check_contiguity(w, neighbors, leaver):
return is_component(w, ids)


class Graph(object):
class Graph:
def __init__(self, undirected=True):
self.nodes = set()
self.edges = {}
Expand Down
11 changes: 8 additions & 3 deletions giddy/directional.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
_NEG4 = 1 - _POS4


class Rose(object):
class Rose:
"""
Rose diagram based inference for directional LISAs.
Expand Down Expand Up @@ -200,7 +200,12 @@ def __init__(self, Y, w, k=8):
rose diagram conditional on the starting relative income:
>>> fig1, _ = r8.plot(attribute=Y[:,0])
>>> plt.show()
>>> plt.show(block=False)
Close plot when finished viewing.
>>> plt.close("all")
"""

self.Y = Y
Expand Down Expand Up @@ -292,7 +297,7 @@ def permute(self, permutations=99, alternative="two.sided"):
P = NEG * L + (1 - NEG) * S
self.p = P
else:
print(("Bad option for alternative: %s." % alternative))
print("Bad option for alternative: %s." % alternative)

def _calc(self, Y, w, k):
wY = weights.lag_spatial(w, Y)
Expand Down
Loading

0 comments on commit 7496b86

Please sign in to comment.