Coder Social home page Coder Social logo

graph-composer's Issues

show command requires xdg-open

the requirement is one issue .. but the fact it gives no information if the command is not available is the bigger issue.

Unable to invoke "dot" to create image file (code 127)

I get this error:

Unable to invoke "dot" to create image file (code 127)

I have installed the graphviz, I have tried to reinstall it again, but I still get the same error.

Using Yii2, controller action:

public function actionGraph()
{
    $dir = Yii::getAlias('@app') . '/vendor';
    $graphComposer = new \Clue\GraphComposer\Graph\GraphComposer($dir);
    $graph = $graphComposer->createGraph();

    $graphviz = new \Graphp\GraphViz\GraphViz();
    $graphviz->setFormat('svg');
    $svg = $graphviz->createImageFile($graph);
    return $this->render('graph', ['svg' => $svg]);
}

and view:

<?php

/**
 * @var $this yii\web\View
 * @var $svg string
 */

var_dump($svg);
use yii\helpers\Html;

$this->title = 'Dependency Graph';
$this->params['breadcrumbs'][] = $this->title;

?>

<div class="site-dependency-graph">
    <h1><?= Html::encode($this->title) ?></h1><br />

    <div id="graph-placeholder">
        <!-- place here the svg file -->
        <?= $svg ?>
    </div>
</div>

composer install doesn't work

Ran this to install:

composer require --dev clue/graph-composer

Tried this but there is no vendor/bin folder even:
./vendor/bin/graph-composer show

Tried this but get error message:
./vendor/clue/graph-composer/bin/graph-composer show

sh: dot: command not found

  [Fhaculty\Graph\Exception\UnexpectedValueException]
  Unable to invoke "dot" to create image file (code 127)

Need to update installation directions to require dot even if installing via composer.
Also fix or update installation directions for the vendor/bin problem.

Add option to limit depth of the graph

Some projects have many dependencies and the graphs can get too large (#11). One option would be to add a --depth option in order to limit the depth of the resulting graph.

For example, the following could be used to display only direct dependencies (i.e. no sub-dependencies):

$ graph-composer show --depth=1

Special care may have to be taken with regards to loops/circles in the graph.

What about left to right direction? (horizontal layout)

The default exported image is from up to down. So, when the dependence packages go large, the width of the image goes wide.
I think it would be better to make it left to right (Or you can do an option), at least as a tree, the depth wouldn't go so far. It is more convenience to scroll from up to down than scroll left to right...
( :) a lot of directions may not confuse you )

Add GraphML export for manual positioning

Actually exporting to GraphML should be implemented in graphp/graph#3.

This ticket serves both as a valid use case for its implementation and as a reminder to add the necessary glue code to take advantage of it within this project.

Add warning when GraphViz is not installed

Currently, generating a graph image just fails if GraphViz (dot executable) is not installed. Instead, we should check for the existence and fail gracefully with a concise, readable error message. On Debian-based systems, we could perhaps also offer to install it via sudo apt-get install graphviz.

PHP 8+ support

The following deprecation notices are generated when I run the latest release on PHP 8.1

php graph-composer-1.1.0.phar export ./
[12-Sep-2022 07:56:11 UTC] PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php on line 104

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php on line 104
[12-Sep-2022 07:56:11 UTC] PHP Deprecated:  Return type of Fhaculty\Graph\Set\Vertices::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 414

Deprecated: Return type of Fhaculty\Graph\Set\Vertices::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 414
[12-Sep-2022 07:56:11 UTC] PHP Deprecated:  Return type of Fhaculty\Graph\Set\Vertices::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 451

Deprecated: Return type of Fhaculty\Graph\Set\Vertices::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Vertices.php on line 451
[12-Sep-2022 07:56:11 UTC] PHP Deprecated:  Return type of Fhaculty\Graph\Set\Edges::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 386

Deprecated: Return type of Fhaculty\Graph\Set\Edges::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 386
[12-Sep-2022 07:56:11 UTC] PHP Deprecated:  Return type of Fhaculty\Graph\Set\Edges::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 412

Deprecated: Return type of Fhaculty\Graph\Set\Edges::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///mnt/files/local_mount/build/graph-composer-1.1.0.phar/vendor/clue/graph/src/Set/Edges.php on line 412

Compatibility with composer v2

Looks like composer build is not compatible with composer v2.

$ composer build

[1/1] Creating phar graph-composer-1.1.0-5-g25ea081.phar
  - Adding main package "clue/graph-composer"
  - Adding composer base files

Catchable fatal error: Argument 1 passed to Clue\PharComposer\Package\Package::__construct() must be of the type array, boolean given, called in /root/graph-composer/vendor/clue/phar-composer/src/Clue/PharComposer/Phar/PharComposer.php on line 136 and defined in /root/graph-composer/vendor/clue/phar-composer/src/Clue/PharComposer/Package/Package.php on line 21
Script @php build.php handling the build event returned with error code 255

Build still works fine however in composer v1 (now deprecated). I noticed this when attempting to containerize this (see https://github.com/patricknelson/graph-composer-docker).
Step to reproduce:

# Get graph-composer-docker repository and work from the 'composer-2' branch
git clone [email protected]:patricknelson/graph-composer-docker.git
cd graph-composer-docker
git checkout composer-2

# Tries to build container, but will fail
docker-compose up -d --build

Basically, what the Dockerfile does:

EDIT: You can see the diff in Dockerfile now in this PR: patricknelson/graph-composer-docker#1

How to tweak the layout?

I just played around with your phar and created a graph of my project (phundament/app).

bildschirmfoto 2013-10-21 um 19 58 16

How could I stretch or expand the nodes so that the connections become more clearly visible?
Or adjust the layout so that the nodes are distributed more into a vertical direction.

Release 1.0.0 is missing version

wget https://github.com/clue/graph-composer/releases/download/v1.0.0/graph-composer.phar
php graph-composer.phar --version

Output:

graph-composer version @git_tag@

Expected:

graph-composer version 1.0.0

add dockerfile/example to ease usage

I created the following dockerfile to test this project

FROM alpine:3.13

RUN apk add --no-cache curl

WORKDIR /app

RUN curl -o graph-composer -L https://clue.engineering/graph-composer-latest.phar && chmod +x graph-composer

FROM php:8.0-cli-alpine

COPY --from=0 /app/graph-composer /usr/local/bin/graph-composer

RUN sed -i '/edge/s/^#//' /etc/apk/repositories \
    && apk add --no-cache graphviz

WORKDIR /app

ENTRYPOINT ["/usr/local/bin/graph-composer"]

Would you be interested in connecting it to your project in any way ? It can of course be modified.

Build/deploy graph-composer.phar automatically

The current steps to build and deploy a new graph-composer.phar are:

  1. Install project and dependencies as per README.md
  2. Install box.phar as per its readme
  3. Run php box.phar build to generate a new graph-composer-{version}.phar
  4. Upload the phar to any hosting service and get its URL
  5. Update README.md to reflect new download URL

Obviously, this should be automated. Possible solutions:

  • Perhaps using some external cloud service? I suppose we're not the first to run into this?
  • Perhaps using something like bintray to host the phar archives (could automatic steps 4 and 5)
  • Any suggestions?

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.