Comments (11)
Isn't that your IDE's fault for displaying modules from private packages?
from anyio.
Python lets you access underbar names, so an IDE is going to as well-- otherwise it would be of limited use. And how should an IDE discern between what code is "yours" (ok to access underbars) vs. not yours?
The problem isn't limited to private packages. Non-private packages can expose internal imports as well. It's an anti-pattern I believe, and packages like Trio are careful to avoid it.
from anyio.
Python lets you access underbar names, so an IDE is going to as well-- otherwise it would be of limited use. And how should an IDE discern between what code is "yours" (ok to access underbars) vs. not yours?
At least PyCharm knows the difference between project code and third party packages, so that's not an issue.
As for trio, it too contains non-private modules inside a private package: https://github.com/python-trio/trio/tree/master/trio/_subprocess_platform
from anyio.
PyCharm is where this problem happens.
from anyio.
Note that trio-websockets and other packages using trio did not show up in that list. Only anyio.
from anyio.
I didn't say that PyCharm would behave correctly. In fact, PyCharm's autocompletion is notoriously bad. It has two competing autocompletion mechanisms, one which requires full words but auto-imports more reliably (though still not completely reliably) and one which does partial matching but rarely manages to add autoimports.
Note that trio-websockets and other packages using trio did not show up in that list. Only anyio.
Does any of those packages contain a module named trio
?
from anyio.
I see-- it's due to a module named trio, rather than import of trio.
Please pick another name. Given that every codebase using anyio (transitively or directly) is going to depend and use trio directly, it's going to cause confusion many times over.
from anyio.
I'll see what I can do, but given that autocompleting even asyncio stuff in PyCharm tries to give me _asyncio
rather than asyncio
, I'd say the problem is in PyCharm.
from anyio.
I suggest you open a new issue with PyCharm to fix autocompletion to not suggest private packages or modules, at least as the first option.
from anyio.
https://youtrack.jetbrains.com/issue/PY-35385
from anyio.
I finally decided in favor of this, seeing as how trio now does the same thing everywhere.
from anyio.
Related Issues (20)
- 100% CPU load after cancel HOT 13
- run_process fails when running from .exe console_script entrypoint on windows HOT 21
- Different cancel scope behaviour on asyncio vs Trio HOT 2
- Hypothesis tests that are class members are passed self twice HOT 1
- TCP listener handler does not disconnect on EOF (netcat -N) HOT 7
- Using `request.getfixturevalue` triggers errors "This event loop is already running" HOT 1
- Raising an error inside a task of a task group can produce: `RuntimeError: called 'started' twice on the same task status` HOT 7
- Cancelling `TaskGroup.start()` cancels `TaskGroup` itself (only for `asyncio` backend) HOT 4
- anyio is unexpectedly cancelling tasks HOT 6
- Provide async `getfixturevalue()` method on anyio
- run_sync_in_worker_thread hangs when 2 calls made in quick succession HOT 2
- MemoryObjectStream can drop items when the receiving end is cancelled HOT 7
- `MemoryObjectSendStream.send(item)` doesn't raise `BrokenResourceError` when the last receive stream is closed if `item` is falsey
- Test failures with Python 3.13.0b1 in 4.4.0 HOT 4
- Allow passing kwargs to anyio.open_process and anyio.run_process HOT 2
- Typing issue while use ParamSpec HOT 2
- Add default `SIGINT` signal handler to `process_worker()` at `anyio.to_process` HOT 2
- AttributeError: 'MemoryObjectItemReceiver' object has no attribute 'item' HOT 3
- Timing out when a cancelled process takes too long to die HOT 2
- `get_coro` is missing a `None` check in `_task_started` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anyio.