Skip to content

Underscore-prefix methods that are not part of the public API - #92

Merged
roed314 merged 1 commit into
roed314:masterfrom
roed-math:api-narrowing
Jul 21, 2026
Merged

Underscore-prefix methods that are not part of the public API#92
roed314 merged 1 commit into
roed314:masterfrom
roed-math:api-narrowing

Conversation

@roed-math

@roed-math roed-math commented Jul 20, 2026

Copy link
Copy Markdown

Fixes #25.

Stacked on #89 (which stacks on #88): based on the join-queries branch; once those merge this reduces to the single commit d0317ca. Independent of the other two issue PRs (#90, #91); the three merge cleanly in any order (verified locally; the combined tree passes the full suite plus devmirror).

Renames, following the issue's list:

was now
db.cursor db._cursor
db.log_db_change db._log_db_change
db.is_alive db._is_alive
db.is_read_only db._is_read_only
db.can_read_write_knowls db._can_read_write_knowls
db.can_read_write_userdb db._can_read_write_userdb
db.register_object db._register_object
db.logger / table.logger _logger
table.has_id table._has_id
table.log_db_change table._log_db_change

Judgment calls, flagged for veto:

  • grant_* stay public — the issue marked them "maybe", they are deliberate administrative API, and statstable calls grant_select when creating tables.
  • fetch_userpassword and is_verifying from the original list don't exist in psycodict (they are lmfdb-side; Expose fewer methods for tables LMFDB/lmfdb#3262 remains the place for those).

Downstream survey (lmfdb main, seminars, psetpartners, lmfdb-lite, FiniteGroups). The only real users of the renamed names:

  • lmfdb: db.is_alive() ×3 (app.py), can_read_write_knowls/can_read_write_userdb ×1 each, and the log_db_change override in lmfdb_database.py. (The db.cursor() hits in riemann/stieltjes and zeros/zeta that a naive grep finds are sqlite3 connections named db, not psycodict.)
  • seminars: the per-table log_db_change no-op monkeypatch, db.cursor() in the copy helper, can_read_write_userdb ×1.
  • psetpartners, lmfdb-lite, FiniteGroups: none.

Companion PRs, both written version-tolerantly so they can merge before or after this one: LMFDB/lmfdb#7072 and roed314/seminars#978 (the seminars one verified against both psycodict versions with byte-identical copy output). The overrides keep both names bound, so the logging hooks cannot silently detach during the transition.

A new tests/test_api.py guards the narrowed surface (old names absent, new names present) so the public names don't quietly come back. Suite 544/24 on this branch, ruff clean; devmirror tests updated and passing.

🤖 Generated with Claude Code

roed314 added a commit to LMFDB/lmfdb that referenced this pull request Jul 21, 2026
psycodict is underscore-prefixing methods that are not part of its
public API.  Rename the log_db_change override to _log_db_change
(keeping the old name bound so the hook works under either psycodict),
and call is_alive / can_read_write_knowls / can_read_write_userdb
through version-tolerant getattr fallbacks, so this can merge before
or after the psycodict change.  Simplify once psycodict is pinned.

The db.cursor() calls in riemann/stieltjes and zeros/zeta are sqlite3
connections, not psycodict, and are untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
roed-math pushed a commit to roed-math/seminars that referenced this pull request Jul 21, 2026
Bind the per-table log_db_change no-op under both its old and new
names, and reach cursor / can_read_write_userdb through
version-tolerant fallbacks, so this works whichever psycodict is
installed.  Simplify once psycodict is pinned past that PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Renames, per the list in roed314#25: on the database, cursor, log_db_change,
is_alive, is_read_only, can_read_write_knowls, can_read_write_userdb,
register_object and the logger attribute; on tables, has_id,
log_db_change and logger.  The grant_* methods stay public: the issue
marked them as a maybe, and they are deliberate administrative API
(statstable calls grant_select when creating tables).  fetch_userpassword
and is_verifying from the original list live in lmfdb, not here.
Fixes roed314#25.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roed314
roed314 merged commit 4af97a7 into roed314:master Jul 21, 2026
16 checks passed
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.

Expose fewer methods for tables

2 participants