diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..12a4b24 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +ignore = E203, E266, W503, F403, F401 +max-line-length = 88 +max-complexity = 18 +select = B,C,E,F,W,T4,B9 \ No newline at end of file diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..bee7907 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,29 @@ +name: Quality +on: + pull_request: + branches: [ "main" ] + workflow_call: +permissions: + contents: read +jobs: + quality: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + - name: Install poetry + run: pipx install poetry + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: 'poetry' + - name: Install dependencies + run: poetry install --with dev + - name: Lint with flake8 + run: | + poetry run flake8 src + poetry run flake8 tests + - name: Running license check + run: poetry run licensecheck --zero --license mit --ignore-packages trackml qallse diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ed3f8f3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: +- repo: https://github.com/psf/black + rev: 24.10.0 + hooks: + - id: black + # language_version: python3.10 +# - repo: https://github.com/PyCQA/flake8 +# rev: 6.0.0 +# hooks: +# - id: flake8 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9391e4f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,48 @@ +# Contributing to From Hope to Heuristics + +Contributions are highly welcome! :hugging_face: + +Start of by.. +1. Creating an issue using one of the templates (Bug Report, Feature Request) + - let's discuss what's going wrong or what should be added + - can you contribute with code? Great! Go ahead! :rocket: +2. Forking the repository and working on your stuff. See the sections below for details on how to set things up. +3. Creating a pull request to the main repository + +## Setup + +Contributing to this project requires some more dependencies besides the "standard" packages. +Those are specified in the groups `dev` and `docs`. +``` +poetry install --with dev,docs +``` + +Additionally, we have pre-commit hooks in place, which can be installed as follows: +``` +poetry run pre-commit autoupdate +poetry run pre-commit install +``` + +Currently the only purpose of the hook is to run Black on commit which will do some code formatting for you. +However be aware, that this might reject your commit and you have to re-do the commit. + +## Testing + +We do our testing with Pytest. Corresponding tests can be triggered as follows: +``` +poetry run pytest +``` +There are Github action pipelines in place, that will do linting and testing once you open a pull request. +However, it's a good idea to run tests and linting (either Black or Flake8) locally before pushing. + +## Documentation + +We use MkDocs for our documentation. To run a server locally, run: +``` +poetry run mkdocs serve +``` +This will automatically trigger a rebuild each time you make changes. +See the [MkDocs Documentation](https://cirkiters.github.io/qml-essentials/usage/) for more details. + +Publishing (and building) the documentation is done automagically using Github actions. +This action is triggered when a new release is made. \ No newline at end of file diff --git a/README.md b/README.md index 2a42af9..750c850 100644 --- a/README.md +++ b/README.md @@ -63,3 +63,7 @@ The following list gives a brief explanation of the most important locations in Besides that, we make use of two submodules: - `hepqpr-qallse`: Currently, all the data loading and QUBO formulation is done using this submodule - `trackml-library`: Not in use currently + +## 🚧 Contributing + +Contributions are highly welcome! Take a look at our [Contribution Guidelines](https://github.com/cirKITers/qml-essentials/blob/main/CONTRIBUTING.md). \ No newline at end of file diff --git a/hepqpr-qallse b/hepqpr-qallse index 6991ca6..d0518a0 160000 --- a/hepqpr-qallse +++ b/hepqpr-qallse @@ -1 +1 @@ -Subproject commit 6991ca657fc8d3298c60335ea489e9585a187284 +Subproject commit d0518a09d5848be12822c7cd26782a85e6bca26b diff --git a/main.py b/main.py deleted file mode 100644 index 2647d05..0000000 --- a/main.py +++ /dev/null @@ -1,165 +0,0 @@ -from typing import Iterable -import numpy as np -import sys -from datetime import datetime - -from qallse.data_wrapper import DataWrapper - -from fromhopetoheuristics.utils.spectral_gap_calculator import calculate_spectral_gap -from fromhopetoheuristics.utils.maxcut_utils import provide_random_maxcut_QUBO -from fromhopetoheuristics.utils.track_reconstruction_utils import provide_track_reconstruction_QUBO -from fromhopetoheuristics.utils.data_utils import create_dataset_track_reconstruction, save_to_csv -import logging - -logging.basicConfig() -logger = logging.getLogger(__file__) -logger.setLevel(logging.DEBUG) - - -def track_reconstruction( - dw: DataWrapper, - seed: int, - fractions: Iterable[float], - result_path_prefix: str, - data_path: str, - geometric_index: int = 0, - include_header: bool = True, -): - csv_data_list = [] - if include_header: - csv_data_list.append( - [ - "problem", - "num_qubits", - "geometric_index", - "seed", - "fraction", - "gs", - "fes", - "gap", - ] - ) - qubo = provide_track_reconstruction_QUBO(dw, data_path, geometric_index) - - if qubo is None: - return - - for fraction in fractions: - gs_energy, fes_energy, gap = calculate_spectral_gap( - fraction, - qubo, - ) - csv_data_list.append( - [ - "track reconstruction", - len(qubo), - geometric_index, - seed, - np.round(fraction, 2), - gs_energy, - fes_energy, - gap, - ] - ) - - for csv_data in csv_data_list: - save_to_csv(csv_data, result_path_prefix, "spectral_gap_evolution.csv") - - -def maxcut( - num_qubits: int, - density: float, - seed: int, - fractions: Iterable[float], - result_path_prefix: str, - include_header: bool = True, -): - csv_data_list = [] - if include_header: - csv_data_list.append( - [ - "problem", - "num_qubits", - "density", - "seed", - "fraction", - "gs", - "fes", - "gap", - ] - ) - - qubo = provide_random_maxcut_QUBO(num_qubits, density, seed) - - for fraction in fractions: - gs_energy, fes_energy, gap = calculate_spectral_gap(fraction, qubo) - csv_data_list.append( - [ - "maxcut", - num_qubits, - density, - seed, - np.round(fraction, 2), - gs_energy, - fes_energy, - gap, - ] - ) - - for csv_data in csv_data_list: - save_to_csv( - csv_data, - result_path_prefix, - "spectral_gap_evolution.csv", - ) - - -if __name__ == "__main__": - problem = "" - if len(sys.argv) > 2: - exit("Usage: python main.py [m|t] (m=maxcut, t=track reconstruction)") - elif len(sys.argv) == 1: - problem = "m" - elif sys.argv[1] not in ["m", "t"]: - exit( - f"Invalid option {sys.argv[1]} \n" - "Usage: python main.py [m|t] (m=maxcut, t=track reconstruction)" - ) - - first = True - fractions = np.linspace(0, 1, num=11, endpoint=True) - time_stamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S") - - if problem == "m": - seed = 777 - result_path_prefix = f"results/MAXCUT/{time_stamp}" - for n in range(4, 11): - for density in np.linspace(0.5, 1, num=6, endpoint=True): - maxcut( - n, - density, - seed, - fractions, - result_path_prefix, - include_header=first, - ) - first = False - else: - seed = 12345 - result_path_prefix = f"results/TR/{time_stamp}" - - dw, data_path = create_dataset_track_reconstruction( - result_path_prefix, seed - ) - - for i in range(64): - track_reconstruction( - dw, - seed, - fractions, - result_path_prefix, - data_path, - geometric_index = i, - include_header=first, - ) - first = False diff --git a/main_qaoa.py b/main_qaoa.py deleted file mode 100644 index 62cf8f3..0000000 --- a/main_qaoa.py +++ /dev/null @@ -1,221 +0,0 @@ -from typing import Iterable -import numpy as np -from datetime import datetime -import sys - -from qallse.data_wrapper import DataWrapper - -from fromhopetoheuristics.utils.data_utils import create_dataset_track_reconstruction, save_to_csv -from fromhopetoheuristics.utils.maxcut_utils import provide_random_maxcut_QUBO -from fromhopetoheuristics.utils.track_reconstruction_utils import provide_track_reconstruction_QUBO -from fromhopetoheuristics.utils.qaoa_utils import annealing_schedule_from_QAOA_params, compute_min_energy_solution, solve_QUBO_with_QAOA -import logging - -logging.basicConfig() -logger = logging.getLogger(__file__) -logger.setLevel(logging.DEBUG) - - -def track_reconstruction_QAOA( - dw: DataWrapper, - seed: int, - result_path_prefix: str, - data_path: str, - geometric_index: int = 0, - include_header: bool = True, - max_p=20, -): - if include_header: - header_content = [ - "problem", - "num_qubits", - "geometric_index", - "seed", - "energy", - "optimal_energy", - "optimal_solution", - "p", - "q", - ] - - for s in ["beta", "gamma", "u", "v"]: - header_content.extend([f"{s}{i+1:02d}" for i in range(max_p)]) - - save_to_csv(header_content, result_path_prefix, "solution.csv") - - qubo = provide_track_reconstruction_QUBO(dw, data_path, geometric_index) - - if qubo is None: - return - - min_energy, opt_var_assignment = compute_min_energy_solution(qubo) - - for q in range(-1, 6): - if q == 0: - continue - init_params = None - for p in range(1, 6): - if q > p: - this_q = p - else: - this_q = q - print(f"q = {q}, p = {p}") - qaoa_energy, beta, gamma, u, v = solve_QUBO_with_QAOA( - qubo, - p, - this_q, - seed=seed, - initial_params=init_params, - random_param_init=True, - ) - schedule = annealing_schedule_from_QAOA_params(beta, gamma) - print("Annealing schedule", schedule) - if q == -1: - init_params = np.concatenate([beta, gamma]) - else: - init_params = np.concatenate([v, u]) - - row_content = [ - "track reconstruction", - len(qubo), - geometric_index, - seed, - qaoa_energy, - min_energy, - opt_var_assignment, - p, - q, - ] - - for params in [beta, gamma, u, v]: - row_content.extend(params) - row_content.extend( - [None for _ in range(max_p - len(params))] - ) # padding - - save_to_csv(row_content, result_path_prefix, "solution.csv") - - -def maxcut( - num_qubits: int, - density: float, - seed: int, - result_path_prefix: str, - include_header: bool = True, - max_p=20, -): - if include_header: - header_content = [ - "problem", - "num_qubits", - "density", - "seed", - "energy", - "optimal_energy", - "optimal_solution", - "p", - "q", - ] - - for s in ["beta", "gamma", "u", "v"]: - header_content.extend([f"{s}{i+1:02d}" for i in range(max_p)]) - - save_to_csv(header_content, result_path_prefix, "solution.csv") - - qubo = provide_random_maxcut_QUBO(num_qubits, density, seed) - - min_energy, opt_var_assignment = compute_min_energy_solution(qubo) - - for q in range(-1, 0): - if q == 0: - continue - init_params = None - for p in range(1, max_p): - if q > p: - this_q = p - else: - this_q = q - print(f"q = {q}, p = {p}") - qaoa_energy, beta, gamma, u, v = solve_QUBO_with_QAOA( - qubo, - p, - this_q, - seed=seed, - initial_params=init_params, - random_param_init=True, - ) - if q == -1: - init_params = np.concatenate([beta, gamma]) - else: - init_params = np.concatenate([v, u]) - - row_content = [ - "maxcut", - len(qubo), - density, - seed, - qaoa_energy, - min_energy, - opt_var_assignment, - p, - q, - ] - - for params in [beta, gamma, u, v]: - row_content.extend(params) - row_content.extend( - [None for _ in range(max_p - len(params))] - ) # padding - - save_to_csv(row_content, result_path_prefix, "solution.csv") - - -if __name__ == "__main__": - - problem = "" - if len(sys.argv) > 2: - exit( - "Usage: python main_qaoa.py [m|t] (m=maxcut, t=track reconstruction)" - ) - elif len(sys.argv) == 1: - problem = "m" - elif sys.argv[1] not in ["m", "t"]: - exit( - f"Invalid option {sys.argv[1]} \n" - "Usage: python main_qaoa.py [m|t] (m=maxcut, t=track reconstruction)" - ) - - first = True - time_stamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S") - - if problem == "m": - seed = 777 - result_path_prefix = f"results/MAXCUT_QAOA/{time_stamp}" - n = 5 - density = 0.7 - maxcut( - n, - density, - seed, - result_path_prefix, - include_header=first, - ) - first = False - else: - seed = 12345 - result_path_prefix = f"results/TR_QAOA/{time_stamp}" - - dw, data_path = create_dataset_track_reconstruction( - result_path_prefix, seed - ) - - i = 1 - track_reconstruction_QAOA( - dw, - seed, - result_path_prefix, - data_path, - geometric_index=i, - include_header=first, - ) - first = False diff --git a/poetry.lock b/poetry.lock index 719aaaa..0cbd624 100644 --- a/poetry.lock +++ b/poetry.lock @@ -102,22 +102,22 @@ test = ["astroid (>=1,<2)", "astroid (>=2,<4)", "pytest"] [[package]] name = "attrs" -version = "24.2.0" +version = "23.2.0" description = "Classes Without Boilerplate" optional = false python-versions = ">=3.7" files = [ - {file = "attrs-24.2.0-py3-none-any.whl", hash = "sha256:81921eb96de3191c8258c199618104dd27ac608d9366f5e35d011eae1867ede2"}, - {file = "attrs-24.2.0.tar.gz", hash = "sha256:5cfb1b9148b5b086569baec03f20d7b6bf3bcacc9a42bebf87ffaaca362f6346"}, + {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, + {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, ] [package.extras] -benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] -tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] +cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] +dev = ["attrs[tests]", "pre-commit"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] +tests = ["attrs[tests-no-zope]", "zope-interface"] +tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] +tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] [[package]] name = "binaryornot" @@ -133,6 +133,50 @@ files = [ [package.dependencies] chardet = ">=3.0.2" +[[package]] +name = "black" +version = "24.10.0" +description = "The uncompromising code formatter." +optional = false +python-versions = ">=3.9" +files = [ + {file = "black-24.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e6668650ea4b685440857138e5fe40cde4d652633b1bdffc62933d0db4ed9812"}, + {file = "black-24.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1c536fcf674217e87b8cc3657b81809d3c085d7bf3ef262ead700da345bfa6ea"}, + {file = "black-24.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:649fff99a20bd06c6f727d2a27f401331dc0cc861fb69cde910fe95b01b5928f"}, + {file = "black-24.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:fe4d6476887de70546212c99ac9bd803d90b42fc4767f058a0baa895013fbb3e"}, + {file = "black-24.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5a2221696a8224e335c28816a9d331a6c2ae15a2ee34ec857dcf3e45dbfa99ad"}, + {file = "black-24.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f9da3333530dbcecc1be13e69c250ed8dfa67f43c4005fb537bb426e19200d50"}, + {file = "black-24.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4007b1393d902b48b36958a216c20c4482f601569d19ed1df294a496eb366392"}, + {file = "black-24.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:394d4ddc64782e51153eadcaaca95144ac4c35e27ef9b0a42e121ae7e57a9175"}, + {file = "black-24.10.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b5e39e0fae001df40f95bd8cc36b9165c5e2ea88900167bddf258bacef9bbdc3"}, + {file = "black-24.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d37d422772111794b26757c5b55a3eade028aa3fde43121ab7b673d050949d65"}, + {file = "black-24.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:14b3502784f09ce2443830e3133dacf2c0110d45191ed470ecb04d0f5f6fcb0f"}, + {file = "black-24.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:30d2c30dc5139211dda799758559d1b049f7f14c580c409d6ad925b74a4208a8"}, + {file = "black-24.10.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1cbacacb19e922a1d75ef2b6ccaefcd6e93a2c05ede32f06a21386a04cedb981"}, + {file = "black-24.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1f93102e0c5bb3907451063e08b9876dbeac810e7da5a8bfb7aeb5a9ef89066b"}, + {file = "black-24.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ddacb691cdcdf77b96f549cf9591701d8db36b2f19519373d60d31746068dbf2"}, + {file = "black-24.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:680359d932801c76d2e9c9068d05c6b107f2584b2a5b88831c83962eb9984c1b"}, + {file = "black-24.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:17374989640fbca88b6a448129cd1745c5eb8d9547b464f281b251dd00155ccd"}, + {file = "black-24.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:63f626344343083322233f175aaf372d326de8436f5928c042639a4afbbf1d3f"}, + {file = "black-24.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfa1d0cb6200857f1923b602f978386a3a2758a65b52e0950299ea014be6800"}, + {file = "black-24.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:2cd9c95431d94adc56600710f8813ee27eea544dd118d45896bb734e9d7a0dc7"}, + {file = "black-24.10.0-py3-none-any.whl", hash = "sha256:3bb2b7a1f7b685f85b11fed1ef10f8a9148bceb49853e47a294a3dd963c1dd7d"}, + {file = "black-24.10.0.tar.gz", hash = "sha256:846ea64c97afe3bc677b761787993be4991810ecc7a4a937816dd6bddedc4875"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.10)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + [[package]] name = "build" version = "1.2.2.post1" @@ -167,6 +211,30 @@ files = [ {file = "cachetools-5.5.0.tar.gz", hash = "sha256:2cc24fb4cbe39633fb7badd9db9ca6295d766d9c2995f245725a46715d050f2a"}, ] +[[package]] +name = "cattrs" +version = "24.1.2" +description = "Composable complex class support for attrs and dataclasses." +optional = false +python-versions = ">=3.8" +files = [ + {file = "cattrs-24.1.2-py3-none-any.whl", hash = "sha256:67c7495b760168d931a10233f979b28dc04daf853b30752246f4f8471c6d68d0"}, + {file = "cattrs-24.1.2.tar.gz", hash = "sha256:8028cfe1ff5382df59dd36474a86e02d817b06eaf8af84555441bac915d2ef85"}, +] + +[package.dependencies] +attrs = ">=23.1.0" + +[package.extras] +bson = ["pymongo (>=4.4.0)"] +cbor2 = ["cbor2 (>=5.4.6)"] +msgpack = ["msgpack (>=1.0.5)"] +msgspec = ["msgspec (>=0.18.5)"] +orjson = ["orjson (>=3.9.2)"] +pyyaml = ["pyyaml (>=6.0)"] +tomlkit = ["tomlkit (>=0.11.8)"] +ujson = ["ujson (>=5.7.0)"] + [[package]] name = "certifi" version = "2024.8.30" @@ -178,6 +246,17 @@ files = [ {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, ] +[[package]] +name = "cfgv" +version = "3.4.0" +description = "Validate configuration and produce human readable error messages." +optional = false +python-versions = ">=3.8" +files = [ + {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, + {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, +] + [[package]] name = "chardet" version = "5.2.0" @@ -435,6 +514,17 @@ files = [ [package.dependencies] numpy = ">=1.17.3" +[[package]] +name = "distlib" +version = "0.3.9" +description = "Distribution utilities" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, + {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, +] + [[package]] name = "dwave-neal" version = "0.6.0" @@ -544,6 +634,53 @@ typing-extensions = ">=4.8.0" all = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.5)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.7)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"] standard = ["email-validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.5)", "httpx (>=0.23.0)", "jinja2 (>=2.11.2)", "python-multipart (>=0.0.7)", "uvicorn[standard] (>=0.12.0)"] +[[package]] +name = "fhconfparser" +version = "2024.1" +description = "Provides a config language independent way to read a config file." +optional = false +python-versions = ">=3.8,<4.0" +files = [ + {file = "fhconfparser-2024.1-py3-none-any.whl", hash = "sha256:f6048cb646e69a3422a581bc0102150c2b79fe7ff26b82233e5ef52f72820e3e"}, + {file = "fhconfparser-2024.1.tar.gz", hash = "sha256:de8af019f0071e614d523985e1d93e0fce20a409d1c64dead03b1b665d4b2e4d"}, +] + +[package.dependencies] +attrs = ">=23.2.0,<24" +tomli = ">=2.0.1,<3" + +[[package]] +name = "filelock" +version = "3.16.1" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.8" +files = [ + {file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"}, + {file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"}, +] + +[package.extras] +docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4.1)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.2)", "pytest (>=8.3.3)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.4)"] +typing = ["typing-extensions (>=4.12.2)"] + +[[package]] +name = "flake8" +version = "7.1.1" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8-7.1.1-py2.py3-none-any.whl", hash = "sha256:597477df7860daa5aa0fdd84bf5208a043ab96b8e96ab708770ae0364dd03213"}, + {file = "flake8-7.1.1.tar.gz", hash = "sha256:049d058491e228e03e67b390f311bbf88fce2dbaa8fa673e7aea87b7198b8d38"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.12.0,<2.13.0" +pyflakes = ">=3.2.0,<3.3.0" + [[package]] name = "fsspec" version = "2024.9.0" @@ -778,6 +915,20 @@ files = [ [package.extras] test = ["Cython (>=0.29.24)"] +[[package]] +name = "identify" +version = "2.6.1" +description = "File identification library for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "identify-2.6.1-py2.py3-none-any.whl", hash = "sha256:53863bcac7caf8d2ed85bd20312ea5dcfc22226800f6d6881f232d861db5a8f0"}, + {file = "identify-2.6.1.tar.gz", hash = "sha256:91478c5fb7c3aac5ff7bf9b4344f803843dc586832d5f110d672b19aa1984c98"}, +] + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.10" @@ -1002,6 +1153,63 @@ azure = ["adlfs (>=2021.4)"] docs = ["kedro-sphinx-theme (==2024.4.0)"] gcp = ["gcsfs (>=2021.4)"] +[[package]] +name = "licensecheck" +version = "2024.3" +description = "Output the licenses used by dependencies and check if these are compatible with the project license" +optional = false +python-versions = "<4.0,>=3.8" +files = [ + {file = "licensecheck-2024.3-py3-none-any.whl", hash = "sha256:0baef4c1865e0325a35ff25ed12a0c7094035b7dcfbab9a1abfe43d7735adebe"}, + {file = "licensecheck-2024.3.tar.gz", hash = "sha256:e838e1c87a7ede553df376ad35a69d7c4b02676df0fba9dd1c6a6866eb0e0ee5"}, +] + +[package.dependencies] +appdirs = ">=1.4.4,<2" +fhconfparser = ">=2024.1,<2026" +loguru = ">=0.7.2,<2" +markdown = ">=3.6,<4" +packaging = ">=24.0,<25" +requests = ">=2.31.0,<3" +requests-cache = ">=1.2.0,<2" +requirements-parser = ">=0.11.0,<2" +rich = ">=13.7.1,<14" +tomli = ">=2.0.1,<3" +uv = ">=0.3.3,<2" + +[[package]] +name = "loguru" +version = "0.7.2" +description = "Python logging made (stupidly) simple" +optional = false +python-versions = ">=3.5" +files = [ + {file = "loguru-0.7.2-py3-none-any.whl", hash = "sha256:003d71e3d3ed35f0f8984898359d65b79e5b21943f78af86aa5491210429b8eb"}, + {file = "loguru-0.7.2.tar.gz", hash = "sha256:e671a53522515f34fd406340ee968cb9ecafbc4b36c679da03c18fd8d0bd51ac"}, +] + +[package.dependencies] +colorama = {version = ">=0.3.4", markers = "sys_platform == \"win32\""} +win32-setctime = {version = ">=1.0.0", markers = "sys_platform == \"win32\""} + +[package.extras] +dev = ["Sphinx (==7.2.5)", "colorama (==0.4.5)", "colorama (==0.4.6)", "exceptiongroup (==1.1.3)", "freezegun (==1.1.0)", "freezegun (==1.2.2)", "mypy (==v0.910)", "mypy (==v0.971)", "mypy (==v1.4.1)", "mypy (==v1.5.1)", "pre-commit (==3.4.0)", "pytest (==6.1.2)", "pytest (==7.4.0)", "pytest-cov (==2.12.1)", "pytest-cov (==4.1.0)", "pytest-mypy-plugins (==1.9.3)", "pytest-mypy-plugins (==3.0.0)", "sphinx-autobuild (==2021.3.14)", "sphinx-rtd-theme (==1.3.0)", "tox (==3.27.1)", "tox (==4.11.0)"] + +[[package]] +name = "markdown" +version = "3.7" +description = "Python implementation of John Gruber's Markdown." +optional = false +python-versions = ">=3.8" +files = [ + {file = "Markdown-3.7-py3-none-any.whl", hash = "sha256:7eb6df5690b81a1d7942992c97fad2938e956e79df20cbc6186e9c3a77b1c803"}, + {file = "markdown-3.7.tar.gz", hash = "sha256:2ae2471477cfd02dbbf038d5d9bc226d40def84b4fe2986e49b59b6b472bbed2"}, +] + +[package.extras] +docs = ["mdx-gh-links (>=0.2)", "mkdocs (>=1.5)", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-nature (>=0.6)", "mkdocs-section-index", "mkdocstrings[python]"] +testing = ["coverage", "pyyaml"] + [[package]] name = "markdown-it-py" version = "3.0.0" @@ -1110,6 +1318,17 @@ files = [ [package.dependencies] traitlets = "*" +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + [[package]] name = "mdurl" version = "0.1.2" @@ -1149,6 +1368,17 @@ docs = ["sphinx"] gmpy = ["gmpy2 (>=2.1.0a4)"] tests = ["pytest (>=4.6)"] +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + [[package]] name = "networkx" version = "3.4.1" @@ -1168,6 +1398,17 @@ example = ["cairocffi (>=1.7)", "contextily (>=1.6)", "igraph (>=0.11)", "momepy extra = ["lxml (>=4.6)", "pydot (>=3.0.1)", "pygraphviz (>=1.14)", "sympy (>=1.10)"] test = ["pytest (>=7.2)", "pytest-cov (>=4.0)"] +[[package]] +name = "nodeenv" +version = "1.9.1" +description = "Node.js virtual environment builder" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, + {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, +] + [[package]] name = "numpy" version = "2.1.2" @@ -1433,6 +1674,17 @@ files = [ qa = ["flake8 (==5.0.4)", "mypy (==0.971)", "types-setuptools (==67.2.0.1)"] testing = ["docopt", "pytest"] +[[package]] +name = "pathspec" +version = "0.12.1" +description = "Utility library for gitignore style pattern matching of file paths." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + [[package]] name = "pbr" version = "6.1.0" @@ -1504,6 +1756,24 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "pre-commit" +version = "4.0.1" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +optional = false +python-versions = ">=3.9" +files = [ + {file = "pre_commit-4.0.1-py2.py3-none-any.whl", hash = "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878"}, + {file = "pre_commit-4.0.1.tar.gz", hash = "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2"}, +] + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +virtualenv = ">=20.10.0" + [[package]] name = "pre-commit-hooks" version = "5.0.0" @@ -1557,6 +1827,17 @@ files = [ [package.extras] tests = ["pytest"] +[[package]] +name = "pycodestyle" +version = "2.12.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pycodestyle-2.12.1-py2.py3-none-any.whl", hash = "sha256:46f0fb92069a7c28ab7bb558f05bfc0110dac69a0cd23c61ea0040283a9d78b3"}, + {file = "pycodestyle-2.12.1.tar.gz", hash = "sha256:6838eae08bbce4f6accd5d5572075c63626a15ee3e6f842df996bf62f6d73521"}, +] + [[package]] name = "pydantic" version = "2.9.2" @@ -1681,6 +1962,17 @@ files = [ [package.dependencies] typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" +[[package]] +name = "pyflakes" +version = "3.2.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, +] + [[package]] name = "pygments" version = "2.18.0" @@ -1939,6 +2231,51 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] +[[package]] +name = "requests-cache" +version = "1.2.1" +description = "A persistent cache for python requests" +optional = false +python-versions = ">=3.8" +files = [ + {file = "requests_cache-1.2.1-py3-none-any.whl", hash = "sha256:1285151cddf5331067baa82598afe2d47c7495a1334bfe7a7d329b43e9fd3603"}, + {file = "requests_cache-1.2.1.tar.gz", hash = "sha256:68abc986fdc5b8d0911318fbb5f7c80eebcd4d01bfacc6685ecf8876052511d1"}, +] + +[package.dependencies] +attrs = ">=21.2" +cattrs = ">=22.2" +platformdirs = ">=2.5" +requests = ">=2.22" +url-normalize = ">=1.4" +urllib3 = ">=1.25.5" + +[package.extras] +all = ["boto3 (>=1.15)", "botocore (>=1.18)", "itsdangerous (>=2.0)", "pymongo (>=3)", "pyyaml (>=6.0.1)", "redis (>=3)", "ujson (>=5.4)"] +bson = ["bson (>=0.5)"] +docs = ["furo (>=2023.3,<2024.0)", "linkify-it-py (>=2.0,<3.0)", "myst-parser (>=1.0,<2.0)", "sphinx (>=5.0.2,<6.0.0)", "sphinx-autodoc-typehints (>=1.19)", "sphinx-automodapi (>=0.14)", "sphinx-copybutton (>=0.5)", "sphinx-design (>=0.2)", "sphinx-notfound-page (>=0.8)", "sphinxcontrib-apidoc (>=0.3)", "sphinxext-opengraph (>=0.9)"] +dynamodb = ["boto3 (>=1.15)", "botocore (>=1.18)"] +json = ["ujson (>=5.4)"] +mongodb = ["pymongo (>=3)"] +redis = ["redis (>=3)"] +security = ["itsdangerous (>=2.0)"] +yaml = ["pyyaml (>=6.0.1)"] + +[[package]] +name = "requirements-parser" +version = "0.11.0" +description = "This is a small Python module for parsing Pip requirement files." +optional = false +python-versions = "<4.0,>=3.8" +files = [ + {file = "requirements_parser-0.11.0-py3-none-any.whl", hash = "sha256:50379eb50311834386c2568263ae5225d7b9d0867fb55cf4ecc93959de2c2684"}, + {file = "requirements_parser-0.11.0.tar.gz", hash = "sha256:35f36dc969d14830bf459803da84f314dc3d17c802592e9e970f63d0359e5920"}, +] + +[package.dependencies] +packaging = ">=23.2" +types-setuptools = ">=69.1.0" + [[package]] name = "rich" version = "13.9.2" @@ -2444,6 +2781,17 @@ files = [ {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] +[[package]] +name = "tomli" +version = "2.0.2" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"}, + {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"}, +] + [[package]] name = "trackml" version = "0.3.0" @@ -2487,6 +2835,17 @@ files = [ {file = "types_python_dateutil-2.9.0.20241003-py3-none-any.whl", hash = "sha256:250e1d8e80e7bbc3a6c99b907762711d1a1cdd00e978ad39cb5940f6f0a87f3d"}, ] +[[package]] +name = "types-setuptools" +version = "75.1.0.20241014" +description = "Typing stubs for setuptools" +optional = false +python-versions = ">=3.8" +files = [ + {file = "types-setuptools-75.1.0.20241014.tar.gz", hash = "sha256:29b0560a8d4b4a91174be085847002c69abfcb048e20b33fc663005aedf56804"}, + {file = "types_setuptools-75.1.0.20241014-py3-none-any.whl", hash = "sha256:caab58366741fb99673d0138b6e2d760717f154cfb981b74fea5e8de40f0b703"}, +] + [[package]] name = "typing-extensions" version = "4.12.2" @@ -2509,6 +2868,20 @@ files = [ {file = "tzdata-2024.2.tar.gz", hash = "sha256:7d85cc416e9382e69095b7bdf4afd9e3880418a2413feec7069d533d6b4e31cc"}, ] +[[package]] +name = "url-normalize" +version = "1.4.3" +description = "URL normalization for Python" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +files = [ + {file = "url-normalize-1.4.3.tar.gz", hash = "sha256:d23d3a070ac52a67b83a1c59a0e68f8608d1cd538783b401bc9de2c0fac999b2"}, + {file = "url_normalize-1.4.3-py2.py3-none-any.whl", hash = "sha256:ec3c301f04e5bb676d333a7fa162fa977ad2ca04b7e652bfc9fac4e405728eed"}, +] + +[package.dependencies] +six = "*" + [[package]] name = "urllib3" version = "2.2.3" @@ -2526,6 +2899,33 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] +[[package]] +name = "uv" +version = "0.4.21" +description = "An extremely fast Python package and project manager, written in Rust." +optional = false +python-versions = ">=3.8" +files = [ + {file = "uv-0.4.21-py3-none-linux_armv6l.whl", hash = "sha256:7d1e239b683fb541cad1ddfa16ef4f8f0681ad666c73f12da17e70edc86aab4b"}, + {file = "uv-0.4.21-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ba3e3b40cc1d5a980d36589775d6a7e4defa1b33e7e06423af0e395b8e4d9505"}, + {file = "uv-0.4.21-py3-none-macosx_11_0_arm64.whl", hash = "sha256:19607da8ee024e4ff060804efb8251e3b821cbd7f830b58612600ffe739fd33d"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:aaff052175df7e43ac2f25849a26a6856dcce498653c69a2f4245cdf47db46f7"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e2d7e9c65e799876a45c9134945d548c3de51e13ee650b58bc936190744a66e1"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e8efba624edb9ab36e0b3550252dc34b2eb1492c73ca8bfb5faa8148307efa1d"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:0fccf9e232e95917ecbba10767c43dc308e243ea4d17531112a2f4ad63c0d3f1"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:be55a34aa56192f2fd80a3954ad33e3d4587762f8fffe13a0bdf25da1f34ea5d"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:14224075d2edd3d2984391dfcb3138e4840cc998a81c1046cdc746ae1d38cc62"}, + {file = "uv-0.4.21-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c08b01f8571d2c64d45d569990aa7bffad5eb259cf64bc329d40d8c787fb9ba"}, + {file = "uv-0.4.21-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:58a770b278b0555a966275dbe1461dd6632f938a0aefea89037155dee676c78d"}, + {file = "uv-0.4.21-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:3d3e35a10f7813d7e540aad24cd3a3e20745a42b671a217e7761686791a562f3"}, + {file = "uv-0.4.21-py3-none-musllinux_1_1_i686.whl", hash = "sha256:343c4ffe77ea93563861b46ed024a90efc162c06749836d9d7a8506db40d4565"}, + {file = "uv-0.4.21-py3-none-musllinux_1_1_ppc64le.whl", hash = "sha256:f787d74abb24532f69cd3029c16edea7544931fd36cc1acda5b3af1cbffa5fb4"}, + {file = "uv-0.4.21-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:a1a9a126ce48f0f0893891adb5a9749220425169092f3e4da1216168736ac16d"}, + {file = "uv-0.4.21-py3-none-win32.whl", hash = "sha256:23d635ef5fe716fb1a1c4b411619f05caa5f9ee669651fcf7a5c00c8a3a1f749"}, + {file = "uv-0.4.21-py3-none-win_amd64.whl", hash = "sha256:45df47a4f43db730bea72bd3150c206d00d1a4d854137ed63dc04bb73032f280"}, + {file = "uv-0.4.21.tar.gz", hash = "sha256:9dcddbb3b6e1662c6db41d63db539742450e2ce17d6c746329c016e3651bfb4a"}, +] + [[package]] name = "uvicorn" version = "0.31.1" @@ -2602,6 +3002,26 @@ dev = ["Cython (>=3.0,<4.0)", "setuptools (>=60)"] docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)"] test = ["aiohttp (>=3.10.5)", "flake8 (>=5.0,<6.0)", "mypy (>=0.800)", "psutil", "pyOpenSSL (>=23.0.0,<23.1.0)", "pycodestyle (>=2.9.0,<2.10.0)"] +[[package]] +name = "virtualenv" +version = "20.26.6" +description = "Virtual Python Environment builder" +optional = false +python-versions = ">=3.7" +files = [ + {file = "virtualenv-20.26.6-py3-none-any.whl", hash = "sha256:7345cc5b25405607a624d8418154577459c3e0277f5466dd79c49d5e492995f2"}, + {file = "virtualenv-20.26.6.tar.gz", hash = "sha256:280aede09a2a5c317e409a00102e7077c6432c5a38f0ef938e643805a7ad2c48"}, +] + +[package.dependencies] +distlib = ">=0.3.7,<1" +filelock = ">=3.12.2,<4" +platformdirs = ">=3.9.1,<5" + +[package.extras] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] + [[package]] name = "watchfiles" version = "0.24.0" @@ -2817,6 +3237,20 @@ files = [ {file = "websockets-13.1.tar.gz", hash = "sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878"}, ] +[[package]] +name = "win32-setctime" +version = "1.1.0" +description = "A small Python utility to set file creation time on Windows" +optional = false +python-versions = ">=3.5" +files = [ + {file = "win32_setctime-1.1.0-py3-none-any.whl", hash = "sha256:231db239e959c2fe7eb1d7dc129f11172354f98361c4fa2d6d2d7e278baa8aad"}, + {file = "win32_setctime-1.1.0.tar.gz", hash = "sha256:15cf5750465118d6929ae4de4eb46e8edae9a5634350c01ba582df868e932cb2"}, +] + +[package.extras] +dev = ["black (>=19.3b0)", "pytest (>=4.6.2)"] + [[package]] name = "zipp" version = "3.20.2" @@ -2839,4 +3273,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "20508e8659b9c63cda71655c1e985a82839ab78bcfafee271d00c39d72af5481" +content-hash = "90f82a5a62f16ab14051768cd938d2175db1f87da3af20baf64811103f44db08" diff --git a/pyproject.toml b/pyproject.toml index 508732d..5d31da9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,12 @@ qallse = { path = "./hepqpr-qallse" } kedro = "^0.19.8" kedro-viz = "^10.0.0" +[tool.poetry.group.dev.dependencies] +flake8 = "^7.1.1" +black = "^24.10.0" +pre-commit = "^4.0.1" +licensecheck = "^2024.3" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/src/fromhopetoheuristics/__main__.py b/src/fromhopetoheuristics/__main__.py index cd64368..e78b287 100644 --- a/src/fromhopetoheuristics/__main__.py +++ b/src/fromhopetoheuristics/__main__.py @@ -1,6 +1,7 @@ """FromHopeToHeuristics file for ensuring the package is executable as `fromhopetoheuristics` and `python -m fromhopetoheuristics` """ + import sys from pathlib import Path from typing import Any @@ -13,7 +14,7 @@ def main(*args, **kwargs) -> Any: package_name = Path(__file__).parent.name configure_project(package_name) - interactive = hasattr(sys, 'ps1') + interactive = hasattr(sys, "ps1") kwargs["standalone_mode"] = not interactive run = find_run_command(package_name) diff --git a/src/fromhopetoheuristics/settings.py b/src/fromhopetoheuristics/settings.py index 249125d..1c07bbb 100644 --- a/src/fromhopetoheuristics/settings.py +++ b/src/fromhopetoheuristics/settings.py @@ -35,12 +35,12 @@ CONFIG_LOADER_CLASS = OmegaConfigLoader # Keyword arguments to pass to the `CONFIG_LOADER_CLASS` constructor. CONFIG_LOADER_ARGS = { - "base_env": "base", - "default_run_env": "local", -# "config_patterns": { -# "spark" : ["spark*/"], -# "parameters": ["parameters*", "parameters*/**", "**/parameters*"], -# } + "base_env": "base", + "default_run_env": "local", + # "config_patterns": { + # "spark" : ["spark*/"], + # "parameters": ["parameters*", "parameters*/**", "**/parameters*"], + # } } # Class that manages Kedro's library components. diff --git a/src/fromhopetoheuristics/utils/maxcut_utils.py b/src/fromhopetoheuristics/utils/maxcut_utils.py index cacf2fa..a91ce50 100644 --- a/src/fromhopetoheuristics/utils/maxcut_utils.py +++ b/src/fromhopetoheuristics/utils/maxcut_utils.py @@ -6,6 +6,7 @@ # Prevents re-generation, when a problem was already generated problems = dict() + def maxcut_graph_to_ising(G: nx.Graph) -> Tuple[np.ndarray, float]: """ Calculates Ising model from MAXCUT graph diff --git a/src/fromhopetoheuristics/utils/model.py b/src/fromhopetoheuristics/utils/model.py index f941063..e397ff2 100644 --- a/src/fromhopetoheuristics/utils/model.py +++ b/src/fromhopetoheuristics/utils/model.py @@ -13,7 +13,8 @@ class QallseSplit(QallseD0): config = SplitConfig() def _create_doublets(self, initial_doublets): - # Generate Doublet structures from the initial doublets, calling _is_invalid_doublet to apply early cuts + # Generate Doublet structures from the initial doublets, + # calling _is_invalid_doublet to apply early cuts doublets = [] for start_id, end_id in initial_doublets: start, end = self.hits[start_id], self.hits[end_id] @@ -27,7 +28,8 @@ def _create_doublets(self, initial_doublets): self.doublets = doublets def _create_triplets(self): - # Generate Triplet structures from Doublets, calling _is_invalid_triplet to apply early cuts + # Generate Triplet structures from Doublets, + # calling _is_invalid_triplet to apply early cuts triplets = [] for d1 in self.doublets: for d2 in d1.h2.outer: diff --git a/src/fromhopetoheuristics/utils/qaoa_utils.py b/src/fromhopetoheuristics/utils/qaoa_utils.py index 8b7de25..2c951ce 100644 --- a/src/fromhopetoheuristics/utils/qaoa_utils.py +++ b/src/fromhopetoheuristics/utils/qaoa_utils.py @@ -263,7 +263,7 @@ def get_FOURIER_params( ) -> Tuple[np.ndarray, np.ndarray]: if q == -1: assert len(v_params) == len(u_params) == p, ( - f"Length of the parameter vector without FOURIER stragety should", + "Length of the parameter vector without FOURIER stragety should", f"be {p}, got {len(v_params)} and {len(u_params)}", ) return v_params, u_params @@ -403,9 +403,7 @@ def annealing_schedule_from_QAOA_params( # ensure that time is increasing monotonically, if not, skip if times[i] < last_added_time: continue - anneal_fraction = np.abs(gammas[i]) / ( - np.abs(gammas[i]) + np.abs(betas[i]) - ) + anneal_fraction = np.abs(gammas[i]) / (np.abs(gammas[i]) + np.abs(betas[i])) anneal_schedule.append((times[i], anneal_fraction)) last_added_time = times[i] diff --git a/src/fromhopetoheuristics/utils/spectral_gap_calculator.py b/src/fromhopetoheuristics/utils/spectral_gap_calculator.py index be5f3db..6d34e69 100644 --- a/src/fromhopetoheuristics/utils/spectral_gap_calculator.py +++ b/src/fromhopetoheuristics/utils/spectral_gap_calculator.py @@ -7,7 +7,9 @@ def build_mixing_hamiltonian(num_qubits): - # As in https://qiskit.org/documentation/_modules/qiskit/circuit/library/n_local/qaoa_ansatz.html#QAOAAnsatz + # As in + # https://qiskit.org/documentation/_modules/qiskit/circuit/library/ + # n_local/qaoa_ansatz.html#QAOAAnsatz mixer_terms = [ ("I" * left + "X" + "I" * (num_qubits - left - 1), 1) for left in range(num_qubits) @@ -16,7 +18,8 @@ def build_mixing_hamiltonian(num_qubits): return mixer_hamiltonian -# Builds the interpolation hamiltonian for the given problem hamiltonian, fraction s and amount of qubits +# Builds the interpolation hamiltonian for the given problem hamiltonian, +# fraction s and amount of qubits def build_hamiltonian(qubo, fraction, num_qubits): cost_hamiltonian, offset = hamiltonian_from_qubo(qubo) mixer_hamiltonian = build_mixing_hamiltonian(num_qubits) @@ -32,26 +35,23 @@ def build_hamiltonian(qubo, fraction, num_qubits): # Derives the spectral gap for the given problem hamiltonian at the given fraction s -def calculate_spectral_gap( - fraction: float, qubo: np.ndarray, num_dec_pos: int = 4 -): +def calculate_spectral_gap(fraction: float, qubo: np.ndarray, num_dec_pos: int = 4): num_qubits = len(qubo) H = build_hamiltonian(qubo, fraction, num_qubits) counter = 0 eigenvalues = [] - eigenstates = [] + # eigenstates = [] while len(set(eigenvalues)) < 2 and counter != num_qubits: - # Increase the counter in every iteration, such that the number of searched eigenvalues exponentially increases + # Increase the counter in every iteration, such that the number + # of searched eigenvalues exponentially increases # as long as no two unique eigenvalues are found counter = counter + 1 eigensolver = NumPyEigensolver(k=pow(2, counter)) eigensolver_result = eigensolver.compute_eigenvalues(H) - eigenstates = eigensolver_result.eigenstates + # eigenstates = eigensolver_result.eigenstates eigenvalues = np.real(eigensolver_result.eigenvalues) eigenvalues = np.around(eigenvalues, num_dec_pos) eigenvalues = np.real(np.unique(eigenvalues)) - spectral_gap = np.around( - np.abs(eigenvalues[0] - eigenvalues[1]), num_dec_pos - ) + spectral_gap = np.around(np.abs(eigenvalues[0] - eigenvalues[1]), num_dec_pos) return eigenvalues[0], eigenvalues[1], spectral_gap diff --git a/tests/test_run.py b/tests/test_run.py index 0eab4c1..2ba38f4 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -5,6 +5,7 @@ project's structure, and in files named test_*.py. They are simply functions named ``test_*`` which test a unit of logic. """ + from pathlib import Path import pytest diff --git a/trackml-library b/trackml-library index da91c25..6bcf062 160000 --- a/trackml-library +++ b/trackml-library @@ -1 +1 @@ -Subproject commit da91c25d7912f8df3fa742b37a117f8a24ff5022 +Subproject commit 6bcf062a609fbd88a1fadf63f8818128e4fb62b8