-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add an __init__.py in repo root to prevent import confusion #949
base: main
Are you sure you want to change the base?
Conversation
This prevents the current directory from being added to the search path.
So why are we special to need this? Should the inner pytensor directory be called src? |
We are not at all special; this is a completely general Python annoyance. I do prefer the src layout since it reduces confusion with the Python package names. However, it wouldn't have prevented #947. Note: While I prefer |
Hmm, 362b1b3 seems to be a workaround for a pytest bug |
Oh weird, it works for me locally |
Oh, this is pretty funny... I have pytest v8.1.1 locally, but when I upgrade to v8.2.2 I get the same behavior as the CI. That's annoying! |
I'm not entirely serious about actually merging this one. The root of this problem is Python itself, so a workaround like this is likely to introduce more problems than it solves. This is more of a proof-of-concept, to probe for misconfigurations, and to explore what nasty hacks are being used by mypy and pytest. Indeed as I'm discovering, pytest and mypy use some very nasty hacks. |
Going a bit deeper, the PR that causes the root But why does the root This block is responsible for converting a path into a pair Additionally, it seems that having |
It makes me a little bit uneasy to put an
__init__.py
file outside of a legit Python package, but that's also sort of the point. I'm interested to know what people think.Description
Related Issue
Checklist
Type of change