Skip to content

Commit

Permalink
Importing structure for building (#111)
Browse files Browse the repository at this point in the history
* Importing structure for building

* cleans tests

* Windows testing (#113)

test updating and new workflows for Windows testing and build

* changes for comments

* changes for comments
  • Loading branch information
pedrocamargo authored Mar 17, 2020
1 parent d77ddff commit d8a9b55
Show file tree
Hide file tree
Showing 30 changed files with 275 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install numpy cython pyaml pyqt5 pyshp scipy
choco install visualstudio2019community
choco install -y microsoft-build-tools visualcppbuildtools --version 14.0.25420.1
pip install setuptools
pip install -r requirements.txt
pip install wheel twine
- name: Compile library
run: |
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/build_windows32.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Upload Windows Python Package

on:
release:
types: [prereleased, published]

jobs:
deploy:
runs-on: windows-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x86

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install -r requirements.txt
pip install wheel twine
- name: Compile library
run: |
cd aequilibrae/paths
python setup_Assignment.py build_ext --inplace
cd ..
cd ..
- name: Build
run: python setup.py sdist bdist_wheel

- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*.whl
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
max-parallel: 4
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentationDev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
max-parallel: 4
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_build_linux.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Upload Linux Python Package
name: Test building Linux Package

on: [pull_request]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_build_mac.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload MacOS Python Package
name: Test building MacOS Package

on: [pull_request]

Expand All @@ -10,7 +10,7 @@ jobs:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test_build_windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload Windows Python Package
name: Test building Windows Package

on: [pull_request]

Expand All @@ -9,19 +9,19 @@ jobs:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install numpy cython pyaml pyqt5 pyshp scipy
choco install visualstudio2019community
choco install -y microsoft-build-tools visualcppbuildtools --version 14.0.25420.1
pip install setuptools
pip install -r requirements.txt
pip install wheel
- name: Compile library
run: |
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test_build_windows32.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test building Windows 32 bits Package

on: [pull_request]

jobs:
deploy:
runs-on: windows-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x86

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install -r requirements.txt
pip install wheel
- name: Compile library
run: |
cd aequilibrae/paths
python setup_Assignment.py build_ext --inplace
cd ..
cd ..
- name: Build
run: python setup.py sdist bdist_wheel
41 changes: 41 additions & 0 deletions .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests on Windows

on: [pull_request]

jobs:
testing:
runs-on: windows-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools
pip install -r requirements.txt
pip install pytest
- name: Download spatialite
run: |
cd tests
python setup_windows_spatialite.py
cd ..
- name: Compile library
run: |
cd aequilibrae/paths
python setup_Assignment.py build_ext --inplace
cd ..
cd ..
- name: Runs test
run: |
python -m pytest
2 changes: 1 addition & 1 deletion .github/workflows/upload_tar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
python-version: [ '3.7' ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set Python environment
uses: actions/setup-python@v1
with:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,9 @@ docs/source/_generated/*


#Virtual environment
.venv/

.venv/
# Test files
tests/*.aem
tests/*.csv
tests/*.omx
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ AequilibraE

.. image:: https://github.com/AequilibraE/aequilibrae/workflows/Tests%20Python%203.7/badge.svg
:target: https://github.com/AequilibraE/aequilibrae/workflows/Tests%20Python%203.7/badge.svg
:alt: Unit tests
:alt: Linux Unit tests

.. image:: https://github.com/AequilibraE/aequilibrae/workflows/Tests%20on%20Windows/badge.svg
:target: https://github.com/AequilibraE/aequilibrae/workflows/Tests%20on%20Windows/badge.svg
:alt: Windows Unit tests

.. image:: https://codecov.io/gh/AequilibraE/aequilibrae/branch/master/graph/badge.svg
:target: https://codecov.io/gh/AequilibraE/aequilibrae
Expand Down
9 changes: 7 additions & 2 deletions aequilibrae/paths/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from aequilibrae.paths.AoN import one_to_all, skimming_single_origin, path_computation, VERSION_COMPILED, \
update_path_trace
from aequilibrae.paths.results import *
from aequilibrae.paths.multi_threaded_aon import MultiThreadedAoN
from aequilibrae.paths.multi_threaded_skimming import MultiThreadedNetworkSkimming
Expand All @@ -10,3 +8,10 @@
from aequilibrae.paths.vdf import VDF
from aequilibrae.paths.graph import Graph
from .__version__ import binary_version, release_name, minor_version, release_version
from aequilibrae import logger

try:
from aequilibrae.paths.AoN import one_to_all, skimming_single_origin, path_computation, VERSION_COMPILED, \
update_path_trace
except ImportError as ie:
logger.warn(f'Could not import procedures from the binary. {ie.args}')
8 changes: 6 additions & 2 deletions aequilibrae/paths/all_or_nothing.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import importlib.util as iutil
import threading
from multiprocessing.dummy import Pool as ThreadPool

import numpy as np

from .AoN import one_to_all
from .multi_threaded_aon import MultiThreadedAoN
from ..utils import WorkerThread
from aequilibrae.matrix import AequilibraeMatrix
from aequilibrae import logger

try:
from aequilibrae.paths.AoN import one_to_all
except ImportError as ie:
logger.warn(f'Could not import procedures from the binary. {ie.args}')

spec = iutil.find_spec("PyQt5")
pyqt = spec is not None
Expand Down
14 changes: 11 additions & 3 deletions aequilibrae/paths/linear_approximation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@
from aequilibrae.paths.traffic_class import TrafficClass
from aequilibrae.paths.results import AssignmentResults
from aequilibrae.paths.all_or_nothing import allOrNothing
from aequilibrae.paths.AoN import linear_combination, linear_combination_skims
from aequilibrae.paths.AoN import triple_linear_combination, triple_linear_combination_skims
from aequilibrae.paths.AoN import copy_one_dimension, copy_two_dimensions, copy_three_dimensions
from aequilibrae import logger

try:
from aequilibrae.paths.AoN import linear_combination, linear_combination_skims
from aequilibrae.paths.AoN import triple_linear_combination, triple_linear_combination_skims
from aequilibrae.paths.AoN import copy_one_dimension, copy_two_dimensions, copy_three_dimensions
except ImportError as ie:
logger.warn(f'Could not import procedures from the binary. {ie.args}')

import scipy

if int(scipy.__version__.split('.')[1]) >= 3:
from scipy.optimize import root_scalar

recent_scipy = True
else:
from scipy.optimize import root as root_scalar

recent_scipy = False
logger.warn(f"Using older version of Scipy. For better performance, use Scipy >= 1.4")

Expand Down
8 changes: 6 additions & 2 deletions aequilibrae/paths/network_skimming.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import sys
import threading
from multiprocessing.dummy import Pool as ThreadPool

from .AoN import skimming_single_origin
from .multi_threaded_skimming import MultiThreadedNetworkSkimming
from ..utils import WorkerThread
import importlib.util as iutil
from aequilibrae import logger

try:
from aequilibrae.paths.AoN import skimming_single_origin
except ImportError as ie:
logger.warn(f'Could not import procedures from the binary. {ie.args}')

spec = iutil.find_spec("PyQt5")
pyqt = spec is not None
Expand Down
8 changes: 7 additions & 1 deletion aequilibrae/paths/results/assignment_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
import warnings
from aequilibrae.matrix import AequilibraeMatrix, AequilibraeData
from aequilibrae.paths.graph import Graph
from aequilibrae.paths.AoN import sum_axis1
from aequilibrae.parameters import Parameters
from aequilibrae import logger

try:
from aequilibrae.paths.AoN import sum_axis1
except ImportError as ie:
logger.warn(f'Could not import procedures from the binary. {ie.args}')

"""
TO-DO:
Expand All @@ -18,6 +23,7 @@ class AssignmentResults:
"""
Assignment result holder for a single :obj:`TrafficClass` with multiple user classes
"""

def __init__(self):
self.link_loads = None # type: np.array # The actual results for assignment
self.total_link_loads = None # type: np.array # The result of the assignment for all user classes summed
Expand Down
Loading

0 comments on commit d8a9b55

Please sign in to comment.