Skip to content

Commit

Permalink
Clean up wheel contents.
Browse files Browse the repository at this point in the history
Fixes #143. Replaces `setuptools`, which seems very happy to just add
everything in the current directory into the source distribution with
`hatch`, which is much, much, much more reasonable. Also:

* Delete now obsolete `MANIFEST.in`
* Delete outdated, non-functional `_debug.py`
* Move `init.py` into `neurodamus/data` to properly compartmentalize it

SPACK_BRANCH=clean-pydamus
SPACK_DEPLOYMENT_SUFFIX=pulls/2358
  • Loading branch information
matz-e committed Mar 20, 2024
1 parent b978f40 commit fb9d035
Show file tree
Hide file tree
Showing 28 changed files with 26 additions and 29 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/simulation_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ jobs:
wget --output-document="O1_mods.xz" --quiet "https://zenodo.org/record/8026353/files/O1_mods.xz?download=1"
tar -xf O1_mods.xz
cp -r mod tests/share/
cp core/mod/*.mod tests/share/mod/
cp neurodamus/data/mod/*.mod tests/share/mod/
./docker/build_neurodamus.sh tests/share/mod
- name: Example run
run: |
export PYTHONPATH=$(pwd)/nrn/build/lib/python:$PYTHONPATH
cp core/hoc/* tests/share/hoc/
cp neurodamus/data/hoc/* tests/share/hoc/
export HOC_LIBRARY_PATH=$(pwd)/tests/share/hoc
# launch simulation with NEURON
mpirun -np 2 ./x86_64/special -mpi -python init.py --configFile=tests/simulations/usecase3/simulation_sonata.json
mpirun -np 2 ./x86_64/special -mpi -python neurodamus/data/init.py --configFile=tests/simulations/usecase3/simulation_sonata.json
ls tests/simulations/usecase3/reporting/*.h5
# launch simulation with CORENEURON
mpirun -np 2 ./x86_64/special -mpi -python init.py --configFile=tests/simulations/usecase3/simulation_sonata_coreneuron.json
mpirun -np 2 ./x86_64/special -mpi -python neurodamus/data/init.py --configFile=tests/simulations/usecase3/simulation_sonata_coreneuron.json
ls tests/simulations/usecase3/reporting_coreneuron/*.h5
# - name: live debug session, comment out
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

10 changes: 0 additions & 10 deletions _debug.py

This file was deleted.

4 changes: 4 additions & 0 deletions ci/build_ndcore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ mkdir -p _lib
cp -f x86_64/libnrnmech* _lib/
cp -f $CORE_DIR/hoc/*.hoc _lib/
cp -f $COMMON_DIR/hoc/*.hoc _lib/

echo $1
ls -l
ls -l _lib
5 changes: 3 additions & 2 deletions neurodamus/core/_neuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
from __future__ import absolute_import
import logging
import os # os.environ
import os.path
from contextlib import contextmanager
from .configuration import NeuronStdrunDefaults
Expand Down Expand Up @@ -60,8 +61,8 @@ def load_hoc(cls, mod_name):
h = (cls._h or cls._init())
mod_filename = mod_name + ".hoc"
if not h.load_file(mod_filename):
raise RuntimeError("Cant load HOC library {}. Consider checking HOC_LIBRARY_PATH"
.format(mod_filename))
raise RuntimeError("Cant load HOC library {}. Consider checking HOC_LIBRARY_PATH (currently '{}')"
.format(mod_filename, os.environ.get("HOC_LIBRARY_PATH")))
cls._hocs_loaded.add(mod_name)

@classmethod
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 12 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build-system]
requires = [
"setuptools",
"setuptools_scm",
"wheel"
]
build-backend = "setuptools.build_meta"
"hatchling",
"hatch-vcs",
]
build-backend = "hatchling.build"

[project]
name="neurodamus"
Expand Down Expand Up @@ -36,10 +35,15 @@ Homepage = "https://github.com/BlueBrain/neurodamus"
Repository = "https://github.com/BlueBrain/neurodamus.git"
Tracker = "https://github.com/BlueBrain/neurodamus/issues"

[tool.setuptools.packages.find]
exclude=["tests"]
[tool.hatch.build.targets.sdist]
only-include = [
"neurodamus",
]

[tool.hatch.version]
source = "vcs"

[tool.setuptools_scm]
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

[tool.pytest.ini_options]
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

@pytest.fixture(scope="session")
def morphologies_root(rootdir):
return Path(rootdir) / "tests/sample_data/morphology"
return Path(rootdir) / "tests" / "sample_data" / "morphology"


@pytest.fixture
def Cell(rootdir):
os.environ["HOC_LIBRARY_PATH"] = str(rootdir) + "/core/hoc"
os.environ.setdefault("HOC_LIBRARY_PATH", str(rootdir / "neurodamus" / "data" / "hoc"))
from neurodamus.core import Cell
return Cell

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ setenv =
allowlist_externals =
{toxinidir}/ci/build_ndcore.sh
commands =
{toxinidir}/ci/build_ndcore.sh {toxinidir}/core
{toxinidir}/ci/build_ndcore.sh {toxinidir}/neurodamus/data
pytest -x --forked tests/integration


Expand Down

0 comments on commit fb9d035

Please sign in to comment.