Skip to content

Add a [fitting] extra rather than hard dependencies - #193

Merged
remislp merged 1 commit into
masterfrom
fitting-extra
Sep 11, 2026
Merged

remislp merged 1 commit into
masterfrom
fitting-extra

Conversation

@remislp

@remislp remislp commented Sep 11, 2026

Copy link
Copy Markdown
Member

The fitting layer goes here, and mechanisms, rate constants and constraints stay
in SCALCS — so HJCFIT needs SCALCS to handle a mechanism. That is a dependency
it has never had.

Making it a hard one would cost something worth keeping: the likelihood
needs numpy and scipy and nothing else, and a test asserts that importing
HJCFIT leaves dcio and scalcs out of sys.modules. Someone who wants
Log10Likelihood on a Q matrix they already have should not acquire a mechanism
library and a plotting stack to get it.

pip install hjcfit             the likelihood
pip install hjcfit[fitting]    records, mechanisms, fits, displays
why
dcio>=0.1.2 records: formats, dead time, periods, bursts
scalcs>=1.1.0 mechanisms, rate constants, constraints, theoretical curves
matplotlib>=3.6 the displays; nothing in the likelihood draws

All three resolve from PyPI — verified in a clean virtualenv.

The licence had to move first

scalcs was declared GPL-2.0-only, which is mutually incompatible with
HJCFIT's GPL-3.0-or-later: the combination could not have been distributed at
all. DCPROGS/SCALCS#24 corrects it to GPL-2.0-or-later, which is what the code
already permitted — no file in scalcs/ carries a licence notice, and GPLv2 §9
lets a recipient choose any version where the program specifies none.

MIT was considered and rejected there: SCALCS has a second copyright holder, and
popen.py is a re-implementation of the GPL'd DCPROGS HJC_HILL.FOR.

Two things deliberately not done

EKDIST is not an extra. Exponential mixtures and t_crit estimation belong to
the displays that want them, but EKDIST is not on PyPI and declaring it would
make pip install hjcfit[...] fail outright rather than install what it can —
exactly how EKDIST's own dcio dependency behaved until dcio was published.

dcio>=0.1.2, not >=0.1.1. 0.1.1 reports the wrong __version__
(DCPROGS/dcio#8), which I found while checking this extra resolved.

Metadata only; no import changes. What actually goes in the fitting layer
follows.

🤖 Generated with Claude Code

The fitting layer goes here, and mechanisms, rate constants and constraints
stay in SCALCS, so HJCFIT needs SCALCS to handle a mechanism. That is a
dependency it has never had, and making it a hard one would cost something
worth keeping: the likelihood needs numpy and scipy and nothing else, and a
test asserts that importing HJCFIT leaves dcio and scalcs out of sys.modules.
Someone who wants Log10Likelihood on a Q matrix they already have should not
acquire a mechanism library and a plotting stack to get it.

    pip install hjcfit             the likelihood
    pip install hjcfit[fitting]    records, mechanisms, fits, displays

dcio for records, scalcs for mechanisms and theoretical curves, matplotlib for
the displays. All three resolve from PyPI; verified in a clean virtualenv.

dcio is pinned at >=0.1.2 rather than >=0.1.1 because 0.1.1 reports the wrong
__version__ (DCPROGS/dcio#8).

EKDIST is deliberately not an extra. Exponential mixtures and t_crit
estimation belong to the displays that want them, but EKDIST is not on PyPI,
and declaring it would make pip install hjcfit[...] fail outright rather than
install what it can -- which is exactly how EKDIST's own dcio dependency
behaved until dcio was published.

This is metadata only; no import changes. What actually goes in the fitting
layer follows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@remislp
remislp merged commit f8549ae into master Sep 11, 2026
14 checks passed
@remislp
remislp deleted the fitting-extra branch September 11, 2026 10:30
@remislp remislp mentioned this pull request Sep 11, 2026
remislp added a commit that referenced this pull request Sep 11, 2026
1.0.0 published the likelihood. This publishes the fitting layer, so that
`pip install hjcfit[fitting]` means something: on PyPI the extra does not
exist yet, and the command warns and installs the bare likelihood, which is
the quiet kind of failure -- a working import, and the gap found later at
read_idealized_bursts.

Since 1.0.0:

  #186  read_idealized_bursts segments the record's periods rather than its
        resolved intervals, and needs dcio alone rather than dcio and scalcs.
        No shipped record has a sub-conductance level, so this changes nothing
        for them; it removes a way for the next one to be read wrongly and
        silently.
  #187  simplex_hjc, a port of SIMPHJC.FOR -- the search that produced every
        published HJCFIT result, and not SciPy's Nelder-Mead.
  #189  SWIG taken from PyPI on macOS rather than Homebrew.
  #192  that simplex made usable: documented at all for the first time, given
        reset_out_of_range for the limits the Fortran program applied around
        it, and tested end to end against the C++ likelihood rather than only
        against quadratics.
  #193  a [fitting] extra rather than hard dependencies, so the likelihood
        keeps needing nothing but numpy and scipy.
  #194  HJCFitter, FitResult and Record, lifted from the reproduction of
        Colquhoun, Hatton & Hawkes (2003). Duck-typed on a mechanism, so the
        fitting layer imports no mechanism library.

The extra needs scalcs>=1.2.0 and dcio>=0.1.2, both released and both pinned
for a reason recorded in pyproject.toml: the looser pins resolved and then
failed on a missing attribute.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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