question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PEP 561 compliance

See original GitHub issue

Hi @leycec and the @beartype organisation 👋

I’m currently rewriting large parts of a project of mine, and I’m planning on using beartype 🐻 with it! (because beartype is awesome 😎)

Part of the rewrite involves creating a python module that users will be able to import. Currently, my project is PEP 561 compatible. However, beartype causes some issues with this making it no longer the case.

For instance, if I were to run mypy --strict on my code, I now get lots of the following errors:

Untyped decorator makes function "..." untyped
Skipping analyzing 'beartype.cave': found module but no type hints or library stubs
Skipping analyzing 'beartype': found module but no type hints or library stubs

This then has the knock on effect that the functions in my project appear untyped when imported, making it no longer PEP 561 compliant.

Assuming beartype is properly annotated, which I’m 200% sure it is, it should hopefully be as simple as adding a py.typed file in the project directory. See the mypy docs for more info. This could then be another PEP ticked off in the compliance list.

Since you have a lot (and I really do mean a lot) more experience with these different PEPs and type checking than I do, please let me know if I’m missing anything. Thank you for your help and for maintaining this great project.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
Gonzomcommented, Mar 25, 2021

@leycec, this seriously was one of the best pieces of code-related texts I had the pleasure of reading 😃 Can’t wait for the Netflix adaptation!

1reaction
positacommented, Sep 24, 2022

… and then everyone will know true happiness, just like in the ending of Roadside Picniconly the greatest scifi novella of all time that I have just cruelly spoiled.

Spoiler alert: The ending is definitely not spoiled, and I am grateful for the reference! I am left wondering if I should feel a little embarrassed by:

  1. Not already being aware of this fantastic story; and/or
  2. Taking over a year-and-a–half to finally sit down and read it once I was.

The translation is fantastic. (I had to look up what a "Cryptomaoist Edition" was. Spoiler alert: the actual definition is much more mundane than the portmanteau would suggest.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 561 – Distributing and Packaging Type Information
Currently, typing information must be distributed manually. This PEP provides a standardized means to leverage existing tooling to package and ...
Read more >
Is there a best practice to make a package PEP-561 compliant?
Is there a standard tool for making a package PEP-561 compliant? Am I missing something else? python · setuptools · mypy · Share....
Read more >
PEP 561 compliant stub package for arcpy - Esri Community
Does anyone know if there is a PEP 561 compliant stub package for arcpy? I'm wanting to use static typing (mypy), but Esri...
Read more >
Using installed packages - mypy 0.991 documentation
PEP 561 specifies how a package can declare that it supports type checking. Note. New versions of stub packages often use type system...
Read more >
Is there a best practice to make a package PEP-561 compliant?
Answer a question I'm writing a Python project which is published as a package to a pypi-like repository (using setuptools and twine).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found