diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 0000000..99aae40 --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,38 @@ +name: Tox + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + release: + types: + - published + +jobs: + tox_checks: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install tox-gh-actions + + - name: Run tox + run: tox diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 93f1c20..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,3 +0,0 @@ -include: - - project: nse/ci - file: /ci/pipelines/nse.ArchNGV.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..20f780b --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-lts-latest + tools: + python: "3.10" + +sphinx: + configuration: doc/source/conf.py + fail_on_warning: true + +python: + install: + - method: pip + path: . + extra_requirements: + - docs diff --git a/AUTHORS.txt b/AUTHORS.txt new file mode 100644 index 0000000..8ea4686 --- /dev/null +++ b/AUTHORS.txt @@ -0,0 +1,11 @@ +Maintainer +---------- +* BBP/NSE + +Authors +------- +Arseny V. Povolotsky +Eleftherios Zisis +Michael Gevaert +Jean Jacquemier +Thomas Delemontex diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c0d55d6 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,108 @@ +# Contribution Guide + +We would love for you to contribute to the ArchNGV project and help make it better than it is today. +As a contributor, here are the guidelines we would like you to follow: + + - [Question or Problem?](#got-a-question) + - [Issues and Bugs](#found-a-bug) + - [Feature Requests](#missing-a-feature) + - [Submissions](#submission-guidelines) + - [Development Guidelines](#development) + - [Release Procedure](#release) + +# Got a Question? + +Please do not hesitate to raise an issue on [github project page][github]. + +# Found a Bug? + +If you find a bug in the source code, you can help us by [submitting an issue](#issues) +to our [GitHub Repository][github]. Even better, you can [submit a Pull Request](#pull-requests) with a fix. + +# Missing a Feature? + +You can *request* a new feature by [submitting an issue](#issues) to our GitHub Repository. +If you would like to *implement* a new feature, please submit an issue with a proposal for your +work first, to be sure that we can use it. + +Please consider what kind of change it is: + +* For a **Major Feature**, first open an issue and outline your proposal so that it can be +discussed. This will also allow us to better coordinate our efforts, prevent duplication of work, +and help you to craft the change so that it is successfully accepted into the project. +* **Small Features** can be crafted and directly [submitted as a Pull Request](#pull-requests). + +# Submission Guidelines + +## Issues + +Before you submit an issue, please search the issue tracker, maybe an issue for your problem +already exists and the discussion might inform you of workarounds readily available. + +We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce +and confirm it. In order to reproduce bugs we will need as much information as possible, and +preferably with an example. + +## Pull Requests + +When you wish to contribute to the code base, please consider the following guidelines: + +* Make a [fork](https://guides.github.com/activities/forking/) of this repository. +* Make your changes in your fork, in a new git branch: + + ```shell + git checkout -b my-fix-branch master + ``` +* Create your patch, **including appropriate Python test cases**. + Please check the coding [conventions](#coding-conventions) for more information. +* Run the full test suite, and ensure that all tests pass. +* Commit your changes using a descriptive commit message. + + ```shell + git commit -a + ``` +* Push your branch to GitHub: + + ```shell + git push origin my-fix-branch + ``` +* In GitHub, send a Pull Request to the `master` branch of the upstream repository of the relevant component. +* If we suggest changes then: + * Make the required updates. + * Re-run the test suites to ensure tests are still passing. + * Rebase your branch and force push to your GitHub repository (this will update your Pull Request): + + ```shell + git rebase master -i + git push -f + ``` + +That’s it! Thank you for your contribution! + +### After your pull request is merged + +After your pull request is merged, you can safely delete your branch and pull the changes from +the main (upstream) repository: + +* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: + + ```shell + git push origin --delete my-fix-branch + ``` +* Check out the master branch: + + ```shell + git checkout main -f + ``` +* Delete the local branch: + + ```shell + git branch -D my-fix-branch + ``` +* Update your main with the latest upstream version: + + ```shell + git pull --ff upstream main + ``` + +[github]: https://github.com/BlueBrain/ArchNGV diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index af88b08..b18672d 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,39 @@ -# Usage on BB5 +# ArchNGV +Modules for in-silco building the Neuronal-Glial-Vascular structural architecture. ## Installation -```shell -# Clone this repository -$ git clone git@bbpgitlab.epfl.ch:nse/ArchNGV.git +### From PyPI -# Load most recent stable modules -$ module purge -$ module load unstable python/3.10.8 +```shell +pip install archngv[all] +``` +### From source +```shell +# Clone this repository +git clone https://github.com/BlueBrain/ArchNGV.git # Create a Python virtualenv in repository source directory -$ python -m venv /path/to/repo/.venv +python -m venv /path/to/repo/.venv # Bring the virtualenv in this shell environment -$ . /path/to/repo/.venv/bin/activate +. /path/to/repo/.venv/bin/activate # Install ArchNGV -$ cd /path/to/repo -$ pip install . +cd ArchNGV/ +pip install .[all] ``` - +# Examples ## Create circuit exemplars ```shell # Create a directory for your circuit -$ circuit_dir=/gpfs/bbp.cscs.ch/project/projXX/$USER/ArchNGVCircuits -$ mkdir -p $circuit_dir +circuit_dir=./circuits +mkdir -p $circuit_dir # Create an exemplar -$ python ./exemplar/create_exemplar.py $circuit_dir +python ./exemplar/create_exemplar.py $circuit_dir ``` ## Execute cell placement @@ -39,10 +42,10 @@ To proceed to the cell placement in one of the created exemplar: ``` # Change directory to one of the created exemplar -$ cd $circuit_dir/exemplar_ID +cd $circuit_dir/exemplar_ID # Execute the "cell-placement" snakemake target -$ ./run.sh cell-placement +./run.sh cell-placement # -> creates file build/cell_data.h5 ``` @@ -50,13 +53,13 @@ Use the `cell_data_sonata` SnakeMake task to perform output conversion to Sonata after the cell placement: ```shell -$ ./run.sh cell_data_sonata +./run.sh cell_data_sonata # sonata file glia.h5.somata is created in the sonata.tmp directory -$ find build/sonata.tmp -build/sonata.tmp -build/sonata.tmp/nodes -build/sonata.tmp/nodes/glia.h5.somata +find build/sonata.tmp +# build/sonata.tmp +# build/sonata.tmp/nodes +# build/sonata.tmp/nodes/glia.h5.somata ``` ## Astrocyte Synthesis @@ -135,7 +138,6 @@ A final sbatch script example #SBATCH --error err-%J.log #SBATCH --mem 200000 #SBATCH --exclusive -​ export DASK_DISTRIBUTED__WORKER__USE_FILE_LOCKING=False export DASK_DISTRIBUTED__WORKER__MEMORY__TARGET=False # don't spill to disk export DASK_DISTRIBUTED__WORKER__MEMORY__SPILL=False # don't spill to disk @@ -146,10 +148,40 @@ export DASK_DISTRIBUTED__WORKER__PROFILE__INTERVAL=10000ms # Time between stati export DASK_DISTRIBUTED__WORKER__PROFILE__CYCLE=1000000ms # Time between starting new profile source /bin/activate -​ + snakemake --snakefile \ --config bioname= \ --directory \ --cluster-config \ -f synthesis -​``` +``` +## Citation +When you use ArchNGV software or methods in your research, we ask you to cite the following publication (this includes poster presentations): + +[Zisis E, Keller D, Kanari L, Arnaudon A, Gevaert M, Delemontex T, Coste B, Foni A, Abdellah M, Calì C, Hess K, Magistretti PJ, Schürmann F, Markram H. 2021. Digital Reconstruction of the Neuro-Glia-Vascular Architecture. Cerebral Cortex. 31:5686–5703. +](https://doi.org/10.1093/cercor/bhab254) + +``` +@article{10.1093/cercor/bhab254, + author = {Zisis, Eleftherios and Keller, Daniel and Kanari, Lida and Arnaudon, Alexis and Gevaert, Michael and Delemontex, Thomas and Coste, Benoît and Foni, Alessandro and Abdellah, Marwan and Calì, Corrado and Hess, Kathryn and Magistretti, Pierre Julius and Schürmann, Felix and Markram, Henry}, + title = "{Digital Reconstruction of the Neuro-Glia-Vascular Architecture}", + journal = {Cerebral Cortex}, + volume = {31}, + number = {12}, + pages = {5686-5703}, + year = {2021}, + month = {08}, + issn = {1047-3211}, + doi = {10.1093/cercor/bhab254}, + url = {https://doi.org/10.1093/cercor/bhab254}, + eprint = {https://academic.oup.com/cercor/article-pdf/31/12/5686/40814577/bhab254.pdf}, +} +``` + +## Acknowledgements + +This publication is based upon work supported by the King Abdullah University of Science and Technology (KAUST) Office of Sponsored Research (OSR) under Award No. OSR-2017-CRG6-3438 + +The development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH Board of the Swiss Federal Institutes of Technology. + +Copyright (c) 2019-2024 Blue Brain Project/EPFL diff --git a/archngv/__init__.py b/archngv/__init__.py index 18f80f4..5c16113 100644 --- a/archngv/__init__.py +++ b/archngv/__init__.py @@ -1,3 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Archngv, the pipeline for the Neuronal - Glial - Vascular architecture """ +from importlib.metadata import version + +__version__ = version(__package__) + from archngv.core.circuit import NGVCircuit diff --git a/archngv/app/__main__.py b/archngv/app/__main__.py index 52a04ce..f271811 100644 --- a/archngv/app/__main__.py +++ b/archngv/app/__main__.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + r""" Collection of tools for NGV building @@ -9,6 +11,7 @@ \____|__ /__| \___ >___| /\____|__ /\______ / \___/ \/ \/ \/ \/ \/ """ +import importlib.resources import logging import os import stat @@ -18,11 +21,12 @@ from pathlib import Path import click -import pkg_resources +from archngv import __version__ as VERSION from archngv.app import ngv from archngv.app.logger import LOGGER, setup_logging -from archngv.version import VERSION + +_PACKAGE = importlib.resources.files(__package__) @click.group("ngv", help=__doc__.format(esc="\b")) @@ -79,8 +83,7 @@ def copy_and_overwrite(from_path, to_path): if not project_dir.exists(): os.mkdir(project_dir) - exemplar_dir = Path(pkg_resources.resource_filename(__name__, "exemplar")) - + exemplar_dir = _PACKAGE / "app/exemplar" copy_and_overwrite(exemplar_dir / "bioname", project_dir / "bioname") copy_and_overwrite(exemplar_dir / "run.sh", project_dir / "run.sh") copy_and_overwrite(exemplar_dir / "launch.sbatch", project_dir / "launch.sbatch") @@ -93,7 +96,7 @@ def copy_and_overwrite(from_path, to_path): @app.command(name="snakefile-path") def snakefile_path(): """Outputs a path to the default Snakefile.""" - click.echo(pkg_resources.resource_filename(__name__, "snakemake/Snakefile")) + click.echo(_PACKAGE / "app/snakemake/Snakefile") def _index(args, *opts): @@ -144,7 +147,7 @@ def _run_snakemake_process(cmd, errorcode=1): "--snakefile", required=False, type=click.Path(exists=True, dir_okay=False), - default=pkg_resources.resource_filename(__name__, "snakemake/Snakefile"), + default=_PACKAGE / "app/snakemake/Snakefile", show_default=True, help="Path to workflow definition in form of a snakefile.", ) @@ -161,7 +164,7 @@ def run( """ args = ctx.args if snakefile is None: - snakefile = pkg_resources.resource_filename(__name__, "snakemake/Snakefile") + snakefile = _PACKAGE / "app/snakemake/Snakefile" assert Path(snakefile).is_file(), f'Snakefile "{snakefile}" does not exist!' assert _index(args, "--config", "-C") is None, "snakemake `--config` option is not allowed" diff --git a/archngv/app/logger.py b/archngv/app/logger.py index 4fb3ec2..fb5f661 100644 --- a/archngv/app/logger.py +++ b/archngv/app/logger.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Logging utilities. """ diff --git a/archngv/app/ngv.py b/archngv/app/ngv.py index 1b11ade..6efb103 100644 --- a/archngv/app/ngv.py +++ b/archngv/app/ngv.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ngv cli""" # pylint: disable=too-many-statements from pathlib import Path @@ -65,7 +67,7 @@ def cell_placement(config, atlas, atlas_cache, vasculature, seed, population_nam astrocytic somata. """ # pylint: disable=too-many-locals - from spatial_index import SphereIndexBuilder + from brain_indexer import SphereIndexBuilder from vascpy import PointVasculature from voxcell.nexus.voxelbrain import Atlas diff --git a/archngv/app/utils.py b/archngv/app/utils.py index 4ba56f6..6339251 100644 --- a/archngv/app/utils.py +++ b/archngv/app/utils.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Miscellaneous utilities. """ import json diff --git a/archngv/building/cell_placement/__init__.py b/archngv/building/cell_placement/__init__.py index 97912ca..be4e83c 100644 --- a/archngv/building/cell_placement/__init__.py +++ b/archngv/building/cell_placement/__init__.py @@ -1,2 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Cell Placement """ diff --git a/archngv/building/cell_placement/atlas.py b/archngv/building/cell_placement/atlas.py index a935cd4..d8aee89 100644 --- a/archngv/building/cell_placement/atlas.py +++ b/archngv/building/cell_placement/atlas.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Atlas related class and functions """ diff --git a/archngv/building/cell_placement/energy.py b/archngv/building/cell_placement/energy.py index 3e769c5..bd154f7 100644 --- a/archngv/building/cell_placement/energy.py +++ b/archngv/building/cell_placement/energy.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Energy operator functionality for calculating the potential energy of the spatial point process diff --git a/archngv/building/cell_placement/export.py b/archngv/building/cell_placement/export.py index 2fb5e85..2db43d0 100644 --- a/archngv/building/cell_placement/export.py +++ b/archngv/building/cell_placement/export.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Exporters for the cell placement stage of the NGV pipeline """ diff --git a/archngv/building/cell_placement/generation.py b/archngv/building/cell_placement/generation.py index e8c5cb3..50a45d9 100644 --- a/archngv/building/cell_placement/generation.py +++ b/archngv/building/cell_placement/generation.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Generation algorithms for spatial point pattern """ diff --git a/archngv/building/cell_placement/pattern.py b/archngv/building/cell_placement/pattern.py index e909b0c..2d2133c 100644 --- a/archngv/building/cell_placement/pattern.py +++ b/archngv/building/cell_placement/pattern.py @@ -1,9 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Handles the spatial point pattern generation and spatial indexing for the cell placement """ import numpy -from spatial_index import SphereIndexBuilder +from brain_indexer import SphereIndexBuilder class SpatialSpherePattern: diff --git a/archngv/building/cell_placement/positions.py b/archngv/building/cell_placement/positions.py index cdba62a..19c4980 100644 --- a/archngv/building/cell_placement/positions.py +++ b/archngv/building/cell_placement/positions.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Entry functions to use cell placement """ diff --git a/archngv/building/cell_placement/potentials.py b/archngv/building/cell_placement/potentials.py index 2e8708c..70f0c39 100644 --- a/archngv/building/cell_placement/potentials.py +++ b/archngv/building/cell_placement/potentials.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Function potentials that depend on the distance r """ diff --git a/archngv/building/cell_placement/soma_generation.py b/archngv/building/cell_placement/soma_generation.py index 4d37322..9a1cc89 100644 --- a/archngv/building/cell_placement/soma_generation.py +++ b/archngv/building/cell_placement/soma_generation.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to the soma generation """ diff --git a/archngv/building/checks.py b/archngv/building/checks.py index 9278a62..2dcc3ec 100644 --- a/archngv/building/checks.py +++ b/archngv/building/checks.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Check functions for cell placement """ import logging diff --git a/archngv/building/config.py b/archngv/building/config.py index d179b48..78416b3 100644 --- a/archngv/building/config.py +++ b/archngv/building/config.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """NGV config building functions""" from json.decoder import JSONDecodeError from pathlib import Path diff --git a/archngv/building/connectivity/detail/gliovascular_generation/check.py b/archngv/building/connectivity/detail/gliovascular_generation/check.py index 7970a5d..bf08984 100644 --- a/archngv/building/connectivity/detail/gliovascular_generation/check.py +++ b/archngv/building/connectivity/detail/gliovascular_generation/check.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ various checks for connectivity """ diff --git a/archngv/building/connectivity/detail/gliovascular_generation/graph_connect.py b/archngv/building/connectivity/detail/gliovascular_generation/graph_connect.py index 3bc303d..6216287 100644 --- a/archngv/building/connectivity/detail/gliovascular_generation/graph_connect.py +++ b/archngv/building/connectivity/detail/gliovascular_generation/graph_connect.py @@ -1,9 +1,11 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Connect astrocytes with vasculature targets """ import logging import numpy as np -from spatial_index import PointIndexBuilder +from brain_indexer import PointIndexBuilder from archngv.spatial import collision from archngv.utils.statistics import truncated_normal diff --git a/archngv/building/connectivity/detail/gliovascular_generation/graph_reachout.py b/archngv/building/connectivity/detail/gliovascular_generation/graph_reachout.py index d871735..2fbf77b 100644 --- a/archngv/building/connectivity/detail/gliovascular_generation/graph_reachout.py +++ b/archngv/building/connectivity/detail/gliovascular_generation/graph_reachout.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Contains strategies that can be deployed by astrocytes in order to determine the sites of contact with the vasculature """ diff --git a/archngv/building/connectivity/detail/gliovascular_generation/graph_targeting.py b/archngv/building/connectivity/detail/gliovascular_generation/graph_targeting.py index c1f709d..7a7a034 100644 --- a/archngv/building/connectivity/detail/gliovascular_generation/graph_targeting.py +++ b/archngv/building/connectivity/detail/gliovascular_generation/graph_targeting.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """graph targeting""" import numpy as np diff --git a/archngv/building/connectivity/detail/gliovascular_generation/surface_intersection.py b/archngv/building/connectivity/detail/gliovascular_generation/surface_intersection.py index 9adf93a..e536725 100644 --- a/archngv/building/connectivity/detail/gliovascular_generation/surface_intersection.py +++ b/archngv/building/connectivity/detail/gliovascular_generation/surface_intersection.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions for the calculation of surface endfeet targets from their graph skeleton targets and the somata positions. """ diff --git a/archngv/building/connectivity/glialglial.py b/archngv/building/connectivity/glialglial.py index 76f4607..006b1ef 100644 --- a/archngv/building/connectivity/glialglial.py +++ b/archngv/building/connectivity/glialglial.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Generation of connectivity of glial with their neighbors via the formation of gap junctions.""" import logging diff --git a/archngv/building/connectivity/gliovascular.py b/archngv/building/connectivity/gliovascular.py index 368516c..acc792d 100644 --- a/archngv/building/connectivity/gliovascular.py +++ b/archngv/building/connectivity/gliovascular.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Facade classes for NGV connectivity """ diff --git a/archngv/building/connectivity/neuroglial_generation.py b/archngv/building/connectivity/neuroglial_generation.py index 6eb683f..52a4c45 100644 --- a/archngv/building/connectivity/neuroglial_generation.py +++ b/archngv/building/connectivity/neuroglial_generation.py @@ -1,12 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Neuroglial Connectivity """ import logging from builtins import range +import brain_indexer import numpy as np import pandas as pd -import spatial_index from archngv.spatial.collision import convex_shape_with_spheres @@ -60,7 +62,7 @@ def generate_neuroglial(astrocytes, microdomains, neuronal_connectivity, synapse synapse_coordinates = neuronal_connectivity.synapse_positions() synapse_to_neuron = neuronal_connectivity.target_neurons() - index = spatial_index.open_index(synapses_index_path) + index = brain_indexer.open_index(synapses_index_path) ret = [] for astrocyte_id in range(len(astrocytes.properties)): diff --git a/archngv/building/endfeet_reconstruction/area_generation.py b/archngv/building/endfeet_reconstruction/area_generation.py index dd70b8d..0c248a3 100644 --- a/archngv/building/endfeet_reconstruction/area_generation.py +++ b/archngv/building/endfeet_reconstruction/area_generation.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Endfeet areas generation processing """ import logging diff --git a/archngv/building/endfeet_reconstruction/area_mapping.py b/archngv/building/endfeet_reconstruction/area_mapping.py index 73bcbbb..243ad62 100644 --- a/archngv/building/endfeet_reconstruction/area_mapping.py +++ b/archngv/building/endfeet_reconstruction/area_mapping.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions for transforming endfeet meshes from overshoot distribution down to the biological target mesh area """ diff --git a/archngv/building/endfeet_reconstruction/area_shrinking.py b/archngv/building/endfeet_reconstruction/area_shrinking.py index f50aa5a..19da86f 100644 --- a/archngv/building/endfeet_reconstruction/area_shrinking.py +++ b/archngv/building/endfeet_reconstruction/area_shrinking.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions to reduce the area of surface meshes using travel time from fmm simulation """ diff --git a/archngv/building/endfeet_reconstruction/fast_marching_method.py b/archngv/building/endfeet_reconstruction/fast_marching_method.py index 72bc925..b166112 100644 --- a/archngv/building/endfeet_reconstruction/fast_marching_method.py +++ b/archngv/building/endfeet_reconstruction/fast_marching_method.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """fast marching method growing""" import logging from collections import deque diff --git a/archngv/building/endfeet_reconstruction/gliovascular_properties.py b/archngv/building/endfeet_reconstruction/gliovascular_properties.py index 4bde0e0..b6a5eba 100644 --- a/archngv/building/endfeet_reconstruction/gliovascular_properties.py +++ b/archngv/building/endfeet_reconstruction/gliovascular_properties.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Endfeet properties to be added to the gliovascular edge population file""" from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, Iterator, Tuple diff --git a/archngv/building/endfeet_reconstruction/groups.py b/archngv/building/endfeet_reconstruction/groups.py index 4d78c09..447890e 100644 --- a/archngv/building/endfeet_reconstruction/groups.py +++ b/archngv/building/endfeet_reconstruction/groups.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to grouping """ diff --git a/archngv/building/exporters.py b/archngv/building/exporters.py index c2614d4..a298139 100644 --- a/archngv/building/exporters.py +++ b/archngv/building/exporters.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """SONATA node and edge population exporters""" import logging from pathlib import Path diff --git a/archngv/building/legacy.py b/archngv/building/legacy.py index 517edd3..d230300 100644 --- a/archngv/building/legacy.py +++ b/archngv/building/legacy.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Functions for conversion from old formats""" import shutil from pathlib import Path diff --git a/archngv/building/microdomains.py b/archngv/building/microdomains.py index 98fd3cf..484563e 100644 --- a/archngv/building/microdomains.py +++ b/archngv/building/microdomains.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Tessellation generation and overlap """ diff --git a/archngv/building/morphology_synthesis/annotation.py b/archngv/building/morphology_synthesis/annotation.py index 5d3ee51..b51421a 100644 --- a/archngv/building/morphology_synthesis/annotation.py +++ b/archngv/building/morphology_synthesis/annotation.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Annotations for synapses and endfeet surface targets """ import morphio diff --git a/archngv/building/morphology_synthesis/data_extraction.py b/archngv/building/morphology_synthesis/data_extraction.py index 7300078..e47837a 100644 --- a/archngv/building/morphology_synthesis/data_extraction.py +++ b/archngv/building/morphology_synthesis/data_extraction.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Data extraction for synthesis workers """ import json diff --git a/archngv/building/morphology_synthesis/data_structures.py b/archngv/building/morphology_synthesis/data_structures.py index ed88b09..9d65193 100644 --- a/archngv/building/morphology_synthesis/data_structures.py +++ b/archngv/building/morphology_synthesis/data_structures.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Morphology synthesis data structures""" from collections import namedtuple diff --git a/archngv/building/morphology_synthesis/domain_boundary.py b/archngv/building/morphology_synthesis/domain_boundary.py index bd8eaaa..421fb1c 100644 --- a/archngv/building/morphology_synthesis/domain_boundary.py +++ b/archngv/building/morphology_synthesis/domain_boundary.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Boundary stopping class """ diff --git a/archngv/building/morphology_synthesis/domain_orientation.py b/archngv/building/morphology_synthesis/domain_orientation.py index bad1889..80cc46e 100644 --- a/archngv/building/morphology_synthesis/domain_orientation.py +++ b/archngv/building/morphology_synthesis/domain_orientation.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to the calculation of the trunk orientation from the geometry of the microdomain """ diff --git a/archngv/building/morphology_synthesis/endfoot_compartment.py b/archngv/building/morphology_synthesis/endfoot_compartment.py index 4491829..94144f2 100644 --- a/archngv/building/morphology_synthesis/endfoot_compartment.py +++ b/archngv/building/morphology_synthesis/endfoot_compartment.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Endfoot equivalent compartment for NEURON """ diff --git a/archngv/building/morphology_synthesis/endoplasmic_reticulum.py b/archngv/building/morphology_synthesis/endoplasmic_reticulum.py index 7dce8da..960eb81 100644 --- a/archngv/building/morphology_synthesis/endoplasmic_reticulum.py +++ b/archngv/building/morphology_synthesis/endoplasmic_reticulum.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Endoplasmic reticulum data creation and distribution methods """ diff --git a/archngv/building/morphology_synthesis/full_astrocyte.py b/archngv/building/morphology_synthesis/full_astrocyte.py index b256956..12e5fb0 100644 --- a/archngv/building/morphology_synthesis/full_astrocyte.py +++ b/archngv/building/morphology_synthesis/full_astrocyte.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Synthesis entry function """ import logging diff --git a/archngv/building/morphology_synthesis/neuroglial_properties.py b/archngv/building/morphology_synthesis/neuroglial_properties.py index b41fcf5..aef8e25 100644 --- a/archngv/building/morphology_synthesis/neuroglial_properties.py +++ b/archngv/building/morphology_synthesis/neuroglial_properties.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Astrocyte morphology properties that are attached to the neuroglial connectivity following synthesis """ diff --git a/archngv/building/morphology_synthesis/perimeters.py b/archngv/building/morphology_synthesis/perimeters.py index 0e9b201..1a66e78 100644 --- a/archngv/building/morphology_synthesis/perimeters.py +++ b/archngv/building/morphology_synthesis/perimeters.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Perimeter distribution on morphologies """ from collections import deque diff --git a/archngv/building/morphology_synthesis/properties.py b/archngv/building/morphology_synthesis/properties.py index a7c52c5..06039c9 100644 --- a/archngv/building/morphology_synthesis/properties.py +++ b/archngv/building/morphology_synthesis/properties.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Astrocyte post synthesis properties """ import os diff --git a/archngv/building/morphology_synthesis/tns_wrapper.py b/archngv/building/morphology_synthesis/tns_wrapper.py index 9bebccb..1cd6e21 100644 --- a/archngv/building/morphology_synthesis/tns_wrapper.py +++ b/archngv/building/morphology_synthesis/tns_wrapper.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Wrapper of TNS AstrocyteGrower. It takes care of all the functionality required for astrocyte synthesis. """ diff --git a/archngv/building/types.py b/archngv/building/types.py index 4fac78a..1160104 100644 --- a/archngv/building/types.py +++ b/archngv/building/types.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Astrocyte and neuron type mappings """ ASTROCYTE_TO_NEURON = {"soma": "soma", "endfoot": "axon", "domain_process": "basal"} diff --git a/archngv/core/__init__.py b/archngv/core/__init__.py index 00c4280..b9cbe1d 100644 --- a/archngv/core/__init__.py +++ b/archngv/core/__init__.py @@ -1,2 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Data structures for ngv data and connectivity """ diff --git a/archngv/core/circuit.py b/archngv/core/circuit.py index d4cce32..b00dd16 100644 --- a/archngv/core/circuit.py +++ b/archngv/core/circuit.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """High level Circuit container. All NGV data can be accessed from here. It uses bluepysnap.circuit.Circuit as main backend. diff --git a/archngv/core/constants.py b/archngv/core/constants.py index 94a7457..4031162 100644 --- a/archngv/core/constants.py +++ b/archngv/core/constants.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """NGV constant container for the different ngv objects""" # redirection of useful snap containers for neuronal circuits. This allows diff --git a/archngv/core/cut_points.py b/archngv/core/cut_points.py index 61c016f..550203c 100644 --- a/archngv/core/cut_points.py +++ b/archngv/core/cut_points.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Data structure for cut point representation """ diff --git a/archngv/core/datasets.py b/archngv/core/datasets.py index e16d3cc..1f0fcb9 100644 --- a/archngv/core/datasets.py +++ b/archngv/core/datasets.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Archngv dataset classes.""" import collections.abc from dataclasses import dataclass diff --git a/archngv/core/pytouchreader/__init__.py b/archngv/core/pytouchreader/__init__.py index 4da45ca..6f0bd93 100644 --- a/archngv/core/pytouchreader/__init__.py +++ b/archngv/core/pytouchreader/__init__.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + ################################################################################ # Copyright (C) 2017 EPFL - BlueBrain Project # diff --git a/archngv/core/pytouchreader/_touches.py b/archngv/core/pytouchreader/_touches.py index fa06857..1c4eff7 100644 --- a/archngv/core/pytouchreader/_touches.py +++ b/archngv/core/pytouchreader/_touches.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + # pylint: disable-all from __future__ import absolute_import, division, print_function diff --git a/archngv/core/pytouchreader/caching.py b/archngv/core/pytouchreader/caching.py index 22eefb1..7de7f47 100644 --- a/archngv/core/pytouchreader/caching.py +++ b/archngv/core/pytouchreader/caching.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + # pylint: disable-all import logging diff --git a/archngv/core/pytouchreader/utils.py b/archngv/core/pytouchreader/utils.py index 793ee11..b6a9f7e 100644 --- a/archngv/core/pytouchreader/utils.py +++ b/archngv/core/pytouchreader/utils.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + # pylint: disable-all import re diff --git a/archngv/core/sonata_readers.py b/archngv/core/sonata_readers.py index 524c4bf..deb316d 100644 --- a/archngv/core/sonata_readers.py +++ b/archngv/core/sonata_readers.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """h5 readers are simple standalone sonata readers using libsonata that prevents in memory loading of data and does not need circuit vision/config files.""" import libsonata diff --git a/archngv/core/structures.py b/archngv/core/structures.py index 991dfd3..40708fa 100644 --- a/archngv/core/structures.py +++ b/archngv/core/structures.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """This module combines all the NGV lazy data structures.""" diff --git a/archngv/exceptions.py b/archngv/exceptions.py index 424b294..69e9576 100644 --- a/archngv/exceptions.py +++ b/archngv/exceptions.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Cell placement exceptions """ diff --git a/archngv/spatial/__init__.py b/archngv/spatial/__init__.py index c572fe7..1d5504d 100644 --- a/archngv/spatial/__init__.py +++ b/archngv/spatial/__init__.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Package for spatial operations """ from .bounding_box import BoundingBox diff --git a/archngv/spatial/bounding_box.py b/archngv/spatial/bounding_box.py index 9713cb5..3cfe256 100644 --- a/archngv/spatial/bounding_box.py +++ b/archngv/spatial/bounding_box.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Bounding box related functions """ # pylint: disable = too-many-locals diff --git a/archngv/spatial/collision.py b/archngv/spatial/collision.py index cb66bd9..d5e7910 100644 --- a/archngv/spatial/collision.py +++ b/archngv/spatial/collision.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Geometric Collisions Module """ diff --git a/archngv/spatial/gjk_algorithm.py b/archngv/spatial/gjk_algorithm.py index ece203b..bac7a96 100644 --- a/archngv/spatial/gjk_algorithm.py +++ b/archngv/spatial/gjk_algorithm.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ GJK algorithm https://en.wikipedia.org/wiki/Gilbert%E2%80%93Johnson%E2%80%93Keerthi_distance_algorithm """ diff --git a/archngv/spatial/hashmap.py b/archngv/spatial/hashmap.py index 270680e..7ee8111 100644 --- a/archngv/spatial/hashmap.py +++ b/archngv/spatial/hashmap.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Hashmap experimental stuff """ diff --git a/archngv/spatial/inclusion.py b/archngv/spatial/inclusion.py index 8c5811c..7aa33c0 100644 --- a/archngv/spatial/inclusion.py +++ b/archngv/spatial/inclusion.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Geometric inclusion checks """ import numpy as np diff --git a/archngv/spatial/shapes.py b/archngv/spatial/shapes.py index 1d1609a..09a6ca3 100644 --- a/archngv/spatial/shapes.py +++ b/archngv/spatial/shapes.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Shapes Data Structures """ from typing import Set, Tuple diff --git a/archngv/spatial/support_functions.py b/archngv/spatial/support_functions.py index 052afd2..9790a71 100644 --- a/archngv/spatial/support_functions.py +++ b/archngv/spatial/support_functions.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Support functions """ import numpy diff --git a/archngv/spatial/uniform_grid.py b/archngv/spatial/uniform_grid.py index db7e630..8f427e5 100644 --- a/archngv/spatial/uniform_grid.py +++ b/archngv/spatial/uniform_grid.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Uniform grid data structure and algorithms """ diff --git a/archngv/spatial/utils.py b/archngv/spatial/utils.py index 20ca088..41a1cd5 100644 --- a/archngv/spatial/utils.py +++ b/archngv/spatial/utils.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Morphspatial utilities """ diff --git a/archngv/testing.py b/archngv/testing.py index d9672ff..f698786 100644 --- a/archngv/testing.py +++ b/archngv/testing.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Circuit verification testing functions """ from pathlib import Path diff --git a/archngv/utils/__init__.py b/archngv/utils/__init__.py index 1fad1e3..bee3844 100644 --- a/archngv/utils/__init__.py +++ b/archngv/utils/__init__.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Imports """ from . import combinatronics, geometry, linear_algebra diff --git a/archngv/utils/binning.py b/archngv/utils/binning.py index 6a7d8e7..3cf34f3 100644 --- a/archngv/utils/binning.py +++ b/archngv/utils/binning.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Binning utils""" import math diff --git a/archngv/utils/combinatronics.py b/archngv/utils/combinatronics.py index 1173564..b580bf1 100644 --- a/archngv/utils/combinatronics.py +++ b/archngv/utils/combinatronics.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to combinatronics """ import numpy as np diff --git a/archngv/utils/decorators.py b/archngv/utils/decorators.py index e85dccd..1ba0abd 100644 --- a/archngv/utils/decorators.py +++ b/archngv/utils/decorators.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Decorators """ import logging import time diff --git a/archngv/utils/functional.py b/archngv/utils/functional.py index 55de7ee..45bd679 100644 --- a/archngv/utils/functional.py +++ b/archngv/utils/functional.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functional helper functions """ diff --git a/archngv/utils/generics.py b/archngv/utils/generics.py index 0573896..eda39eb 100644 --- a/archngv/utils/generics.py +++ b/archngv/utils/generics.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Generic utilities.""" from collections.abc import Iterable diff --git a/archngv/utils/geometry.py b/archngv/utils/geometry.py index 26ba924..8f70133 100644 --- a/archngv/utils/geometry.py +++ b/archngv/utils/geometry.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to geometry """ import numpy as np diff --git a/archngv/utils/linear_algebra.py b/archngv/utils/linear_algebra.py index 48bf38f..7728546 100644 --- a/archngv/utils/linear_algebra.py +++ b/archngv/utils/linear_algebra.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to linear algebra """ import numpy as np diff --git a/archngv/utils/natural_breaks.py b/archngv/utils/natural_breaks.py index a2b7bb0..09c802d 100644 --- a/archngv/utils/natural_breaks.py +++ b/archngv/utils/natural_breaks.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Natural breaks algorithms """ import numpy as np diff --git a/archngv/utils/ndimage.py b/archngv/utils/ndimage.py index be75b16..c1661dc 100644 --- a/archngv/utils/ndimage.py +++ b/archngv/utils/ndimage.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """Multi-dimensional image (e.g. volumes) utils.""" import logging from typing import Generator, Optional, Tuple diff --git a/archngv/utils/ngons.py b/archngv/utils/ngons.py index f0b15ab..25cba5e 100644 --- a/archngv/utils/ngons.py +++ b/archngv/utils/ngons.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to triangles """ diff --git a/archngv/utils/projections.py b/archngv/utils/projections.py index 9519c11..a9b859b 100644 --- a/archngv/utils/projections.py +++ b/archngv/utils/projections.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Functions related to projections """ diff --git a/archngv/utils/statistics.py b/archngv/utils/statistics.py index 0f0f51d..918f489 100644 --- a/archngv/utils/statistics.py +++ b/archngv/utils/statistics.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + """ Statistics related functions """ from scipy import stats diff --git a/archngv/version.py b/archngv/version.py deleted file mode 100644 index ef24693..0000000 --- a/archngv/version.py +++ /dev/null @@ -1,2 +0,0 @@ -""" archngv version """ -VERSION = "3.2.0.dev0" diff --git a/doc/Makefile b/doc/Makefile deleted file mode 100644 index d0c3cbf..0000000 --- a/doc/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/source/conf.py b/doc/source/conf.py index e3431aa..b86bc85 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -56,6 +56,8 @@ # html_static_path = ['_static'] html_theme_options = { + "repo_url": "https://github.com/BlueBrain/ArchNGV", + "repo_name": "BlueBrain/ArchNGV", "metadata_distribution": "archngv", } diff --git a/pyproject.toml b/pyproject.toml index c10b9c3..4519bbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,100 @@ [build-system] -requires = ["setuptools >= 45.0", "wheel"] +requires = [ + "setuptools>=64", + "setuptools_scm>=8" +] build-backend = "setuptools.build_meta" +[project] +name = "ArchNGV" +description = "NGV architecture modules" +readme = "README.md" +requires-python = ">=3.9" +license = { file = "LICENSE.txt" } +authors = [ + { name = "Blue Brain Project, EPFL" }, +] +dependencies = [ + "numpy>=1.22", + "h5py>=3.1.0", + "scipy>=1.5.0", + # 0.1.21 supports resolution of ngv populations extra files + "libsonata>=0.1.21", + "bluepysnap>=1.0", + "cached-property>=1.5", + "voxcell>=3.0.0", + "vascpy>=0.1.0", + # 3.17.1 is available in spack. + # Update to a higher version in spack after checking that py-atlas-building-tools works + "trimesh>=3.17.1", # Method Trimesh:subdivide_loop is needed + # trimesh soft dependency for using marching cubes + "scikit-image>=0.18", + # requests module pin urrlib3 in recent versions + # see https://github.com/psf/requests/issues/6432 + "urllib3>=1.21.1,<1.27; python_version <= '3.8'", +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: Bio-Informatics", +] +dynamic = ["version"] + +[project.optional-dependencies] +docs = [ + "sphinx-bluebrain-theme" +] +all = [ + "ngv-ctools>=1.0.0", + "Click>=7.0", + "numpy-stl>=2.10", + "openmesh>=1.1.2", + "pyyaml>=5.0", + "pandas>=1.1.0", + "multivoro", + "MorphIO>=3.2.0", + "morph-tool>=2.4.0", + "snakemake>=5.0.0", + "tmd>=2.0.11", + "NeuroTS>=3.4.0", + "diameter-synthesis>=0.5.4", + "dask[distributed,bag]>=2022.04.1", + "dask_mpi>=2.0", + "brain-indexer>=3.0.0", + "atlas-commons>=0.1.4", + "meshio>=5.3.4", +] + +[project.urls] +Homepage = "https://github.com/BlueBrain/ArchNGV" +Repository = "https://github.com/BlueBrain/ArchNGV" +Issues = "https://github.com/BlueBrain/ArchNGV/issues" +Tracker = "https://github.com/BlueBrain/ArchNGV/issues" + +[project.scripts] +ngv = "archngv.app.__main__:app" + +[tool.setuptools.packages.find] +include = ["archngv"] +namespaces = false + +[tool.setuptools_scm] +local_scheme = "no-local-version" + [tool.black] line-length = 100 target-version = [ - 'py38', 'py39', 'py310', + 'py311', + 'py312', ] include = ''' ^/( diff --git a/setup.py b/setup.py deleted file mode 100644 index 74e6c77..0000000 --- a/setup.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python - -import importlib.util - -from setuptools import find_packages, setup - -spec = importlib.util.spec_from_file_location("archngv.version", "archngv/version.py") -module = importlib.util.module_from_spec(spec) -spec.loader.exec_module(module) -VERSION = module.VERSION - - -BUILDING = [ - "ngv-ctools>=1.0.0", - "Click>=7.0", - "numpy-stl>=2.10", - "openmesh>=1.1.2", - "pyyaml>=5.0", - "pandas>=1.1.0", - "multivoro", - "MorphIO>=3.2.0", - "morph-tool>=2.4.0", - "snakemake>=5.0.0", - "tmd>=2.0.11", - "NeuroTS>=3.4.0", - "diameter-synthesis>=0.5.4", - "dask[distributed,bag]>=2022.04.1", - "dask_mpi>=2.0", - "spatial-index>=2.0.0", - "atlas-commons>=0.1.4", - "meshio>=5.3.4", -] - - -setup( - classifiers=[ - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - ], - name="ArchNGV", - version=VERSION, - description="NGV Architecture Modules", - author="Eleftherios Zisis", - author_email="eleftherios.zisis@epfl.ch", - url="https://bbpteam.epfl.ch/documentation/projects/ArchNGV", - project_urls={ - "Tracker": "", - "Source": "https://bbpgitlab.epfl.ch/molsys/ArchNGV.git", - }, - license="BBP-internal-confidential", - install_requires=[ - "numpy>=1.22", - "h5py>=3.1.0", - "scipy>=1.5.0", - # 0.1.21 supports resolution of ngv populations extra files - "libsonata>=0.1.21", - "bluepysnap>=1.0", - "cached-property>=1.5", - "voxcell>=3.0.0", - "vascpy>=0.1.0", - # 3.17.1 is available in spack. - # Update to a higher version in spack after checking that py-atlas-building-tools works - "trimesh>=3.17.1", # Method Trimesh:subdivide_loop is needed - # trimesh soft dependency for using marching cubes - "scikit-image>=0.18", - # requests module pin urrlib3 in recent versions - # see https://github.com/psf/requests/issues/6432 - "urllib3>=1.21.1,<1.27; python_version <= '3.8'", - ], - extras_require={"all": BUILDING, "docs": ["sphinx", "sphinx-bluebrain-theme"]}, - packages=find_packages(), - scripts=[], - entry_points={"console_scripts": ["ngv=archngv.app.__main__:app"]}, - include_package_data=True, -) diff --git a/tox.ini b/tox.ini index 9ccfd54..28ac7f7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [base] name = archngv -files = {[base]name} tests doc/source/conf.py setup.py +files = {[base]name} tests doc/source/conf.py testdeps = pytest jsondiff @@ -9,25 +9,25 @@ testdeps = envlist = check-version lint - py{38,39,310} + py{38,39,310,311,312} functional -ignore_basepython_conflict = true [testenv] extras = all setenv = - PIP_INDEX_URL = https://bbpteam.epfl.ch/repository/devpi/simple - SALLOC_ACCOUNT = {env:SALLOC_ACCOUNT:proj66} deps = {[base]testdeps} commands = pytest tests/unit -basepython = python3.10 -[testenv:check-version] +[testenv:check-packaging] skip_install = true -deps = bbp-nse-ci -commands = do_release.py -p . check-version +deps = + build + twine +commands = + python -m build -o {envtmpdir}/dist + twine check {envtmpdir}/dist/* [testenv:lint] deps = @@ -75,9 +75,14 @@ commands = [testenv:docs] changedir = doc extras = docs -# set warnings as errors using the -W sphinx option -commands = make html SPHINXOPTS=-W -allowlist_externals = make +commands = + sphinx-build -b html \ + {toxinidir}/doc/source \ + {toxinidir}/doc/build/html \ + -d {toxinidir}/doc/build/doctrees \ + -W -T +allowlist_externals = + /bin/mkdir [testenv:format] deps = @@ -98,3 +103,10 @@ commands = exclude = extras,workflow,tests ignore = E126, E127, E128, E203, E731, W503, W504 max-line-length = 100 + +[gh-actions] +python = + 3.9: py39, lint + 3.10: py310, coverage + 3.11: py311, check-packaging + 3.12: py312, docs