Skip to content

Commit

Permalink
Merge c866c0f into 20af9a5
Browse files Browse the repository at this point in the history
  • Loading branch information
smmaurer committed Dec 8, 2020
2 parents 20af9a5 + c866c0f commit db83536
Show file tree
Hide file tree
Showing 13 changed files with 229 additions and 63 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/code-style.yml
@@ -0,0 +1,21 @@
name: Code style

# This workflow runs code style checks.

on:
push:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Check code style
run: |
pip install pycodestyle
pycodestyle pandana
33 changes: 33 additions & 0 deletions .github/workflows/coverage.yml
@@ -0,0 +1,33 @@
name: Coverage

# This workflow generates a coverage report (how much of the codebase is covered by the
# unit tests) and uploads the information to Coveralls.io for reporting and analysis.

on:
# push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Pandana
run: |
pip install .
pip install osmnet
- name: Run unit tests
run: |
pip install 'pytest<4.0' 'pytest-cov<2.10'
python setup.py test --pytest-args "--cov pandana --cov-report term-missing"
- name: Upload to Coveralls
run: |
pip install coveralls
coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/cross-compatibility.yml
@@ -0,0 +1,52 @@
name: Cross-compatibility

# This workflow runs the Pandana unit tests across a comprehensive range of Python
# versions and operating systems.

# TO DO: might be clearer to split this into a set of default-python builds and a set of
# conda-based builds -- see installation.yml for example. Windows needs conda in order to
# install geospatial dependencies.

on:
# push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
if: matrix.os != 'windows-latest'
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} (conda - for win)
if: matrix.os == 'windows-latest'
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install OSMnet
if: matrix.os != 'windows-latest'
run: |
pip install osmnet
- name: Install OSMnet (conda - for win)
if: matrix.os == 'windows-latest'
run: |
conda install osmnet --channel conda-forge
- name: Install Pandana from source code
run: |
pip install .
- name: Run demo
run: |
python examples/simple_example.py
- name: Run unit tests (skipped on windows)
if: matrix.os != 'windows-latest' # skipped because not passing at the moment
run: |
pip install 'pytest<4.0'
python setup.py test
58 changes: 58 additions & 0 deletions .github/workflows/installation.yml
@@ -0,0 +1,58 @@
name: Installation

# This workflow installs Pandana from Pip and Conda across a range of Python versions and
# operating systems. You can run this manually after a new release is posted to confirm
# that it installs smoothly. This workflow also runs periodically in the background to
# catch dependency updates that break Pandana.

on:
# push:
# pull_request:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1' # every Monday at 3am UTC (Sunday evening Calif time)

jobs:
build-pip:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# Pip installation for Windows is not supported. Pip installation for Mac is
# broken in the GitHub Actions environment with Pandana v0.6 but should be fixed
# in the next Pandana release.
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Pandana
run: |
pip install pandana
- name: Run demo
run: |
python examples/simple_example.py
build-conda:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0} # needed for conda persistence
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Pandana
run: |
conda install pandana --channel conda-forge
- name: Run demo
run: |
python examples/simple_example.py
28 changes: 28 additions & 0 deletions .github/workflows/unit-tests.yml
@@ -0,0 +1,28 @@
name: Unit tests

# This workflow runs the Pandana unit tests in a single generic environment (recent but
# stable Python version on recent but stable Ubuntu). The cross-compatibility.yml
# workflow runs the same tests across multiple platforms.

on:
push:
# pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Pandana
run: |
pip install .
pip install osmnet
- name: Run unit tests
run: |
pip install 'pytest<4.0'
python setup.py test
25 changes: 25 additions & 0 deletions .github/workflows/windows.yml
@@ -0,0 +1,25 @@
name: Windows tests

# This workflow runs the Pandana unit tests in Windows -- this is a one-off for debugging.

on:
# push:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
- name: Install Pandana
run: |
pip install .
pip install 'pytest<4.0'
conda install osmnet --channel conda-forge
- name: Run unit tests
run: |
python setup.py test
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

24 changes: 0 additions & 24 deletions appveyor.yml

This file was deleted.

4 changes: 2 additions & 2 deletions pandana/loaders/tests/test_osm.py
Expand Up @@ -2,7 +2,7 @@

