Skip to content

Commit

Permalink
Release candidate (#361)
Browse files Browse the repository at this point in the history
* Upgrades Numpy version (#353)

* Limits pyarrow version

* Makes PyArrow an optional dependency (#356)

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>

* Update setup.py (#357)

* Bumps up version

* Updates setup

* Sets version for AequilibraE

* Fixes packaging (#362)


Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>
Co-authored-by: djfrancesco <pacullfrancois@gmail.com>

* Fix: #365 Use specified number of cores (#366)

* Fix skim cost calculation on compact graph (#367)

When skimming the network using the compact graph the last link (within
the dataframe) was being ignored.
Co-authored-by: chrisobi02 <chrisgobrien02@gmail.com>
Co-authored-by: Jamie Cook <jamie.cook@veitchlister.com.au>
Co-authored-by: djfrancesco <pacullfrancois@gmail.com>
Co-authored-by: Jake Moss <jake.moss@uqconnect.edu.au>
  • Loading branch information
6 people committed Nov 29, 2022
1 parent 9671d29 commit a24a8e0
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Compile library
run: |
cd aequilibrae/paths
python3 setup_Assignment.py build_ext --inplace
python3 setup_assignment.py build_ext --inplace
cd ..
cd ..
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Compile library
run: |
cd aequilibrae/paths
python setup_Assignment.py build_ext --inplace
python setup_assignment.py build_ext --inplace
cd ..
cd ..
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Compile library
run: |
cd aequilibrae/paths
python3 setup_Assignment.py build_ext --inplace
python3 setup_assignment.py build_ext --inplace
cd ..
cd ..
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_linux_with_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Compile library
run: |
cd aequilibrae/paths
python3 setup_Assignment.py build_ext --inplace
python3 setup_assignment.py build_ext --inplace
cd ..
cd ..
- name: Generate coverage report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Compile library
run: |
cd aequilibrae/paths
python setup_Assignment.py build_ext --inplace
python setup_assignment.py build_ext --inplace
cd ../..
- name: Build
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
global-include *.pyx
global-include *.pxd
2 changes: 0 additions & 2 deletions aequilibrae/distribution/gravity_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from aequilibrae.distribution.synthetic_gravity_model import SyntheticGravityModel
from aequilibrae.matrix import AequilibraeMatrix, AequilibraeData

sys.dont_write_bytecode = True

spec = iutil.find_spec("openmatrix")
has_omx = spec is not None

Expand Down
8 changes: 4 additions & 4 deletions aequilibrae/paths/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ def set_graph(self, cost_field) -> None:
"""
if cost_field in self.graph.columns:
self.cost_field = cost_field
self.compact_cost = np.zeros(self.compact_graph.id.max() + 1, self.__float_type)
self.compact_cost = np.zeros(self.compact_graph.id.max() + 2, self.__float_type)
df = self.__graph_groupby.sum()[[cost_field]].reset_index()
self.compact_cost[df.index.values[:-1]] = df[cost_field].values[:-1]
self.compact_cost[df.index.values] = df[cost_field].values
if self.graph[cost_field].dtype == self.__float_type:
self.cost = np.array(self.graph[cost_field].values, copy=True)
else:
Expand Down Expand Up @@ -475,10 +475,10 @@ def set_skimming(self, skim_fields: list) -> None:
if k:
raise ValueError("At least one of the skim fields does not exist in the graph: {}".format(",".join(k)))

self.compact_skims = np.zeros((self.compact_num_links, len(skim_fields) + 1), self.__float_type)
self.compact_skims = np.zeros((self.compact_num_links + 1, len(skim_fields) + 1), self.__float_type)
df = self.__graph_groupby.sum()[skim_fields].reset_index()
for i, skm in enumerate(skim_fields):
self.compact_skims[df.index.values[:-1], i] = df[skm].values[:-1].astype(self.__float_type)
self.compact_skims[df.index.values, i] = df[skm].values.astype(self.__float_type)

self.skims = np.zeros((self.num_links, len(skim_fields) + 1), self.__float_type)
t = [x for x in skim_fields if self.graph[x].dtype != self.__float_type]
Expand Down
2 changes: 1 addition & 1 deletion aequilibrae/paths/parameters.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ cdef double INFINITE = 1.79769313e+308

VERSION = 0.7
MINOR_VRSN = 6
binary_version = "0.7.6"
binary_version = "0.7.7"
release_name = "Queluz"
2 changes: 1 addition & 1 deletion aequilibrae/paths/results/skim_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def set_cores(self, cores: int) -> None:
if cores == 0:
self.cores = mp.cpu_count()
elif cores > 0:
cores = max(mp.cpu_count(), cores)
cores = min(mp.cpu_count(), cores)
if self.cores != cores:
self.cores = cores
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import sys
import platform

import numpy as np
import pyarrow as pa
import Cython.Compiler.Options
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import shutil

# Cython.Compiler.Options.annotate = True

try:
from setuptools import setup
Expand All @@ -16,15 +11,14 @@
from distutils.core import setup
from distutils.extension import Extension

sys.dont_write_bytecode = True

if "WINDOWS" in platform.platform().upper():
ext_modules = [
Extension(
"AoN",
["AoN.pyx"],
extra_compile_args=["/openmp"],
extra_link_args=["/openmp"],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
include_dirs=[np.get_include(), pa.get_include()],
)
]
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ documentation for all versions since 0.5.3.
* `0.7.4 <https://aequilibrae.com/python/V.0.7.4/>`_
* `0.7.5 <https://aequilibrae.com/python/V.0.7.5/>`_
* `0.7.6 <https://aequilibrae.com/python/V.0.7.6/>`_
* `0.7.7 <https://aequilibrae.com/python/V.0.7.7/>`_

* `Develop Branch (upcoming version) <https://aequilibrae.com/python/develop/>`_
This documentation correspond to software version:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ target-version = ['py36', 'py37', 'py38']
include = '\.pyi?$'

[build-system]
requires = ["setuptools", "numpy<1.22", "cython", "pyaml", "pyqt5", "requests", "scipy", "shapely", "pandas", "pyarrow<10.0.0", "pyproj"]
requires = ["setuptools", "numpy<1.22", "cython", "pyaml", "pyqt5", "requests", "scipy", "shapely", "pandas", "pyarrow<10.0.0", "pyproj", "wheel"]
25 changes: 18 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import importlib.util as iutil
import os
import platform
from os.path import dirname, join
from os.path import dirname, join, isfile

import numpy as np
from Cython.Distutils import build_ext
Expand All @@ -19,21 +19,32 @@
include_dirs.append(pa.get_include())

whole_path = join(dirname(os.path.realpath(__file__)), "aequilibrae/paths", "AoN.pyx")
ext_module = Extension("aequilibrae.paths.AoN", [whole_path], include_dirs=include_dirs, language="c++")
ext_module = Extension(
"aequilibrae.paths.AoN",
[whole_path],
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
include_dirs=include_dirs,
language="c++",
)

# this is for building pyarrow on platforms w/o wheel, like our one of our macos/python combos
if "WINDOWS" not in platform.platform().upper():
ext_module.extra_compile_args.append("-std=c++17")

with open("requirements.txt", "r") as fl:
install_requirements = [x.strip() for x in fl.readlines()]
reqs = ["numpy>=1.18.0,<1.22", "scipy", "pyaml", "cython", "pyshp", "requests", "shapely >= 1.7.0", "pandas", "pyproj"]

if isfile("requirements.txt"):
# We just make sure to keep the requirements sync'ed with the setup file
with open("requirements.txt", "r") as fl:
install_requirements = [x.strip() for x in fl.readlines()]
assert sorted(install_requirements) == sorted(reqs)

pkgs = [pkg for pkg in find_packages()]

pkg_data = {
"aequilibrae.reference_files": ["spatialite.sqlite", "nauru.zip", "sioux_falls.zip"],
"aequilibrae.paths": ["parameters.pxi"],
"aequilibrae": ["parameters.yml"],
"aequilibrae.paths": ["parameters.pxi", "*.pyx"],
"aequilibrae": ["./parameters.yml"],
"aequilibrae.project": ["database_specification/tables/*.*", "database_specification/triggers/*.*"],
}
loose_modules = ["__version__", "parameters"]
Expand All @@ -43,7 +54,7 @@
name="aequilibrae",
version=release_version,
# TODO: Fix the requirements and optional requirements to bring directly from the requirements file
install_requires=install_requirements,
install_requires=reqs,
packages=pkgs,
package_dir={"": "."},
py_modules=loose_modules,
Expand Down
2 changes: 1 addition & 1 deletion tests/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

os.chdir(pth)
subprocess.Popen(
f"{sys.executable} setup_Assignment.py build_ext --inplace", shell=True, stdout=subprocess.PIPE
f"{sys.executable} setup_assignment.py build_ext --inplace", shell=True, stdout=subprocess.PIPE
).stdout.read()

0 comments on commit a24a8e0

Please sign in to comment.