Skip to content

Commit f70eb2f

Browse files
authored
Merge pull request #820 from effigies/enh/ext_namespace
ENH: Add bids.ext namespace package for subpackages
2 parents f422263 + 39d67ed commit f70eb2f

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

bids/ext/__init__.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
The PyBIDS extension namespace package
3+
4+
``bids.ext`` is reserved as a namespace for extensions to install into.
5+
To write such an extension, the following things are needed:
6+
7+
1) Create a new package with the following structure (assuming setuptools)::
8+
9+
package/
10+
bids/
11+
ext/
12+
__init__.py
13+
EXTENSION/
14+
__init__.py
15+
...
16+
setup.cfg
17+
setup.py
18+
19+
The important things to note are that the ``bids/`` directory must be
20+
empty apart from ``ext/`` and ``bids/ext/`` must be empty except for
21+
your extension and an ``__init__.py``.
22+
23+
2) Place the following (and nothing else) in ``__init__.py``::
24+
25+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
26+
27+
3) Include the following lines in ``setup.cfg``::
28+
29+
[options]
30+
install_requires =
31+
pybids >= 0.15
32+
packages = find_namespace:
33+
34+
[options.packages.find]
35+
include =
36+
bids.ext.EXTENSION
37+
bids.ext.EXTENSION.*
38+
39+
"""
40+
41+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

0 commit comments

Comments
 (0)