Skip to content

Conversation

ntjohnson1
Copy link
Contributor

This should close #1 and makes steps towards #2.

  1. First moves things over to a more modern pyproject.toml
    • Sets upper limit on beartype version since 21.0 moves files that break this
    • Move packaging over to hatch to match beartype to make [CI] Modern Release Workflow #2 nicer I hope (I think this is mostly blocked on the trusted publisher bit)
  2. Adds a simple import check and single attribute check

@leycec
Copy link
Member

leycec commented Jul 10, 2025

WOAH. Phenomenal! Stunning! And other commendable superlatives! Please volunteer your awesomeness for the main @beartype codebase, too. I'm begging you here...

Very well. I'll stop begging. This PR is fantastic. I see only a few issues – mostly negligible, thankfully:

  • pyproject.toml should bundle the py.typed file with wheels: e.g.,

    [tool.hatch.build.targets.wheel]
    include = [
        "/src/ipython_beartype/**",
        "/src/ipython_beartype/py.typed",
    ]
  • Pinning "beartype<0.21.0" fills me with deep sadness. I didn't even know this happened. If I know I'd broken ipython-beartype, I'd have done something about that... probably. Nobody tells me these things. 😭

  • CI is failing. This is the Big One™, obviously. Looks like pytest and tox both need an updated ${PYTHONPATH} to find the nested src/ipython-beartype subdirectory. Since @beartype itself does not a nested subdirectory structure, I've never hit this myself. That said, this StackOverflow answer appears relevant. Specifically, it looks like pytest and tox want something resembling:

# In "pyproject.toml":
[tool.pytest.ini_options]
pythonpath = "src/"
# In "tox.ini":
[testenv]
commands = pytest ... -o pythonpath=

...maybe? Worth a try, anyway. Truly, CI is mind-boggling. 🥴

@ntjohnson1
Copy link
Contributor Author

  • pyproject.toml should bundle the py.typed
    Maybe I misunderstood but
$ hatch build
$ cd dist
$ cp ipython_beartype-0.1.0-py3-none-any.whl ipython_beartype-0.1.0-py3-none-any.zip
$ unzip ipython_beartype-0.1.0-py3-none-any.zip
Archive:  ipython_beartype-0.1.0-py3-none-any.zip
  inflating: ipython_beartype/__init__.py  
  inflating: ipython_beartype/py.typed <----- Looks like it is in here
  inflating: ipython_beartype-0.1.0.dist-info/METADATA  
  inflating: ipython_beartype-0.1.0.dist-info/WHEEL  
  inflating: ipython_beartype-0.1.0.dist-info/licenses/LICENSE  
  inflating: ipython_beartype-0.1.0.dist-info/RECORD 
  • Pinning "beartype<0.21.0"
    THAT's why we need tests. I figured if we can get this stabilized and automagically releasing then its easier to justify time on it

  • CI failing
    tox -e py312-type worked for me locally AND uv pip install -e .[dev] ipython_beartype so I didn't realize that the indirection through the source folder was making things sad.
    My newest commit lets things pass via tox -e py312 now 🤞

@leycec
Copy link
Member

leycec commented Jul 10, 2025

Maybe I misunderstood but

Oh, right. I forgot that Hatch bundles py.typed by default if it finds it. This is why we use Hatch. 😅

THAT's why we need tests.

Truer words were never spoken.

My newest commit lets things pass via tox -e py312 now

Superb. Your vigorous finger-crossing and hard work has paid off. Tests pass. Congrats, @ntjohnson1!

I'll give @tusharsadhwani a day or two to chime in before merging this. But... this certainly looks superb from my end. I can hardly hold back the joyful tears anymore. 🥹

Copy link
Collaborator

@tusharsadhwani tusharsadhwani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tusharsadhwani tusharsadhwani merged commit 4f514ac into beartype:main Jul 11, 2025
5 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.

3 participants