neurodamus 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. neurodamus-3.0.0/.coveragerc +23 -0
  2. neurodamus-3.0.0/.gitattributes +2 -0
  3. neurodamus-3.0.0/.github/pull_request_template.md +23 -0
  4. neurodamus-3.0.0/.github/workflows/simulation_test.yml +96 -0
  5. neurodamus-3.0.0/.gitignore +45 -0
  6. neurodamus-3.0.0/.gitlab-ci.yml +262 -0
  7. neurodamus-3.0.0/.gitmodules +0 -0
  8. neurodamus-3.0.0/.pre-commit-config.yaml +13 -0
  9. neurodamus-3.0.0/.readthedocs.yml +21 -0
  10. neurodamus-3.0.0/CHANGES.rst +932 -0
  11. neurodamus-3.0.0/CONTRIBUTING.md +182 -0
  12. neurodamus-3.0.0/LICENSE.txt +201 -0
  13. neurodamus-3.0.0/MANIFEST.in +2 -0
  14. neurodamus-3.0.0/PKG-INFO +334 -0
  15. neurodamus-3.0.0/README.rst +111 -0
  16. neurodamus-3.0.0/_benchmarks/init.py +31 -0
  17. neurodamus-3.0.0/_benchmarks/opti_configure_0.2.2/line_stats.0.txt +542 -0
  18. neurodamus-3.0.0/_benchmarks/opti_configure_0.2.2/line_stats.txt +529 -0
  19. neurodamus-3.0.0/_benchmarks/out.lprof +148 -0
  20. neurodamus-3.0.0/_benchmarks/pydamus.png +0 -0
  21. neurodamus-3.0.0/_benchmarks/synstats.py +64 -0
  22. neurodamus-3.0.0/_benchmarks/timeit.py +32 -0
  23. neurodamus-3.0.0/_debug.py +10 -0
  24. neurodamus-3.0.0/authors.txt +32 -0
  25. neurodamus-3.0.0/ci/build_ndcore.sh +33 -0
  26. neurodamus-3.0.0/core/hoc/Cell.hoc +549 -0
  27. neurodamus-3.0.0/core/hoc/CompartmentMapping.hoc +285 -0
  28. neurodamus-3.0.0/core/hoc/ConfigParser.hoc +293 -0
  29. neurodamus-3.0.0/core/hoc/ConnectionUtils.hoc +38 -0
  30. neurodamus-3.0.0/core/hoc/EStim.hoc +197 -0
  31. neurodamus-3.0.0/core/hoc/ElectrodeManager.hoc +138 -0
  32. neurodamus-3.0.0/core/hoc/Map.hoc +333 -0
  33. neurodamus-3.0.0/core/hoc/MorphIO.hoc +34 -0
  34. neurodamus-3.0.0/core/hoc/RNGSettings.hoc +238 -0
  35. neurodamus-3.0.0/core/hoc/Report.hoc +1006 -0
  36. neurodamus-3.0.0/core/hoc/SerializedSections.hoc +82 -0
  37. neurodamus-3.0.0/core/hoc/ShowProgress.hoc +50 -0
  38. neurodamus-3.0.0/core/hoc/SimSettings.hoc +177 -0
  39. neurodamus-3.0.0/core/hoc/StimulusManager.hoc +1262 -0
  40. neurodamus-3.0.0/core/hoc/TDistFunc.hoc +82 -0
  41. neurodamus-3.0.0/core/hoc/TPointList.hoc +102 -0
  42. neurodamus-3.0.0/core/hoc/TStim.hoc +248 -0
  43. neurodamus-3.0.0/core/hoc/TType.hoc +63 -0
  44. neurodamus-3.0.0/core/hoc/Target.hoc +964 -0
  45. neurodamus-3.0.0/core/hoc/TargetManager.hoc +720 -0
  46. neurodamus-3.0.0/core/hoc/TargetParser.hoc +482 -0
  47. neurodamus-3.0.0/core/hoc/defvar.hoc +34 -0
  48. neurodamus-3.0.0/core/hoc/fileUtils.hoc +47 -0
  49. neurodamus-3.0.0/core/hoc/mapping.py +20 -0
  50. neurodamus-3.0.0/core/hoc/neurodamus.hoc +21 -0
  51. neurodamus-3.0.0/core/mod/ALU.mod +348 -0
  52. neurodamus-3.0.0/core/mod/CoreNEURONArtificialCell.mod +18 -0
  53. neurodamus-3.0.0/core/mod/HDF5reader.mod +1453 -0
  54. neurodamus-3.0.0/core/mod/SonataReportHelper.mod +306 -0
  55. neurodamus-3.0.0/core/mod/SonataReports.mod +184 -0
  56. neurodamus-3.0.0/core/mod/SpikeWriter.mod +142 -0
  57. neurodamus-3.0.0/core/mod/SynapseReader.mod +79 -0
  58. neurodamus-3.0.0/core/mod/VecStim.mod +167 -0
  59. neurodamus-3.0.0/core/mod/coreneuron_modlist.txt +10 -0
  60. neurodamus-3.0.0/core/mod/lookupTableV2.mod +313 -0
  61. neurodamus-3.0.0/core/mod/netstim_inhpoisson.mod +570 -0
  62. neurodamus-3.0.0/core/python/mapping.py +20 -0
  63. neurodamus-3.0.0/docker/Dockerfile +95 -0
  64. neurodamus-3.0.0/docker/README.md +56 -0
  65. neurodamus-3.0.0/docker/build_neurodamus.sh +12 -0
  66. neurodamus-3.0.0/examples/composed_signal.py +17 -0
  67. neurodamus-3.0.0/examples/create_cell.py +44 -0
  68. neurodamus-3.0.0/examples/neuron_first_steps.py +15 -0
  69. neurodamus-3.0.0/examples/neuron_tut1.py +52 -0
  70. neurodamus-3.0.0/examples/neuron_tut2.py +55 -0
  71. neurodamus-3.0.0/examples/test_neurodamus.py +66 -0
  72. neurodamus-3.0.0/init.py +27 -0
  73. neurodamus-3.0.0/neurodamus/__init__.py +25 -0
  74. neurodamus-3.0.0/neurodamus/cell_distributor.py +970 -0
  75. neurodamus-3.0.0/neurodamus/commands.py +215 -0
  76. neurodamus-3.0.0/neurodamus/connection.py +832 -0
  77. neurodamus-3.0.0/neurodamus/connection_manager.py +1294 -0
  78. neurodamus-3.0.0/neurodamus/core/__init__.py +18 -0
  79. neurodamus-3.0.0/neurodamus/core/_engine.py +102 -0
  80. neurodamus-3.0.0/neurodamus/core/_mpi.py +112 -0
  81. neurodamus-3.0.0/neurodamus/core/_neurodamus.py +126 -0
  82. neurodamus-3.0.0/neurodamus/core/_neuron.py +265 -0
  83. neurodamus-3.0.0/neurodamus/core/_shmutils.py +119 -0
  84. neurodamus-3.0.0/neurodamus/core/_utils.py +93 -0
  85. neurodamus-3.0.0/neurodamus/core/cell.py +367 -0
  86. neurodamus-3.0.0/neurodamus/core/configuration.py +1176 -0
  87. neurodamus-3.0.0/neurodamus/core/coreneuron_configuration.py +130 -0
  88. neurodamus-3.0.0/neurodamus/core/mechanisms.py +56 -0
  89. neurodamus-3.0.0/neurodamus/core/nodeset.py +401 -0
  90. neurodamus-3.0.0/neurodamus/core/random.py +91 -0
  91. neurodamus-3.0.0/neurodamus/core/stimuli.py +480 -0
  92. neurodamus-3.0.0/neurodamus/core/synapses.py +115 -0
  93. neurodamus-3.0.0/neurodamus/gap_junction.py +137 -0
  94. neurodamus-3.0.0/neurodamus/hocify.py +75 -0
  95. neurodamus-3.0.0/neurodamus/io/__init__.py +0 -0
  96. neurodamus-3.0.0/neurodamus/io/cell_readers.py +542 -0
  97. neurodamus-3.0.0/neurodamus/io/config_parser.py +86 -0
  98. neurodamus-3.0.0/neurodamus/io/sonata_config.py +450 -0
  99. neurodamus-3.0.0/neurodamus/io/synapse_reader.py +483 -0
  100. neurodamus-3.0.0/neurodamus/lfp_manager.py +90 -0
  101. neurodamus-3.0.0/neurodamus/managers.py +86 -0
  102. neurodamus-3.0.0/neurodamus/metype.py +402 -0
  103. neurodamus-3.0.0/neurodamus/modification_manager.py +167 -0
  104. neurodamus-3.0.0/neurodamus/morphio_wrapper.py +382 -0
  105. neurodamus-3.0.0/neurodamus/neuromodulation_manager.py +136 -0
  106. neurodamus-3.0.0/neurodamus/ngv.py +557 -0
  107. neurodamus-3.0.0/neurodamus/node.py +1993 -0
  108. neurodamus-3.0.0/neurodamus/replay.py +168 -0
  109. neurodamus-3.0.0/neurodamus/stimulus_manager.py +766 -0
  110. neurodamus-3.0.0/neurodamus/target_manager.py +717 -0
  111. neurodamus-3.0.0/neurodamus/utils/__init__.py +9 -0
  112. neurodamus-3.0.0/neurodamus/utils/cli.py +27 -0
  113. neurodamus-3.0.0/neurodamus/utils/compat.py +167 -0
  114. neurodamus-3.0.0/neurodamus/utils/logging.py +137 -0
  115. neurodamus-3.0.0/neurodamus/utils/memory.py +337 -0
  116. neurodamus-3.0.0/neurodamus/utils/multimap.py +149 -0
  117. neurodamus-3.0.0/neurodamus/utils/progressbar.py +256 -0
  118. neurodamus-3.0.0/neurodamus/utils/pyutils.py +208 -0
  119. neurodamus-3.0.0/neurodamus/utils/timeit.py +270 -0
  120. neurodamus-3.0.0/neurodamus.egg-info/PKG-INFO +334 -0
  121. neurodamus-3.0.0/neurodamus.egg-info/SOURCES.txt +128 -0
  122. neurodamus-3.0.0/neurodamus.egg-info/dependency_links.txt +1 -0
  123. neurodamus-3.0.0/neurodamus.egg-info/entry_points.txt +3 -0
  124. neurodamus-3.0.0/neurodamus.egg-info/requires.txt +12 -0
  125. neurodamus-3.0.0/neurodamus.egg-info/top_level.txt +11 -0
  126. neurodamus-3.0.0/pyproject.toml +53 -0
  127. neurodamus-3.0.0/requirements.txt +4 -0
  128. neurodamus-3.0.0/requirements_docs.txt +3 -0
  129. neurodamus-3.0.0/setup.cfg +4 -0
  130. neurodamus-3.0.0/tox.ini +64 -0
