Skip to content

Commit

Permalink
Standardize package structure to respect python standard (#164)
Browse files Browse the repository at this point in the history
* putting the SO in a morphio folder

* Is it using pip from the virtualenv ?

* Add morphio.mut and morphio.vasculature

* Do not run the tests from inside the folder
  • Loading branch information
Benoit Coste authored Feb 28, 2020
1 parent cdb44ca commit 6a523d7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ recursive-include src *
recursive-include binds *
recursive-include include *
recursive-include 3rdparty *
include CMakeLists.txt
include CMakeLists.txt
6 changes: 3 additions & 3 deletions binds/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pybind11_add_module(morphio
pybind11_add_module(_morphio
SYSTEM
morphio.cpp
bind_immutable.cpp
Expand All @@ -8,11 +8,11 @@ pybind11_add_module(morphio
bind_vasculature.cpp
)

target_include_directories(morphio
target_include_directories(_morphio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../include
)

target_link_libraries(morphio
target_link_libraries(_morphio
PRIVATE
morphio_static)
2 changes: 1 addition & 1 deletion binds/python/morphio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace py = pybind11;

PYBIND11_MODULE(morphio, m) {
PYBIND11_MODULE(_morphio, m) {
bind_misc(m);
bind_immutable_module(m);

Expand Down
7 changes: 6 additions & 1 deletion ci/python_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ set +u # ignore errors in virtualenv's activate
source "$VENV/bin/activate"
set -u

which pip

pip install --upgrade pip setuptools

# install
pip install .

pip install -r tests/requirement_tests.txt
nosetests
CURRENT=$(pwd)

cd ..
nosetests ${CURRENT}/tests
1 change: 1 addition & 0 deletions morphio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._morphio import *
1 change: 1 addition & 0 deletions morphio/mut/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .._morphio.mut import *
1 change: 1 addition & 0 deletions morphio/vasculature/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .._morphio.vasculature import *
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def build_extension(self, ext, cmake):
os.makedirs(self.build_temp)
try:
subprocess.check_call([cmake, ext.sourcedir] + cmake_args, cwd=self.build_temp)
subprocess.check_call([cmake, '--build', '.', '--target', 'morphio'] + build_args, cwd=self.build_temp)
subprocess.check_call([cmake, '--build', '.', '--target', '_morphio'] + build_args, cwd=self.build_temp)
except subprocess.CalledProcessError as exc:
print("Status : FAIL", exc.returncode, exc.output)
raise
Expand All @@ -96,8 +96,10 @@ def build_extension(self, ext, cmake):
long_description_content_type="text/markdown",
install_requires=['numpy>=1.14.1'],
url='https://github.com/BlueBrain/MorphIO/',
ext_modules=[CMakeExtension('morphio')],
ext_modules=[CMakeExtension('morphio._morphio')],
cmdclass=dict(build_ext=CMakeBuild),
packages=['morphio', 'morphio.mut', 'morphio.vasculature'],

license="BBP-internal-confidential",
keywords=('computational neuroscience',
'morphology',
Expand Down

0 comments on commit 6a523d7

Please sign in to comment.