Skip to content

Commit

Permalink
setup for pypi
Browse files Browse the repository at this point in the history
- update requirements
- script to generate requirements
- push to pypi
  • Loading branch information
robkooper committed Jun 25, 2022
1 parent 1594ebc commit 836edb6
Show file tree
Hide file tree
Showing 10 changed files with 849 additions and 62 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Publish Python package

on:
release:
types:
- published

pull_request:

jobs:
publish:
name: Build and publish python packages
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2

- name: get release info
id: release_info
run: |
if [ "${{ github.event.release.tag_name }}" != "" ]; then
version=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')
else
version="$(awk -F= '/^PACKAGE_VERSION/ { print $2}' pyincore-viz/globals.py | sed 's/[ "]//g').${{ github.run_number }}"
fi
echo "VERSION=${version}" >> $GITHUB_ENV
echo "VERSION=${version}"
./version.sh ${version}
testing=$(echo $version | sed 's/[0-9\.]//')
if [ "$testing" == "" ]; then
echo "REPO_URL=" >> $GITHUB_ENV
echo "TOKEN=${{ secrets.PYPI_API_TOKEN }}" >> $GITHUB_ENV
else
echo "REPO_URL=https://test.pypi.org/legacy/" >> $GITHUB_ENV
echo "TOKEN=${{ secrets.TEST_PYPI_API_TOKEN }}" >> $GITHUB_ENV
fi
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: python -m pip install --upgrade pip setuptools wheel

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Build dist file
run: |
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ env.TOKEN }}
repository_url: ${{ env.REPO_URL }}

- name: Upload binaries to release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/pyincore-viz-${{ env.VERSION }}*
file_glob: true
overwrite: true
37 changes: 37 additions & 0 deletions .github/workflows/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: pyclowder

# This will check to see if there are new requirements and will
# automatically create a pull request.
on:
push:
branches:
- main

schedule:
- cron: '0 0 * * *'

# Certain actions will only run when this is the main repo.
env:
MAIN_REPO: IN-CORE/pyincore-viz

jobs:
pyclowder:
runs-on: ubuntu-latest
if: github.repository == env.MAIN_REPO

steps:
- uses: actions/checkout@v3

