Skip to content

Make scalcs a regular package - #32

Merged
remislp merged 1 commit into
masterfrom
fix/regular-package
Nov 12, 2026
Merged

remislp merged 1 commit into
masterfrom
fix/regular-package

Conversation

@remislp

@remislp remislp commented Nov 12, 2026

Copy link
Copy Markdown
Member

Without scalcs/init.py, scalcs was a namespace package: Python merged every directory on the path holding a scalcs folder, so a module missing from the copy under test was quietly imported from another copy - an installed release, a checkout on PYTHONPATH. With init.py the first copy found is used whole, and a missing module is an ImportError.

init.py imports only the version, so scalcs.version now exists, as the release workflow's comment already assumed, and importing scalcs stays cheap.

What this does not fix, and the tests say so: an editable install registers a finder that resolves any scalcs.* name straight to its own source tree, ignoring which copy of scalcs was imported, and it still fills in modules the first copy lacks. That finder, not the namespace merging, caused the false pass seen while reproducing Colquhoun & Lape (2012). Nothing inside the package can stop it; testing one copy of SCALCS beside an editable install of another still needs a clean environment, or that finder removed and every module's file checked.

The test of the path merging removes any such finder first, so it tests the merging alone: without init.py the missing module came from the second copy on the path; with it, importing it fails.

Without scalcs/__init__.py, scalcs was a namespace package: Python merged every
directory on the path holding a scalcs folder, so a module missing from the
copy under test was quietly imported from another copy - an installed release,
a checkout on PYTHONPATH. With __init__.py the first copy found is used whole,
and a missing module is an ImportError.

__init__.py imports only the version, so scalcs.__version__ now exists, as the
release workflow's comment already assumed, and importing scalcs stays cheap.

What this does not fix, and the tests say so: an editable install registers a
finder that resolves any scalcs.* name straight to its own source tree,
ignoring which copy of scalcs was imported, and it still fills in modules the
first copy lacks. That finder, not the namespace merging, caused the false pass
seen while reproducing Colquhoun & Lape (2012). Nothing inside the package can
stop it; testing one copy of SCALCS beside an editable install of another
still needs a clean environment, or that finder removed and every module's
__file__ checked.

The test of the path merging removes any such finder first, so it tests the
merging alone: without __init__.py the missing module came from the second
copy on the path; with it, importing it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remislp
remislp merged commit 0269d07 into master Nov 12, 2026
7 of 8 checks passed
@remislp
remislp deleted the fix/regular-package branch November 12, 2026 20:26
@remislp remislp mentioned this pull request Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant