Skip to content

Drop the sillo.graphql alias; sillo_graphql is the import path - #1

Merged
TechWithDunamix merged 1 commit into
mainfrom
drop-sillo-namespace-alias
Sep 12, 2026
Merged

TechWithDunamix merged 1 commit into
mainfrom
drop-sillo-namespace-alias

Conversation

@TechWithDunamix

Copy link
Copy Markdown
Member

Companion to sillohq/wire#1, which does the same for sillo-wire.

sillo-graphql shipped under two names. sillo_graphql is where the code lives; sillo.graphql was an alias so an import could read as part of the framework. It took three pieces of machinery:

  • _sillo_graphql_bootstrap.py — a meta-path finder mapping sillo.graphqlsillo_graphql
  • sillo_graphql.pth — registering it at interpreter startup
  • sillo-stubs/ — PEP 561 partial stubs, because static analysis never runs import hooks

The cost is a .pth executing on every interpreter start in every environment the package is installed in, plus a second set of type declarations to keep in step with the real ones.

Breaking

from sillo.graphql import Graph, field    # before
from sillo_graphql import Graph, field    # now the only way

Free here: sillo-graphql has never been published — no tags in this repo, and the PyPI JSON API returns nothing for the name. No user is on the old path.

Two things worth a look

py.typed was missing. The package claimed Typing :: Typed in its classifiers but shipped no PEP 561 marker of its own — type checkers were served entirely by sillo-stubs/. Removing the stubs without adding the marker would have silently made sillo_graphql untyped for every consumer. Added, and verified with mypy against a real install that the inline annotations now resolve.

Logger names are deliberately unchanged. logging.getLogger("sillo.graphql") and "sillo.graphql.operations" look like the alias, but they are not import paths — they are a logging hierarchy nested under the framework's own sillo logger, the same convention as sillo.record, sillo.mail and sillo.storage. They inherit handlers and level from setup_logging(logger_name="sillo"). Renaming them to sillo_graphql would detach this package from the framework's logging configuration, so they stay as they are.

CI

  • The alias job becomes a wheel job. Same approach — verify against a built wheel, not the editable checkout, since an editable install can import what the wheel does not ship — but it now asserts sillo_graphql imports, sillo.graphql does not resolve, no .pth or stubs have crept back in, and py.typed is present. The uninstall-isolation checks are kept unchanged.
  • release.yml's wheel assertions flipped from requiring the .pth/bootstrap/stubs to forbidding them.
  • Header comments claiming sillo-framework>=1.0 "cannot resolve against PyPI" are now wrong — 1.0.0a1 was published today. Corrected, though CI still installs the framework from main on purpose, since this package tracks the branch rather than the last tag.

Verification

  • 467 passed, ruff clean
  • Wheel ships sillo_graphql + py.typed and nothing else
  • Installed into a clean venv beside sillo-framework 1.0.0a1: sillo_graphql imports, sillo.graphql raises ImportError, no .pth installed, sillo/ untouched
  • mypy resolves Graph, Limits and not_found from the installed package with no stubs present

🤖 Generated with Claude Code

The package shipped under two names. `sillo_graphql` is where the code
lives; `sillo.graphql` was an alias so an import could read as part of
the framework, built from a meta-path finder in
`_sillo_graphql_bootstrap.py`, a `sillo_graphql.pth` registering it at
interpreter startup, and PEP 561 stubs in `sillo-stubs/` because static
analysis never runs import hooks.

That is three mechanisms, a `.pth` executing on every interpreter start
in every environment the package is installed in, and a second set of
type declarations to keep in step with the real ones. A plain top-level
package needs none of it.

Adds `sillo_graphql/py.typed`, which was missing. The package claimed
`Typing :: Typed` but delivered types only through `sillo-stubs/`, so
removing the stubs without this would have silently made it untyped for
consumers. Verified with mypy against a real install: its own inline
annotations now resolve.

Logger names are deliberately left alone. `logging.getLogger("sillo.graphql")`
and `"sillo.graphql.operations"` are a logging hierarchy nested under the
framework's own `sillo` logger -- the same convention as `sillo.record`
and `sillo.mail` -- so they inherit handlers and level from
`setup_logging()`. They are not import paths, and renaming them would
detach the package from the framework's logging configuration.

CI's `alias` job becomes a `wheel` job: same wheel-not-checkout approach,
now asserting `sillo_graphql` imports, `sillo.graphql` does not resolve,
no `.pth` or stubs are back in the wheel, and `py.typed` is present. The
uninstall-isolation checks are kept as they were. Header comments that
said `sillo-framework>=1.0` cannot resolve on PyPI are updated: 1.0.0a1
is published now, though CI still tracks `main` rather than that tag.

Verified: 467 passed, ruff clean, and the built wheel installs into a
clean venv beside sillo-framework 1.0.0a1 where sillo_graphql imports
and type-checks, sillo.graphql raises ImportError, and no .pth is
installed.
@TechWithDunamix
TechWithDunamix merged commit 1d94d8a into main Sep 12, 2026
7 checks passed
@TechWithDunamix
TechWithDunamix deleted the drop-sillo-namespace-alias branch September 12, 2026 23:25
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