Code Monkey home page Code Monkey logo

Comments (11)

agronholm avatar agronholm commented on August 16, 2024

Isn't that your IDE's fault for displaying modules from private packages?

from anyio.

belm0 avatar belm0 commented on August 16, 2024

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.

agronholm avatar agronholm commented on August 16, 2024

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.

belm0 avatar belm0 commented on August 16, 2024

PyCharm is where this problem happens.

Screen Shot 2019-04-12 at 10 07 01 PM

from anyio.

belm0 avatar belm0 commented on August 16, 2024

Note that trio-websockets and other packages using trio did not show up in that list. Only anyio.

from anyio.

agronholm avatar agronholm commented on August 16, 2024

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.

belm0 avatar belm0 commented on August 16, 2024

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.

agronholm avatar agronholm commented on August 16, 2024

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.

agronholm avatar agronholm commented on August 16, 2024

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.

belm0 avatar belm0 commented on August 16, 2024

https://youtrack.jetbrains.com/issue/PY-35385

from anyio.

agronholm avatar agronholm commented on August 16, 2024

I finally decided in favor of this, seeing as how trio now does the same thing everywhere.

from anyio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.