Skip to content

Drop the hatchling 1.32.3 workaround - #152

Open
Thanatos9404 wants to merge 1 commit into
jupyterlab:mainfrom
Thanatos9404:drop-hatchling-1323-workaround
Open

Thanatos9404 wants to merge 1 commit into
jupyterlab:mainfrom
Thanatos9404:drop-hatchling-1323-workaround

Conversation

@Thanatos9404

Copy link
Copy Markdown

Closes #151

hatchling 1.32.4 reverted (pypa/hatch#2440) the BuildHookInterface typing change that #148 worked around, so this goes back to subclassing BuilderConfig and BuildHookInterface[JupyterBuildConfig] directly. plugin.py is the same as before #148.

With hatchling 1.32.4 the TYPE_CHECKING branch from #148 no longer type checks. On main, mypy with the repo config reports:

hatch_jupyter_builder\plugin.py:24: error: "BuilderConfig" expects no type arguments, but 1 given  [type-arg]
hatch_jupyter_builder\plugin.py:44: error: "BuildHookInterface" expects 1 type argument, but 2 given  [type-arg]

Both are gone with this change. The two other mypy errors (unused type: ignore in migrate/jupyter_packaging.py and migrate/_migrate.py) are the same on main.

hatchling 1.32.3 is excluded from the dependency (hatchling>=1.17,!=1.32.3), because the plain subclass fails to import there:

TypeError: Too few arguments for <class 'hatchling.builders.hooks.plugin.interface.BuildHookInterface'>; actual 1, expected 2

1.32.1 had the same change but is yanked on PyPI, so resolvers already skip it.

Tests: python -m pytest gives the same result on main and on this branch with hatchling 1.32.4 (29 passed, 2 skipped; test_run and test_normalize_cmd fail on my Windows machine on both, from how they build the expected path). ruff 0.2.0 (the pre-commit pin) is clean on the changed file.

hatchling 1.32.4 reverted (pypa/hatch#2440) the BuildHookInterface
typing change that jupyterlab#148 worked around, so the build hook can
subclass BuilderConfig and BuildHookInterface[JupyterBuildConfig]
directly again. With 1.32.4 the TYPE_CHECKING branch no longer type
checks: mypy reports that "BuilderConfig" expects no type arguments and
that "BuildHookInterface" expects one.

hatchling 1.32.3 is excluded from the dependency, since the plain
subclass fails to import there. 1.32.1 had the same change but is
yanked, so resolvers already skip it.

Closes jupyterlab#151

This branch has not been deployed

No deployments
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.

Revert the hatch==1.32.3 workaround?

1 participant