Skip to content

Why pydeps pydeps doesn't work? #173

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

Closed
deryabozyurt opened this issue Mar 30, 2023 · 6 comments
Closed

Why pydeps pydeps doesn't work? #173

deryabozyurt opened this issue Mar 30, 2023 · 6 comments

Comments

@deryabozyurt
Copy link

Greetings,
I'm trying to use the simplest example provided in the documentation.
>pydeps pydeps
>No such file or directory: 'pydeps'
Same output on Mac and Windows.
How can make this work?
Kind Regards,
Derya

@stefan6419846
Copy link

For this to work, you have to clone this repository and run the command from the cloned directory.

@thebjorn
Copy link
Owner

Hi @deryabozyurt and thank you for your interest in pydeps. In the example (pydeps pydeps) the first pydeps is the name of the program, the second pydeps is the name of the directory to run on, i.e. if you have a copy of the sources of pydeps that will run pydeps on itself (assuming you are in the directory containing the setup.py file).

A complete example to get that to work would be:

/home/thebjorn> git clone https://github.com/thebjorn/pydeps.git
/home/thebjorn> cd pydeps
/home/thebjorn/pydeps> pip install -e .
/home/thebjorn/pydeps> pydeps pydeps

(notice the dot . at the end of the pip install line)

For regular use on your own code, you would do

/home/thebjorn> pip install pydeps
/home/thebjorn> cd myproject
/home/thebjorn/myproject> pip install -e .
/home/thebjorn/myproject> pydeps myproject

assuming your project had the following structure:

myproject
|   `-- myproject
|   `-- __init__.py
|-- README.rst
`-- setup.py

(the pip install line might not be needed).

Esentially the command is

   parent-directory> pydeps <directory-with-code>

@deryabozyurt
Copy link
Author

Thank you very much Stefan and Bjorn.
I'm able to get rid of the error. However I'm trying to use pydeps to understand a large project setup similar to https://github.com/dwavesystems/dwave-ocean-sdk and when I follow the workflow above, I get an empty svg file. I suspect the "project" structure is not what pydeps requires and dependent packages may need to be individually cloned.
Do you have any suggestions for me to figure out the dependencies of a project similar to dwave-ocean-sdk?
Kind Regards,
Derya

@thebjorn
Copy link
Owner

I haven't really used git submodules very much, but IIUC you'll need to run pydeps in every submodule (if they're connected by regular imports then pydeps will pick them up -- maybe with a larger --max-bacon value..?)

@iPAS
Copy link

iPAS commented Jul 9, 2024

Hi @deryabozyurt and thank you for your interest in pydeps. In the example (pydeps pydeps) the first pydeps is the name of the program, the second pydeps is the name of the directory to run on, i.e. if you have a copy of the sources of pydeps that will run pydeps on itself (assuming you are in the directory containing the setup.py file).

A complete example to get that to work would be:

/home/thebjorn> git clone https://github.com/thebjorn/pydeps.git
/home/thebjorn> cd pydeps
/home/thebjorn/pydeps> pip install -e .
/home/thebjorn/pydeps> pydeps pydeps

(notice the dot . at the end of the pip install line)

For regular use on your own code, you would do

/home/thebjorn> pip install pydeps
/home/thebjorn> cd myproject
/home/thebjorn/myproject> pip install -e .
/home/thebjorn/myproject> pydeps myproject

assuming your project had the following structure:

myproject
|   `-- myproject
|   `-- __init__.py
|-- README.rst
`-- setup.py

(the pip install line might not be needed).

Esentially the command is

   parent-directory> pydeps <directory-with-code>

Probably this explanation should be in the README.md too.

@thebjorn
Copy link
Owner

thebjorn commented Jul 9, 2024

@iPAS it sort of is there already...

pydeps finds imports by looking for import-opcodes in python bytecodes (think .pyc files). Therefore, only imported files will be found (ie. pydeps will not look at files in your directory that are not imported). Additionally, only files that can be found using the Python import machinery will be considered (ie. if a module is missing or not installed, it will not be included regardless if it is being imported). This can be modified by using the --include-missing flag.

I'm always happy to merge documentation PRs if you know of a better way to communicate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants