Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy reports missing library stubs or py.typed marker #179

Closed
JayBazuzi opened this issue Nov 3, 2024 · 3 comments · Fixed by #184
Closed

mypy reports missing library stubs or py.typed marker #179

JayBazuzi opened this issue Nov 3, 2024 · 3 comments · Fixed by #184

Comments

@JayBazuzi
Copy link
Contributor

JayBazuzi commented Nov 3, 2024

To Reproduce:

python -m venv .venv
. ./.venv/bin/activate
python -m pip install mypy approvaltests
echo "import approvaltests" > test.py
mypy test.py

Result:

test.py:1: error: Skipping analyzing "approvaltests": module is installed, but missing library stubs or py.typed marker  [import-untyped]
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

Fix ideas

Either:

  • Add py.typed files in the appropriate locations
  • Generate library stubs
@MichaelRWolf
Copy link
Contributor

This is test_issue_179 (created 2024-11-03).
It is a partial test file.

#! /bin/bash
set -euo pipefail
set -xv


# script_dir=$(dirname "$0")
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )



# Producer of package...
# Not in venv to create package
rm -rf dist
python3 setup.py sdist bdist_wheel

# Consumer of package...

# TODO
# - Cleanup this directory
# - cd back to original directory



temp_dir=$(mktemp --directory)
cd "$temp_dir"

python3 -m venv .venv
. ./.venv/bin/activate
pip install mypy



pip install "${script_dir}/dist/approvaltests-14.0.0-py3-none-any.whl"


# TODO
# - Import approval utilities
# - make sub-something works -- 'import approvaltests.xxxxx'

echo "import approvaltests" > test.py
mypy test.py

@MichaelRWolf
Copy link
Contributor

Scraps of a TODO.md from 2024-11-03

Plan for 2024-11-03

SKIP 1 - Import latest approval test
2 - Run mypi





Jay - I want to work on projects that don't requre tribal knowledge.
Anti-pattern: Offer change (without test).  Assume Llewellyn will accept it.

Option
Create a test that ????


Option
- Create a bash script (named 'test_issue_XYZ') that exercises problem.
- Demonstrates the problem

later... figure where to put it as a test


Diana
1 - Do not commit the tox changes in the starter project
2 - Change python3 to be correct python for environment
	- Vote for don't care

@JayBazuzi JayBazuzi changed the title Add py.typed file mypy reports missing library stubs or py.typed marker Nov 3, 2024
@JayBazuzi
Copy link
Contributor Author

#170 is another attempt to fix this issue.

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 a pull request may close this issue.

2 participants