-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
py.typed
file to make test_project_python
PEP 561 compliant
- this change addresses the following regression from the previous commit: /path/to/test_project/python/test_project_python_tests/test_package_builder.py:4:1:4:1: error: Skipping analyzing "test_project_python.package_builder": module is installed, but missing library stubs or py.typed marker [import] from test_project_python.package_builder import ( ^ /path/to/test_project/python/test_project_python_tests/test_package_builder.py:4:1:4:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports - removing the `os.chdir()` commands are safe now since the `py.typed` file allows `mypy` to analyze the `import`ed `test_project_python` package without running into the error above - see the previous commit for more information about why manually moving into the `python` directory might be problematic
- Loading branch information
1 parent
e809e5d
commit 027d3f9
Showing
3 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
''' | ||
This py.typed file makes this package (test_project_python) | ||
a PEP 561 compliant stub package. | ||
|
||
Make sure to add a `package_data` argument consisting of | ||
a `dict` with the key(s) corresponding to the package name(s) | ||
and the value(s) corresponding to the file(s) in that package | ||
that contain the type hint information to the `setup` | ||
function (e.g. in `distutils.core.setup` or `setuptools.setup`). | ||
If the type hint information is contained in inline type annotations, | ||
a `py.typed` file should suffice. | ||
|
||
``` | ||
package_data={"package_name": ["py.typed"]}, | ||
# OR if the package has stub files (ending in .pyi) | ||
package_data={"package_name": ["py.typed", "module1.pyi", "module2.pyi"]}, | ||
``` | ||
|
||
Read the following for more information: | ||
- https://mypy.readthedocs.io/en/stable/installed_packages.html | ||
- https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker | ||
- https://mypy.readthedocs.io/en/stable/stubs.html#stub-files | ||
- https://peps.python.org/pep-0561/ | ||
''' |