-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
<directory> is not a valid Python package name #8400
Comments
TBH, I don't see what is not clear in this error message, but if you will make a PR with alternative wording we might consider it. |
Hi,
Now I have to investigate:
It will be nice to print invalid package full name/directory. Thank you. |
I'm getting a similar error where my directory structure is |
@markfickett I got the same problem. After renaming |
I am getting this error for a parent directory which is not coupled with the actual project.
The I could move the project into another directory hierarchy, but then what if someone clones my repo into a directory with dashes? This definitely seems like an error, but I am new to MyPy so I could just be missing some kind of configuration which will work around this. |
@BTripp1986 do you get any response if this is indeed an issue or not? I ran into the same problem. Checking out a git repository with the name |
I had the same problem, but I managed to make progress by directly pointing to the Python package I needed using the --package option like: |
Running into this. I think this is a silly restriction. I'd like to use mypy in heterogenous codebases. Not everything has to adhere perfectly to Python standards. Python can also be a scripting language, and so PEP8 does not have to be a first class citizen on every occasion. |
I just ran into this in a situation where I am using a submodule
main.py:
|
Kindly, why is this issue closed? This makes |
How to disable this rule, if anyone can help please? |
Frankly your best option is to just disable mypy completely, that's we ended up doing at my company. It's incredibly slow and it's output is wrong most of the time anyway. Plus, you'll note the lack of response on tickets like this one. My advice is to save yourself a heap of time and needless hassle and just chuck mypy in the bin :) |
Well, your explanation is actually perfect: thanks for this! 🙂 So for the
Low cost to change, and it's going to help hundreds of people. 😎 Thanks! |
Note that this message appears for a couple other reported issues, but it's not clear that they are the same: #8229 and #6003
Please provide more information to help us understand the issue:
Bug
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
Code is this in test1.py:
Directory layout is more critical:
test -> nested -> nested-2 -> test1.py
Next to test1.py is
__init__.py
- other directories are empty.When I run
~/.local/pyenv/versions/3.7.2/bin/python -m mypy /Users/bencreasy/test/nested/nested-2/test1.py
I get:nested-2 is not a valid Python package name
If I remove
__init__.py
, the message goes away.Don't see why it can't run the file, but if it cannot, a better error message.
Python: Python 3.7.2
mypy: mypy 0.761
Yes, after running
pip install git+git://github.com/python/mypy.git@a07dbd00638c35729e30dfc4ae441a8985183563
- same message.None.
The text was updated successfully, but these errors were encountered: