Giter Club home page Giter Club logo

Comments (8)

leo-the-manic avatar leo-the-manic commented on August 23, 2024

Perhaps this is too naive but what about just testing if 'site-packages' is in module.__path__.split(os.pathsep)?

EDIT: Nevermind, I think I see what you're suggesting. In other words, for importize to properly detect local packages, the users pwd will need to be the project root? And/or you can set the project root by command-line?

I'm used to developing in an environment where I've done pip install -e . on my project so it's importable anywhere, but the files don't live in site-packages. However I don't know if my usage is that popular. Besides, if I can set the project root directory as a command-line flag to importanize it's super easy to just make that an alias for each project or something along those lines.

from importanize.

miki725 avatar miki725 commented on August 23, 2024

This is not an easy problem to solve reliably. I think unlimately config should be used to reliably detect which libs are local because that allows to fine-tune which configs go in which order. That being said, at some point I do want to implement some sort of heuristic to try to detect at least some scenarios automatically.

As for the site-packages, I dont think this is particularly reliable because even some stdlibs are not in site-packages.

from importanize.

kgaughan avatar kgaughan commented on August 23, 2024

If it's not possible to automatically detect the local package, one alternative might be to allow them to be listed in the configuration file, and/or on the command line.

from importanize.

miki725 avatar miki725 commented on August 23, 2024

@kgaughan specifying it in config is the current behavior. the idea of this ticket is to try to determine that automatically. not sure how more complex configs can be added via command line so I think it should remain configuration based or automatically generate the config if proper heuristic can be determined

from importanize.

PamelaM avatar PamelaM commented on August 23, 2024

I think a built-in "site-packages" group (similar to "stdlib" group) would be useful, even if not automatic.

from importanize.

miki725 avatar miki725 commented on August 23, 2024

hmm. interesting idea. I usually use remainder and list local libs explicitly but the reverse actually makes sense.

from importanize.

PamelaM avatar PamelaM commented on August 23, 2024

See #34

from importanize.

miki725 avatar miki725 commented on August 23, 2024

closing since site-packages is already merged and released

from importanize.

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.