Skip to content

Commit

Permalink
added __version__ import to base init
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed May 20, 2024
1 parent 86e2f65 commit f9351a4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nipype2pydra/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import black.parsing
import black.report
from tqdm import tqdm
import attrs
import yaml
from . import interface
from .utils import (
Expand Down Expand Up @@ -1025,6 +1024,12 @@ def write_pkg_inits(
The names to import in the __init__.py files
"""
parts = module_name.split(".")
# Write base init path that imports __version__ from the auto-generated _version
# file
base_init_fspath = package_root.joinpath(*parts, "__init__.py")
if not base_init_fspath.exists():
with open(base_init_fspath, "w") as f:
f.write("from ._version import __version__")
for i, part in enumerate(reversed(parts[depth:]), start=1):
mod_parts = parts[:-i]
parent_mod = ".".join(mod_parts)
Expand Down

0 comments on commit f9351a4

Please sign in to comment.