diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 086c8f1bb..56b1cb294 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -3,6 +3,25 @@ name: Build on: [pull_request] jobs: + make_sdist: + name: Make SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build SDist + run: pipx run build --sdist + +# - name: Test if SDist build has all necessary pieces to be installed +# run: | +# pip3 install setuptools build --upgrade +# pip3 install dist/*.tar.gz + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -27,20 +46,6 @@ jobs: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl - make_sdist: - name: Make SDist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Build SDist - run: pipx run build --sdist - - - uses: actions/upload-artifact@v4 - with: - name: cibw-sdist - path: dist/*.tar.gz - upload_all: needs: [build_wheels, make_sdist] environment: pypi diff --git a/.github/workflows/debug_tests.yml b/.github/workflows/debug_tests.yml deleted file mode 100644 index ba348322d..000000000 --- a/.github/workflows/debug_tests.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Run tests for debugging sigabrt - -on: [pull_request] - -jobs: - - testing: - runs-on: ubuntu-20.04 - container: python:3.9 - steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r tests/requirements_tests.txt - - - name: Download spatialite on Linux - run: | - apt-get update - apt-get install -y libsqlite3-mod-spatialite - - - name: Build - run: | - pip install -e . - - - name: Runs test - run: python -m pytest diff --git a/__version__.py b/__version__.py deleted file mode 100644 index 4bba33e8e..000000000 --- a/__version__.py +++ /dev/null @@ -1,5 +0,0 @@ -# When updating the version, one must also update the docs/source/_static/switcher.json file -version = 1.1 -minor_version = "0" - -release_version = f"{version}.{minor_version}" diff --git a/aequilibrae/distribution/ipf_core.pyx b/aequilibrae/distribution/cython/ipf_core.pyx similarity index 100% rename from aequilibrae/distribution/ipf_core.pyx rename to aequilibrae/distribution/cython/ipf_core.pyx diff --git a/aequilibrae/utils/python_signal.py b/aequilibrae/utils/python_signal.py index e0298ba1a..25b7b7da0 100644 --- a/aequilibrae/utils/python_signal.py +++ b/aequilibrae/utils/python_signal.py @@ -1,4 +1,5 @@ import importlib.util as iutil +import os import warnings from random import choice @@ -13,8 +14,7 @@ qgis = iutil.find_spec("qgis") is not None -if missing_tqdm and not qgis: - warnings.warn("No progress bars will be shown. Please install tqdm to see them") +show_status = os.environ.get("AEQ_SHOW_PROGRESS", "FALSE") == "TRUE" class PythonSignal: # type: ignore @@ -28,23 +28,26 @@ class PythonSignal: # type: ignore ['action', 'bar hierarchy', 'value', 'text', 'master'] 'action': 'start', 'update', or 'finished_*_processing' (the last one applies in QGIS) - 'bar hierarchy': 'master' or 'secondary' + 'position': Position (0 for top, 1 for bottom) 'value': Numerical value for the action (total or current) 'text': Whatever label to be updated 'master': The corresponding master bar for this task """ - deactivate = missing_tqdm # by default don't use progress bars in tests + deactivate = not show_status # by default don't use progress bars in tests def __init__(self, object): self.color = choice(["green", "magenta", "cyan", "blue", "red", "yellow"]) self.pbar = None # type: tqdm self.keydata = {} - self.pos = 0 + self.position = 0 def emit(self, val): if self.deactivate: return + if val[0] == "set_position": + self.position = val[1] + if val[0] == "finished": if self.pbar is not None: self.pbar.close() @@ -61,10 +64,13 @@ def emit(self, val): self.keydata[val[1]] = val[2] elif val[0] == "start": + if missing_tqdm and not qgis: + self.deactivate = True + warnings.warn("No progress bars will be shown. Please install tqdm to see them") if self.pbar is not None: self.pbar.close() desc = str(val[2]).rjust(50) - self.pbar = tqdm(total=val[1], colour=self.color, leave=False, desc=desc, position=self.pos) + self.pbar = tqdm(total=val[1], colour=self.color, leave=False, desc=desc, position=self.position) elif val[0] == "update": self.pbar.update(val[1] - self.pbar.n) @@ -72,3 +78,8 @@ def emit(self, val): desc = str(val[2]).rjust(50) if self.pbar.desc != desc: self.pbar.set_description(desc, refresh=True) + + elif val[0] == "set_text": + desc = str(val[1]).rjust(50) + if self.pbar.desc != desc: + self.pbar.set_description(desc, refresh=True) diff --git a/aequilibrae/utils/signal.py b/aequilibrae/utils/signal.py index 7e5b19964..a5a467030 100644 --- a/aequilibrae/utils/signal.py +++ b/aequilibrae/utils/signal.py @@ -5,7 +5,7 @@ def noop(_): pass -if iutil.find_spec("PyQt5") is not None: +if iutil.find_spec("qgis") is not None: from PyQt5.QtCore import pyqtSignal as SIGNAL # type: ignore noop(SIGNAL.__class__) # This should be no-op but it stops PyCharm from "optimising" the above import diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index ba9bee28b..2d44139ef 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,7 +1,3 @@ -numpy<1.99 -pyaml -pyshp -cython enum34 Sphinx pydata-sphinx-theme==0.13.3 diff --git a/docs/source/_static/switcher.json b/docs/source/_static/switcher.json index 18523ecb4..0e090b25d 100644 --- a/docs/source/_static/switcher.json +++ b/docs/source/_static/switcher.json @@ -4,16 +4,16 @@ "version": "develop", "url": "https://aequilibrae.com/python/develop/" }, + { + "name": "1.1.1", + "version": "1.1.1", + "url": "https://aequilibrae.com/python/V.1.1.1/" + }, { "name": "1.1.0", "version": "1.1.0", "url": "https://aequilibrae.com/python/V.1.1.0/" }, - { - "name": "1.0.2", - "version": "1.0.2", - "url": "https://aequilibrae.com/python/V.1.0.2/" - }, { "name": "1.0.1", "version": "1.0.1", diff --git a/docs/source/conf.py b/docs/source/conf.py index d45471e02..c62812031 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,6 +17,7 @@ from datetime import datetime from pathlib import Path from sphinx_gallery.sorting import ExplicitOrder +import pkg_resources project_dir = Path(__file__).parent.parent.parent if str(project_dir) not in sys.path: @@ -27,7 +28,7 @@ if str(project_dir) not in sys.path: sys.path.insert(0, project_dir) -from __version__ import release_version +release_version = pkg_resources.get_distribution("aequilibrae").version # -- Project information ----------------------------------------------------- diff --git a/docs/website/check_documentation_versions.py b/docs/website/check_documentation_versions.py index d71b116e7..e7cbf6354 100644 --- a/docs/website/check_documentation_versions.py +++ b/docs/website/check_documentation_versions.py @@ -1,14 +1,14 @@ import os import sys from pathlib import Path +import pkg_resources npth = Path(__file__).parent.parent.parent if npth not in sys.path: sys.path.append(npth) print(npth) -with open(npth / "__version__.py") as f: - exec(f.read()) +release_version = pkg_resources.get_distribution("aequilibrae").version # We check if the reference to all existing versions were added by checking # that the current version is referenced diff --git a/docs/website/redir.py b/docs/website/redir.py index c26694889..1633cd0d6 100644 --- a/docs/website/redir.py +++ b/docs/website/redir.py @@ -1,13 +1,13 @@ import os import sys import shutil +import pkg_resources npth = os.path.abspath(".") if npth not in sys.path: sys.path.append(npth) -from __version__ import release_version - +release_version = pkg_resources.get_distribution("aequilibrae").version version = f"V.{release_version}" diff --git a/setup.py b/setup.py index 955ee9859..eb7b69f82 100644 --- a/setup.py +++ b/setup.py @@ -9,8 +9,11 @@ from setuptools import setup, find_packages from setuptools.discovery import FlatLayoutPackageFinder -with open("__version__.py") as f: - exec(f.read()) +# When updating the version, one must also update the docs/source/_static/switcher.json file +version = 1.1 +minor_version = 1 + +release_version = f"{version}.{minor_version}" include_dirs = [np.get_include()] libraries = [] @@ -45,7 +48,7 @@ ext_mod_ipf = Extension( "aequilibrae.distribution.ipf_core", - [join("aequilibrae", "distribution", "ipf_core.pyx")], + [join("aequilibrae", "distribution", "cython", "ipf_core.pyx")], **extension_args, ) @@ -98,9 +101,10 @@ pkg_data = { "aequilibrae.reference_files": ["spatialite.sqlite", "nauru.zip", "sioux_falls.zip", "coquimbo.zip"], - "aequilibrae.paths": ["parameters.pxi", "*.pyx"], - "aequilibrae.distribution": ["*.pyx"], - "aequilibrae": ["./parameters.yml"], + "aequilibrae.paths": ["cython/*.pxi", "cython/*.pyx", "cython/*.pxd"], + "aequilibrae.distribution": ["cython/*.pyx"], + "aequilibrae.matrix": ["*.pyx", "*.pxd"], + "aequilibrae": ["./parameters.yml", "../requirements.txt"], "aequilibrae.project": [ "database_specification/network/tables/*.*", "database_specification/network/triggers/*.*",