Comments (4)
Is this just convenience functionality to not need to find the location of a module, or is there something special about modules found with find_spec
?
from pydeps.
Hi, yes it is mostly a convenience. If you have lots of packages installed, some editable some not editable, depending on which env, etc it can be a lot of work to seek them in the folder tree. Also if you want to automate some sort of reporting, it makes sense to have a central place to call pydeps independently of the location of the various project worspaces. I could create a custom wrapper around pydeps but I thought it'd more practical to have this builtin ...
Thank You
from pydeps.
Passing the filename can cause pydeps to incorrectly resolve imports.
If you have modules like:
a.b
a.c
c
and a/b.py
has import c
then passing pydeps a/b.py --show-deps
will show that import c
is resolved to a/c.py
which is incorrect.
(If a/b.py
were to import a/c.py
then it would need to do either import a.c
or from . import c
OR a/b.py
must be run as a script (so that pythona adds a/
to sys.path
)
But if we were able to run pydeps -m a.b
then pydeps ought to know not to resolve import c
to a/c.py
.
edit: Oh I guess it resolves differently if a
is a namespace package (i.e. if a/__init__.py
exists or not)
from pydeps.
Python seems to think that a/c.py
is correct, ie.:
\tmp\pydeps199\src> yamldirs .
.:
__init__.py: ''
a:
__init__.py: ''
b.py: |
print('a/b.py')
import c
c.py: print('a/c.py')
c.py: print('/c.py')
Python:
\tmp\pydeps199\src> py -3.12 a\b.py
a/b.py
a/c.py
You might be running into the difference in import-behavior between scripts and imports..?
from pydeps.
Related Issues (20)
- [Problem already solved, you can close this]
- The cycles display mode shows useless information and does not work properly for larger projects. HOT 8
- Resolving relative dependencies? HOT 7
- Support for namespace packages HOT 1
- use of `--externals` results in TypeError: 'Config' object does not support item assignment HOT 1
- --dot-output option is not effective HOT 1
- Support output markdown mermaid HOT 1
- empty result with WARNING: SKIPPING ILLEGAL MODULE_NAME: D:.test.a HOT 2
- Support for specifying more than one `fname`
- 1.12.19: pitest fails in `tests/test_package_names.py::test_find_package_names` unit HOT 2
- `--exclude` option not working HOT 1
- Show only top-level imports HOT 1
- Exclude/include dependencies by filepath HOT 1
- Add type hints HOT 1
- Use of pydeps in CI to reject introduction of new import cycles? HOT 3
- Constrain output geometry / size HOT 2
- pydeps randomly generates compiled pyc files when examine python source file HOT 4
- Support for editable packages / direct_url.json HOT 10
- Different types of imports get disconnected. HOT 3
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 pydeps.