import pandana
from pandana.loaders import osm
from pandana.testing import skipiftravis
from pandana.testing import skipifci


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -41,7 +41,7 @@ def test_process_node():
assert osm.process_node(test_node) == expected


@skipiftravis
@skipifci
def test_network_from_bbox(bbox2):
net = osm.pdna_network_from_bbox(*bbox2)
assert isinstance(net, pandana.Network)
Expand Down
14 changes: 7 additions & 7 deletions pandana/loaders/tests/test_pandash5.py
Expand Up @@ -6,7 +6,7 @@

import pandas.util.testing as pdt
from pandana import Network
from pandana.testing import skipiftravis
from pandana.testing import skipifci

from pandana.loaders import pandash5 as ph5

Expand Down Expand Up @@ -71,7 +71,7 @@ def cleanup():
return fname


@skipiftravis
@skipifci
def test_remove_nodes(network, rm_nodes):
# node 0 is connected to node 4, which is in turn connected to node 5
# node 7 is connected to node 11, which has no other connections
Expand All @@ -96,7 +96,7 @@ def test_remove_nodes(network, rm_nodes):
pdt.assert_frame_equal(edges, exp_edges)


@skipiftravis
@skipifci
def test_network_to_pandas_hdf5(
tmpfile, network, nodes, edges_df, impedance_names, two_way):
ph5.network_to_pandas_hdf5(network, tmpfile)
Expand All @@ -110,7 +110,7 @@ def test_network_to_pandas_hdf5(
store['impedance_names'], pd.Series(impedance_names))


@skipiftravis
@skipifci
def test_network_to_pandas_hdf5_removal(
tmpfile, network, impedance_names, two_way, rm_nodes):
nodes, edges = ph5.remove_nodes(network, rm_nodes)
Expand All @@ -125,7 +125,7 @@ def test_network_to_pandas_hdf5_removal(
store['impedance_names'], pd.Series(impedance_names))


@skipiftravis
@skipifci
def test_network_from_pandas_hdf5(
tmpfile, network, nodes, edges_df, impedance_names, two_way):
ph5.network_to_pandas_hdf5(network, tmpfile)
Expand All @@ -137,7 +137,7 @@ def test_network_from_pandas_hdf5(
assert new_net.impedance_names == impedance_names


@skipiftravis
@skipifci
def test_network_save_load_hdf5(
tmpfile, network, impedance_names, two_way, rm_nodes):
network.save_hdf5(tmpfile, rm_nodes)
Expand All @@ -153,7 +153,7 @@ def test_network_save_load_hdf5(

# this is an odd place for this test because it's not related to HDF5,
# but my test Network is perfect.
@skipiftravis
@skipifci
def test_network_low_connectivity_nodes(network, impedance_names):
nodes = network.low_connectivity_nodes(10, 3, imp_name=impedance_names[0])
assert list(nodes) == [7, 11]
4 changes: 2 additions & 2 deletions pandana/testing.py
Expand Up @@ -2,5 +2,5 @@

import pytest

skipiftravis = pytest.mark.skipif(
os.environ.get('TRAVIS') == 'true', reason='skip on Travis-CI')
skipifci = pytest.mark.skipif(
os.environ.get('CI') == 'true', reason='skip on CI')
2 changes: 1 addition & 1 deletion pandana/tests/test_pandana.py
Expand Up @@ -5,7 +5,7 @@
import pandas as pd
import pytest
from pandas.util import testing as pdt
from pandana.testing import skipiftravis
from pandana.testing import skipifci

import pandana.network as pdna

Expand Down
5 changes: 0 additions & 5 deletions setup.py
Expand Up @@ -59,11 +59,6 @@ def run(self):

if sys.platform.startswith('darwin'): # Mac

# This environment variable sets the earliest OS version that the compiled
# code will be compatible with. In certain contexts the default is too old
# to allow using libc++; supporting OS X 10.9 and later seems reasonable
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

extra_compile_args += ['-D NO_TR1_MEMORY', '-stdlib=libc++']
extra_link_args += ['-stdlib=libc++']

Expand Down

0 comments on commit db83536

Please sign in to comment.