# check all requirements
- name: requirements check
run: |
./requirements.sh
# try and create a PR
- name: create PR if needed
uses: peter-evans/create-pull-request@v3
with:
commit-message: "Updated requirements"
title: "Updated requirements"
reviewers: IN-CORE/core-dev
delete-branch: true
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This package is designed for visualizing the output of pyIncore analyses.
pyIncore is a Python package to analyze and visualize various hazard
(earthquake, tornado, hurricane etc.) scenarios developed
by the Center for Risk-Based Community Resilience Planning team from NCSA.
The development is part of NIST sponsored IN-CORE (Interdependent Networked Community
Resilience Modeling Environment) initiative.
pyIncore allows users to apply hazards on infrastructure in selected areas.
Python framework acceses underlying data through local or remote services
and facilitates moving and synthesizing results.
123 changes: 123 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: base
channels:
- conda-forge
- defaults
dependencies:
- ipopt>=3.11
- numpy>=1.16
- affine==2.3.1
- appnope==0.1.3
- argon2-cffi==21.3.0
- argon2-cffi-bindings==21.2.0
- asttokens==2.0.5
- attrs==21.4.0
- backcall==0.2.0
- beautifulsoup4==4.11.1
- bleach==5.0.0
- branca==0.5.0
- certifi==2022.6.15
- cffi==1.15.0
- charset-normalizer==2.0.12
- click==8.1.3
- click-plugins==1.1.1
- cligj==0.7.2
- contextily==1.2.0
- cycler==0.11.0
- debugpy==1.6.0
- decorator==5.1.1
- defusedxml==0.7.1
- deprecated==1.2.13
- ecdsa==0.17.0
- entrypoints==0.4
- executing==0.8.3
- fastjsonschema==2.15.3
- fiona==1.8.21
- fonttools==4.33.3
- geographiclib==1.52
- geopandas==0.11.0
- geopy==2.2.0
- idna==3.3
- iniconfig==1.1.1
- ipykernel==6.15.0
- ipyleaflet==0.16.0
- ipython==8.4.0
- ipython-genutils==0.2.0
- ipywidgets==7.7.1
- jedi==0.18.1
- jinja2==3.1.2
- joblib==1.1.0
- jsonschema==4.6.0
- jupyter-client==7.3.4
- jupyter-core==4.10.0
- jupyterlab-pygments==0.2.2
- jupyterlab-widgets==1.1.1
- kiwisolver==1.4.3
- lxml==4.9.0
- markupsafe==2.1.1
- matplotlib==3.5.2
- matplotlib-inline==0.1.3
- mercantile==1.2.1
- mistune==0.8.4
- munch==2.5.0
- nbclient==0.6.4
- nbconvert==6.5.0
- nbformat==5.4.0
- nest-asyncio==1.5.5
- networkx==2.8.4
- notebook==6.4.12
- osgeo==0.0.1
- owslib==0.26.0
- packaging==21.3
- pandas==1.4.3
- pandocfilters==1.5.0
- parso==0.8.3
- pexpect==4.8.0
- pickleshare==0.7.5
- pillow==9.1.1
- pluggy==1.0.0
- ply==3.11
- prometheus-client==0.14.1
- prompt-toolkit==3.0.29
- psutil==5.9.1
- ptyprocess==0.7.0
- pure-eval==0.2.2
- py==1.11.0
- pyasn1==0.4.8
- pycodestyle==2.8.0
- pycparser==2.21
- pygments==2.12.0
- pyincore==1.4.2rc5
- pyomo==6.4.1
- pyparsing==3.0.9
- pyproj==3.2.1
- pyrsistent==0.18.1
- pytest==7.1.2
- python-dateutil==2.8.2
- python-jose==3.3.0
- pytz==2022.1
- pyyaml==6.0
- pyzmq==23.2.0
- rasterio==1.2.10
- requests==2.28.0
- rsa==4.8
- rtree==1.0.0
- scipy==1.8.1
- send2trash==1.8.0
- shapely==1.8.2
- six==1.16.0
- snuggs==1.4.7
- soupsieve==2.3.2.post1
- stack-data==0.3.0
- terminado==0.15.0
- tinycss2==1.1.1
- tomli==2.0.1
- tornado==6.1
- traitlets==5.3.0
- traittypes==0.2.1
- urllib3==1.26.9
- wcwidth==0.2.5
- webencodings==0.5.1
- widgetsnbextension==3.6.1
- wntr==0.4.2
- wrapt==1.14.1
- xyzservices==2022.6.0
41 changes: 20 additions & 21 deletions recipes/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,31 @@ requirements:
build:
- python>=3.6
- pip
- numpy 1.16
- numpy>=1.16

host:
- python>=3.6
- pip
- numpy 1.16
- numpy>=1.16

run:
- python>=3.6
- {{ pin_compatible('numpy') }}
- branca==0.3.1
- ipyleaflet<0.13.7,>=0.13.4
- ipywidgets<8,>=7.6.0
- pandas>=0.24.1
- geopandas>=0.6.1
- rasterio>=1.1.3
- descartes>=1.1.0
- contextily>=1.0.0
- numpy>=1.16.1
- scipy>=1.2.0
- networkx>=2.2
- owslib>=0.17.1
- matplotlib>=2.1.0
- plotly>=3.6.0
- pytest>=3.9.0
- lxml>=4.6.3
- palettable>=3.3.0
- mplcursors>=0.5.1
- pyincore>=1.0.0
- branca==0.5.0
- contextily==1.2.0
- deprecated==1.2.13
- geopandas==0.11.0
- ipyleaflet==0.16.0
- ipywidgets==7.7.1
- lxml==4.9.0
- matplotlib==3.5.2
- networkx==2.8.4
- osgeo==0.0.1
- owslib==0.26.0
- pandas==1.4.3
- pillow==9.1.1
- pyincore==1.4.2rc5
- rasterio==1.2.10

test:
# Python imports
Expand All @@ -62,6 +58,9 @@ test:
requires:
# Put any additional test requirements here. For example
- pytest>=3.9
- pycodestyle==2.8.0
- python-jose==3.3.0

commands:
# You can put built-in test commands to be run here. Use this to test that the entry points work.
python -c "import pyincore_viz; print('SUCCESS')" #; pyincore.test_client()"
Expand Down
19 changes: 19 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
branca
contextily
deprecated
geopandas
ipyleaflet
ipywidgets
lxml
matplotlib
networkx
numpy
osgeo
owslib
pandas
pillow
pyincore
rasterio
pycodestyle
pytest
python-jose
Loading

0 comments on commit 836edb6

Please sign in to comment.