@@ -0,0 +1,23 @@
1
+ # .coveragerc to control coverage.py
2
+ [run]
3
+ branch = True
4
+ source = neurodamus
5
+ # omit =
6
+
7
+ [report]
8
+ # Regexes for lines to exclude from consideration
9
+ exclude_lines =
10
+ # Have to re-enable the standard pragma
11
+ pragma: no cover
12
+
13
+ # Don't complain about missing debug-only code:
14
+ def __repr__
15
+ if self\.debug
16
+
17
+ # Don't complain if tests don't hit defensive assertion code:
18
+ raise AssertionError
19
+ raise NotImplementedError
20
+
21
+ # Don't complain if non-runnable code isn't run:
22
+ if 0:
23
+ if __name__ == .__main__.:
@@ -0,0 +1,2 @@
1
+ *.asc linguist-detectable=false
2
+ *.mod linguist-detectable=false
@@ -0,0 +1,23 @@
1
+ ## Context
2
+ <!-- Please brifly describe the problem the PR solves and what the solution was -->
3
+
4
+ ## Scope
5
+ <!--
6
+ Please describe in more detail the several changes implemented. How did we solve it?
7
+ E.g. change component-A to..., created a new data structure, etc...
8
+ -->
9
+
10
+ ## Testing
11
+ <!--
12
+ Please add a new test under `tests`. Consider the following cases:
13
+
14
+ 1. If the change is in an independent component (e.g, a new container type, a parser, etc) a bare unit test should be sufficient. See e.g. `tests/test_coords.py`
15
+ 2. If you are fixing or adding components supporting a scientific use case, affecting node or synapse creation, etc..., which typically rely on Neuron, tests should set up a simulation using that feature, instantiate neurodamus, **assess the state**, run the simulation and check the results are as expected.
16
+ See an example at `tests/test_simulation.py#L66`
17
+ -->
18
+
19
+ ## Review
20
+ * [ ] PR description is complete
21
+ * [ ] Coding style (imports, function length, New functions, classes or files) are good
22
+ * [ ] Unit/Scientific test added
23
+ * [ ] Updated Readme, in-code, developer documentation
@@ -0,0 +1,96 @@
1
+ name: neurodamus build and test
2
+ on:
3
+ schedule:
4
+ # every evening at 20:00 UTC
5
+ - cron: '0 20 * * *'
6
+
7
+ jobs:
8
+ simulation:
9
+ runs-on: ubuntu-22.04
10
+
11
+ steps:
12
+ - name: Checkout neurodamus repository
13
+ uses: actions/checkout@v3
14
+ with:
15
+ ref: ${{ github.event.pull_request.head.sha }}
16
+ fetch-depth: 0
17
+
18
+ - name: Get HEAD commit message and look for branches
19
+ run: |
20
+ COMMIT_MESSAGE=$(git log -1 --pretty=%B)
21
+ echo $COMMIT_MESSAGE
22
+ NEURON_BRANCH=$(echo $COMMIT_MESSAGE | grep -Po 'NEURON_BRANCH=\K[0-9a-zA-Z/_.\-]*' || true)
23
+ if [[ ! -z $NEURON_BRANCH ]]; then echo "NEURON_BRANCH=$NEURON_BRANCH" >> $GITHUB_ENV; fi
24
+ LIBSONATA_REPORT_BRANCH=$(echo $COMMIT_MESSAGE | grep -Po 'LIBSONATA_REPORT_BRANCH=\K[0-9a-zA-Z/_.\-]*' || true)
25
+ if [[ ! -z $LIBSONATA_REPORT_BRANCH ]]; then echo "LIBSONATA_REPORT_BRANCH=$LIBSONATA_REPORT_BRANCH" >> $GITHUB_ENV; fi
26
+
27
+ - name: Install hdf5-mpich
28
+ run: |
29
+ sudo apt-get update
30
+ sudo apt-get install mpich libmpich-dev libhdf5-mpich-dev hdf5-tools
31
+
32
+ - name: Install libsonata
33
+ run: |
34
+ CC=mpicc CXX=mpic++ pip install git+https://github.com/BlueBrain/libsonata
35
+
36
+ - name: Install libsonatareport
37
+ run: |
38
+ git clone --branch="${LIBSONATA_REPORT_BRANCH:-master}" https://github.com/BlueBrain/libsonatareport.git --recursive --depth=1
39
+ cd libsonatareport
40
+ mkdir build && cd build
41
+ cmake -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DCMAKE_BUILD_TYPE=Release -DSONATA_REPORT_ENABLE_SUBMODULES=ON -DSONATA_REPORT_ENABLE_MPI=ON ..
42
+ cmake --build . --parallel
43
+ cmake --build . --target install
44
+
45
+ - name: Install NEURON
46
+ run: |
47
+ sudo apt-get install flex libfl-dev bison ninja-build
48
+ pip install -U pip setuptools
49
+ pip install "cython<3" pytest sympy
50
+ export SONATAREPORT_DIR=$(pwd)/libsonatareport/build/install
51
+ git clone --branch="${NEURON_BRANCH:-master}" https://github.com/neuronsimulator/nrn.git --depth=1
52
+ cd nrn
53
+ mkdir build && cd build
54
+ cmake -G Ninja -DPYTHON_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DNRN_ENABLE_MPI=ON -DNRN_ENABLE_INTERVIEWS=OFF \
55
+ -DNRN_ENABLE_CORENEURON=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCORENRN_ENABLE_REPORTING=ON -DCMAKE_PREFIX_PATH=$SONATAREPORT_DIR ..
56
+ cmake --build . --parallel
57
+ cmake --build . --target install
58
+
59
+ - name: Build h5py with the local hdf5
60
+ run: |
61
+ pip install -U pip setuptools
62
+ pip install cython numpy wheel pkgconfig
63
+ MPICC="mpicc -shared" pip install --no-cache-dir --no-binary=mpi4py mpi4py
64
+ CC="mpicc" HDF5_MPI="ON" HDF5_INCLUDEDIR=/usr/include/hdf5/mpich HDF5_LIBDIR=/usr/lib/x86_64-linux-gnu/hdf5/mpich \
65
+ pip install --no-cache-dir --no-binary=h5py h5py --no-build-isolation
66
+
67
+ - name: Install neurodamus
68
+ run: |
69
+ pip install .
70
+
71
+ - name: Build models
72
+ run: |
73
+ export SONATAREPORT_DIR=$(pwd)/libsonatareport/build/install
74
+ export PATH=$(pwd)/nrn/build/install/bin:$PATH
75
+ # copy mod files from the Zenodo link
76
+ wget --output-document="O1_mods.xz" --quiet "https://zenodo.org/record/8026353/files/O1_mods.xz?download=1"
77
+ tar -xf O1_mods.xz
78
+ cp -r mod tests/share/
79
+ cp core/mod/*.mod tests/share/mod/
80
+ ./docker/build_neurodamus.sh tests/share/mod
81
+
82
+ - name: Example run
83
+ run: |
84
+ export PYTHONPATH=$(pwd)/nrn/build/lib/python:$PYTHONPATH
85
+ cp core/hoc/* tests/share/hoc/
86
+ export HOC_LIBRARY_PATH=$(pwd)/tests/share/hoc
87
+ # launch simulation with NEURON
88
+ mpirun -np 2 ./x86_64/special -mpi -python init.py --configFile=tests/simulations/usecase3/simulation_sonata.json
89
+ ls tests/simulations/usecase3/reporting/*.h5
90
+ # launch simulation with CORENEURON
91
+ mpirun -np 2 ./x86_64/special -mpi -python init.py --configFile=tests/simulations/usecase3/simulation_sonata_coreneuron.json
92
+ ls tests/simulations/usecase3/reporting_coreneuron/*.h5
93
+
94
+ # - name: live debug session, comment out
95
+ # if: failure()
96
+ # uses: mxschmitt/action-tmate@v3
@@ -0,0 +1,45 @@
1
+ # Temporary and binary files
2
+ *~
3
+ *.py[cod]
4
+ *.so
5
+ *.cfg
6
+ !setup.cfg
7
+ *.orig
8
+ *.log
9
+ *.pot
10
+ __pycache__/*
11
+ .cache/*
12
+ .*.swp
13
+ */.ipynb_checkpoints/*
14
+ .vscode
15
+ spack-*
16
+
17
+ # Project files
18
+ .ropeproject
19
+ .project
20
+ .pydevproject
21
+ .settings
22
+ .idea
23
+ venv
24
+
25
+ # Package files
26
+ *.egg
27
+ *.eggs/
28
+ .installed.cfg
29
+ *.egg-info
30
+
31
+ # Unittest and coverage
32
+ htmlcov/*
33
+ .coverage
34
+ .tox
35
+ junit.xml
36
+ coverage.xml
37
+ tests/output
38
+
39
+ # Build and docs folder/files
40
+ build/*
41
+ dist/*
42
+ sdist/*
43
+ docs/_build/*
44
+ cover/*
45
+ MANIFEST
@@ -0,0 +1,262 @@
1
+ include:
2
+ - project: nse/ci
3
+ file:
4
+ - /ci/lib/tox-bb5.yml
5
+ - /ci/jobs/build-package.yml
6
+ - /ci/jobs/publish-package.yml
7
+ - /ci/jobs/docs.yml
8
+ - /ci/jobs/publish-docs.yml
9
+ - project: hpc/gitlab-upload-logs
10
+ file: enable-upload.yml
11
+ - project: cs/gitlabci-templates
12
+ file: /build-image-using-buildah.yml
13
+
14
+ workflow:
15
+ rules:
16
+ - if: '$CI_EXTERNAL_PULL_REQUEST_IID'
17
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
18
+ - if: $CI_PIPELINE_SOURCE == "web"
19
+ # Run workflows on tag creation to build the container
20
+ - if: $CI_COMMIT_TAG
21
+
22
+ variables:
23
+ BLUECONFIGS_BRANCH:
24
+ value: $BLUECONFIGS_BRANCH
25
+ description: 'Name of the blueconfigs branch to test against'
26
+ GIT_DEPTH: 100
27
+
28
+ test-unit:
29
+ extends: .tox-template
30
+ variables:
31
+ TOXENV: flake8, unit
32
+
33
+ test-integration:
34
+ extends: .tox-template
35
+ variables:
36
+ TOXENV: integration
37
+
38
+ test-integration-e2e:
39
+ extends: .tox-template
40
+ variables:
41
+ TOXENV: bbp-model
42
+ TOX_OPTIONS: "-- tests/integration-e2e"
43
+ # modules need to be loaded in this certain order to avoid mixing of libraries
44
+ EXTRA_MODULES:
45
+ unstable:neurodamus-neocortex
46
+
47
+ test-scientific:
48
+ extends: .tox-template
49
+ variables:
50
+ TOXENV: bbp-model
51
+ TOX_OPTIONS: "-- tests/scientific"
52
+ # modules need to be loaded in this certain order to avoid mixing of libraries
53
+ EXTRA_MODULES:
54
+ unstable:intel-oneapi-compilers
55
+ unstable:py-bluepysnap
56
+ unstable:neurodamus-neocortex
57
+
58
+ test-scientific-ngv:
59
+ extends: .tox-template
60
+ variables:
61
+ TOXENV: bbp-model
62
+ TOX_OPTIONS: "-- tests/scientific-ngv"
63
+ EXTRA_MODULES:
64
+ unstable:neurodamus-neocortex-multiscale
65
+
66
+ set_alt_branches:
67
+ script:
68
+ - grep '^[[:alnum:]_]*_BRANCH=' <<< "$CI_COMMIT_MESSAGE" > branch_variables.env || touch branch_variables.env
69
+ - . branch_variables.env
70
+ - echo "BLUECONFIGS_PIPELINE_BRANCH=$BLUECONFIGS_BRANCH" >> branch_variables.env
71
+ - cat branch_variables.env
72
+ artifacts:
73
+ reports:
74
+ dotenv: branch_variables.env
75
+
76
+ blueconfig_tests:
77
+ variables:
78
+ bb5_build_dir: pipeline
79
+ PY_NEURODAMUS_BRANCH: $CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME
80
+ PARENT_COMMIT_MESSAGE: $CI_COMMIT_MESSAGE
81
+ trigger:
82
+ project: hpc/sim/blueconfigs
83
+ branch: $BLUECONFIGS_PIPELINE_BRANCH
84
+ strategy: depend
85
+ needs:
86
+ - set_alt_branches
87
+ rules:
88
+ - if: '$CI_EXTERNAL_PULL_REQUEST_IID'
89
+ changes:
90
+ - neurodamus/**/*
91
+ - when: manual
92
+ allow_failure: true
93
+
94
+ configure-docker-image:
95
+ image: ubuntu:22.04
96
+ stage: build
97
+ script:
98
+ - set -x
99
+ - apt-get update -y
100
+ - apt-get install -y git skopeo python3
101
+ - |
102
+ echo "Getting package version and checking whether we need to build the container"
103
+ if [ -n "${LIBSONATAREPORT_TAG}" || -n "${LIBSONATA_TAG}" || -n "${NEURON_COMMIT_ID}" && -z "${REGISTRY_IMAGE_TAG}" ]; then
104
+ echo "If you specify LIBSONATAREPORT_TAG, LIBSONATA_TAG or NEURON_COMMIT_ID, you must also specify REGISTRY_IMAGE_TAG."
105
+ exit 1
106
+ fi
107
+ if [ -z "${REGISTRY_IMAGE_TAG}" ]; then
108
+ PACKAGE_VERSION=$(git describe --tags)
109
+ REGISTRY_IMAGE_TAG=$(echo ${PACKAGE_VERSION%-*} | sed 's/-/.dev/')
110
+ fi
111
+ set +e
112
+ skopeo inspect docker://bluebrain/neurodamus:${REGISTRY_IMAGE_TAG}
113
+ if [[ $? -eq 0 ]]; then
114
+ echo "Container with version ${REGISTRY_IMAGE_TAG} already exists - not rebuilding"
115
+ BUILD_DOCKER_CONTAINER="false"
116
+ else
117
+ echo "Container with version ${REGISTRY_IMAGE_TAG} does not exist yet - building"
118
+ BUILD_DOCKER_CONTAINER="true"
119
+ fi
120
+ set -e
121
+ - |
122
+ echo "Getting dependency versions from spack"
123
+ git clone https://github.com/bluebrain/spack
124
+ cd spack
125
+ source ./share/spack/setup-env.sh
126
+ if [ -z "${LIBSONATAREPORT_TAG}" ]; then
127
+ LIBSONATAREPORT_TAG=$(spack info libsonata-report | awk 'matched{print $NF;matched=0} /Preferred/{matched=1}')
128
+ fi
129
+ if [ -z "${LIBSONATA_TAG}" ]; then
130
+ LIBSONATA_TAG=v$(spack info py-libsonata | awk 'matched{print $1;matched=0} /Preferred/{matched=1}')
131
+ fi
132
+ if [ -z "${NEURON_COMMIT_ID}" ]; then
133
+ NEURON_COMMIT_ID=$(spack info neuron | awk 'matched{print $NF;matched=0} /Preferred/{matched=1}')
134
+ fi
135
+ cd ..
136
+ - |
137
+ cat <<EOF > build.env
138
+ REGISTRY_IMAGE_TAG=$REGISTRY_IMAGE_TAG
139
+ BUILD_DOCKER_CONTAINER=$BUILD_DOCKER_CONTAINER
140
+ LIBSONATAREPORT_TAG=${LIBSONATAREPORT_TAG}
141
+ LIBSONATA_TAG=${LIBSONATA_TAG}
142
+ NEURON_COMMIT_ID=${NEURON_COMMIT_ID}
143
+ EOF
144
+ - cat build.env
145
+ artifacts:
146
+ when: always
147
+ paths: [build.env]
148
+ reports:
149
+ dotenv: build.env
150
+ rules:
151
+ - if: $CI_COMMIT_TAG
152
+ when: manual
153
+ allow_failure: true
154
+ - if: $CI_PIPELINE_SOURCE == "web"
155
+
156
+ build-docker-image:
157
+ timeout: 2h
158
+ needs: [configure-docker-image]
159
+ stage: build
160
+ extends: .build-image-using-buildah
161
+ variables:
162
+ BUILD_PATH: $CI_PROJECT_DIR/docker
163
+ KUBERNETES_CPU_LIMIT: 8
164
+ KUBERNETES_CPU_REQUEST: 8
165
+ KUBERNETES_MEMORY_LIMIT: 8Gi
166
+ KUBERNETES_MEMORY_REQUEST: 8Gi
167
+ BUILDAH_EXTRA_ARGS:
168
+ --label org.opencontainers.image.title="neurodamus"
169
+ --label org.opencontainers.image.version="$REGISTRY_IMAGE_TAG"
170
+ --label org.opencontainers.image.revision="$CI_COMMIT_SHA"
171
+ --label org.opencontainers.image.authors="$GITLAB_USER_NAME <$GITLAB_USER_EMAIL>"
172
+ --label org.opencontainers.image.url="$CI_PROJECT_URL"
173
+ --label org.opencontainers.image.source="$CI_PROJECT_URL"
174
+ --label org.opencontainers.image.created="$CI_JOB_STARTED_AT"
175
+ --label ch.epfl.bbpgitlab.ci-pipeline-url="$CI_PIPELINE_URL"
176
+ --label ch.epfl.bbpgitlab.ci-commit-branch="$CI_COMMIT_BRANCH"
177
+ --label ch.epfl.bbpgitlab.libsonata-report-tag="$LIBSONATAREPORT_TAG"
178
+ --label ch.epfl.bbpgitlab.libsonata-tag="$LIBSONATA_TAG"
179
+ --label ch.epfl.bbpgitlab.neuron-commit-id="$NEURON_COMMIT_ID"
180
+ --build-arg GITLAB_CI="$GITLAB_CI"
181
+ --build-arg CI_JOB_TOKEN="$CI_JOB_TOKEN"
182
+ --build-arg LIBSONATAREPORT_TAG="$LIBSONATAREPORT_TAG"
183
+ --build-arg LIBSONATA_TAG="$LIBSONATA_TAG"
184
+ --build-arg NEURON_COMMIT_ID="$NEURON_COMMIT_ID"
185
+ before_script:
186
+ - echo "LIBSONATAREPORT_TAG is .$LIBSONATAREPORT_TAG."
187
+ - echo "LIBSONATA_TAG is .$LIBSONATA_TAG."
188
+ - echo "NEURON_COMMIT_ID is .$NEURON_COMMIT_ID."
189
+ - echo "REGISTRY_IMAGE_TAG is .$REGISTRY_IMAGE_TAG."
190
+ - set -x
191
+ - if [ "$BUILD_DOCKER_CONTAINER" == "false" ]; then
192
+ - echo "No need to build the docker container"
193
+ - exit 0
194
+ - else
195
+ - echo "Building"
196
+ - fi
197
+ rules:
198
+ - if: $CI_COMMIT_TAG
199
+ - if: $CI_PIPELINE_SOURCE == "web"
200
+
201
+ upload-to-docker-hub:
202
+ image: ubuntu:22.04
203
+ stage: publish
204
+ variables:
205
+ KUBERNETES_CPU_LIMIT: 4
206
+ KUBERNETES_CPU_REQUEST: 2
207
+ KUBERNETES_MEMORY_LIMIT: 8Gi
208
+ KUBERNETES_MEMORY_REQUEST: 2Gi
209
+ needs: [configure-docker-image, build-docker-image]
210
+ before_script:
211
+ - if [ "$BUILD_DOCKER_CONTAINER" == "false" ]; then
212
+ - echo "No need to build the docker container"
213
+ - exit 0
214
+ - else
215
+ - echo "Building"
216
+ - fi
217
+ script:
218
+ - apt-get update && apt-get install -y jq curl podman
219
+ - export HUB_REPO_NAME="neurodamus"
220
+ - |
221
+ TOKEN=$(curl -s --header "Content-Type:application/json" --request POST --data "{\"username\":\"${DOCKER_HUB_USER}\", \"password\":\"${DOCKER_HUB_AUTH_TOKEN}\"}" https://hub.docker.com/v2/users/login/ | jq -r .token)
222
+ - echo "Pushing to docker hub repo docker://docker.io/bluebrain/${HUB_REPO_NAME}"
223
+ - podman login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY_IMAGE}
224
+ - podman login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_AUTH_TOKEN} docker.io
225
+ - podman pull ${CI_REGISTRY_IMAGE}:${REGISTRY_IMAGE_TAG}
226
+ - echo podman push ${CI_REGISTRY_IMAGE}:${REGISTRY_IMAGE_TAG} docker://docker.io/bluebrain/${HUB_REPO_NAME}:${REGISTRY_IMAGE_TAG}
227
+ - curl -s --header "Content-Type:application/json" --header "Authorization:JWT ${TOKEN}" -X DELETE "https://hub.docker.com/v2/repositories/bluebrain/neurodamus/tags/latest/"
228
+ - podman --log-level=debug push ${CI_REGISTRY_IMAGE}:${REGISTRY_IMAGE_TAG} docker://docker.io/bluebrain/${HUB_REPO_NAME}:${REGISTRY_IMAGE_TAG}
229
+ - podman --log-level=debug push ${CI_REGISTRY_IMAGE}:${REGISTRY_IMAGE_TAG} docker://docker.io/bluebrain/${HUB_REPO_NAME}:latest
230
+ rules:
231
+ - if: $CI_COMMIT_TAG
232
+ - if: $CI_PIPELINE_SOURCE == "web"
233
+ when: manual
234
+
235
+
236
+ # The following stages are overrides. Don't rename
237
+ # Always add the manual option to create sdist/wheel or upload
238
+ build-package:
239
+ rules:
240
+ - when: on_success
241
+
242
+ publish-package:
243
+ rules:
244
+ - when: manual
245
+ allow_failure: true
246
+
247
+ docs:
248
+ variables:
249
+ TOXENV: docs
250
+ artifacts:
251
+ paths:
252
+ - docs/_build
253
+
254
+ publish-docs:
255
+ variables:
256
+ SYS_PACKAGES: openssh-clients
257
+ PIP_PACKAGES: docs_internal_upload
258
+ script:
259
+ - docs-internal-upload --docs-path docs/_build
260
+ rules:
261
+ - when: manual
262
+ allow_failure: true
File without changes
@@ -0,0 +1,13 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v2.3.0
6
+ hooks:
7
+ - id: end-of-file-fixer
8
+ - id: check-added-large-files
9
+ - repo: https://github.com/PyCQA/flake8.git
10
+ rev: 4.0.1
11
+ hooks:
12
+ - id: flake8
13
+ exclude: ^docs/
@@ -0,0 +1,21 @@
1
+ # .readthedocs.yaml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ sphinx:
9
+ configuration: docs/conf.py
10
+ fail_on_warning: true
11
+
12
+ build:
13
+ os: ubuntu-22.04
14
+ tools:
15
+ python: "3"
16
+
17
+ python:
18
+ install:
19
+ - method: pip
20
+ path: .
21
+ - requirements: requirements_docs.txt