Comments (13)
Nice! It's working well, I got the same result for over 100 runs! This is great, thanks 🙂
from pydeps.
I've just release v1.9.1 which fixes this. Thanks for all the help.
from pydeps.
I can't reproduce that behavior. Which version of pydeps? Do you have a small testcase?
from pydeps.
pydeps v1.9.0
!
I just ran this in pydeps
own repository:
for i in 1 2 3 4 5; do
pydeps pydeps --noshow --only pydeps -o pydeps.$i.svg
done
Here are the resulting SVGs thumbnails:
As you can see they all slightly differ from each other 🙂
I found some information in dot
s manual page, though I'm not sure which applies:
(neato‐specific attributes)
...
start=val. Requests random initial placement and seeds the random number generator. If val is not an integer, the process ID or current time is used as the seed.
(fdp‐specific attributes)
...
start=val. Adjusts the random initial placement of nodes with no specified position. If val is is an integer, it is used as the seed for the random number generator. If val is not an integer, a random system‐generated integer, such as the process ID or current time, is used as the seed.
If one of those start
value applies, maybe we could get a deterministic output if we used the same seed each time?
from pydeps.
Interesting, they're all exactly the same on Windows (and on WSL).
I used this, which should be similar:
python -c "import os;[os.system('pydeps pydeps --noshow --only pydeps -o pydeps.{}.svg'.format(i)) for i in range(5)]"
I'm afraid neither the neato nor the fdp layout engines are relevant since pydeps is using the dot
layout engine, but based on this tweet: https://twitter.com/Graphviz/status/1039632469782396929
a solution might be to change this line in the dot
function in pydeps/pydeps/dot.py
(L60), from:
cmd = "dot -T%s" % kw.pop('T', 'svg')
to
cmd = "dot -Gstart=1 -T%s" % kw.pop('T', 'svg')
since I can't reproduce the problem I'll need someone else to test it (..and perhaps create a PR?)
from pydeps.
I tried this option but it didn't work. I also tried -Gcenter=1
, different layouts and combinations of option, but no luck, the resulting SVG is never quite the same.
My graphviz version is dot - graphviz version 2.44.0 (0)
, and I'm on ArchLinux.
from pydeps.
Never noticed the output was not deterministic. Tried the onliner above on a small (3 files) project from $work, and while the layout was the same, in a couple the oval shapes were misplaced.
Tried on Tornado, and the 5 images were different than each other. Tried the -Gstart
change (modified the dot.py
from my venv/lib/python/site-packages/...
). First it failed to plot because of my typo (forgot the dash before Gstart). Then when I ran the second time it was still giving different layouts.
My env is Ubuntu LTS, Python Anaconda 3.7, dot - graphviz version 2.40.1 (20161225.0304).
from pydeps.
Hmm.. looks like this is a Python 3.x issue. I cannot reproduce with Py2.7 on any platform or graphviz configuration. Reproduced with Py3.6 + graphviz 2.40.1 on Ubuntu 18.04.4; and Py3.5 + graphviz 2.38.0 on Win10.
from pydeps.
Hmm.. the rule ordering in the dot file is also non-deterministic on Py3. We might get away with simply sorting the rules...?
from pydeps.
I'd be happy to try that out but I don't understand what you mean. By "rules" you mean the text input you feed to the dot command?
from pydeps.
@pawamoy I'm mostly just thinking out loudly - being able to reproduce the issue makes everything easier ;-) See the latest checkin (58bfcd7) for what I'm talking about. I'm pretty sure that if the dot source I generate is deterministic, then the resulting graphs will be as well. With the latest change we're almost there (some runs add a weight=5
to some relations that cause certain nodes to shift).
from pydeps.
@thebjorn somehow I'm getting this issue. Nodes get random order, and some times the amount of nodes are different. I'm using pydeps v1.10.22, Python 3.10.6, Graphviz 2.43.0 and Ubuntu 20.04.
from pydeps.
Hi @greenled , I can't reproduce this with py3.10.2, pydeps 1.10.22 and graphviz 2.50.0 on windows 11, running pydeps on pydeps source. Do you have a testcase?
from pydeps.
Related Issues (20)
- feature: exclude externals deps HOT 5
- Pydeps: Support compiled python filename HOT 2
- [Problem already solved, you can close this]
- The cycles display mode shows useless information and does not work properly for larger projects. HOT 8
- [Feature Request] Specify module name instead of filename HOT 4
- 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
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.