Giter Site home page Giter Site logo

gap-packages / francy Goto Github PK

View Code? Open in Web Editor NEW
9.0 8.0 7.0 14.3 MB

An Interactive Discrete Mathematics Framework for GAP

Home Page: https://gap-packages.github.io/francy/

License: MIT License

GAP 12.96% JavaScript 23.47% CSS 1.00% HTML 0.24% Jupyter Notebook 62.06% Python 0.08% Dockerfile 0.18%
gap javascript jupyter-notebook-extension jupyterlab-extension graphviz jupyter binder graphics-semantics jupyter-gap-kernel visjs

francy's People

Contributors

fingolfin avatar jamesjer avatar mcmartins avatar pedritomelenas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

francy's Issues

Directories structure

76.5 Structure of a GAP Package explains the directories structure of a GAP package. francy does not have PackageInfo.g file in the top-level directory, but has it in its gap subdirectory. GAPInfo.PackagesInfo actually contains an entry for francy, what means that GAP detects that there is a PackageInfo.g in the subdirectory. This is however the first package of such kind, and I am afraid that this may cause confusion in many other places.

Weird overrides for SetSize etc.

We discovered that Francy installs methods for SetSize etc. and were wondering why. Looking closer, we discovered this code:

DeclareCategory("IsFrancyObject", IsObject);
...
DeclareCategory("IsShape", IsFrancyObject);
...
DeclareRepresentation("IsShapeRep", IsComponentObjectRep, [], IsShape);
...
DeclareAttribute("Size", IsShape);
InstallMethod(Size, "shape", [IsShape], o -> o!.size);
InstallMethod(SetSize, "shape, int", [IsShape, IsPosInt], function(o, i) o!.size := i; end);

This is quite puzzling to me, because it means that you are essentially reimplementing a core GAP feature: namely, attribute storing representations. As a matter of fact, if you remove your custom Size and SetSize methods, and replace IsComponentObjectRep by IsAttributeStoringRep, then you get almost identical code, except that o!.size becomes o!.Size.

Is there a reason you are not using IsAttributeStoringRep? If not, I'd strongly suggest to switch to it, else you code will be a very non-gapish oddball, hard to understand and debug for people who are used to working with "standard" GAP objects. At the same time, you should be able to delete a ton of methods this way.

CI broken due to `jupyterlab/builder` version issues

From the CI logs:

jupyterlab-francy: $ jupyter labextension build .
jupyterlab-francy: Building extension in .
jupyterlab-francy: /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/jupyterlab/debuglog.py:56: UserWarning: An error occurred.
jupyterlab-francy:   warnings.warn("An error occurred.")
jupyterlab-francy: /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/jupyterlab/debuglog.py:57: UserWarning: ValueError: Extensions require a devDependency on @jupyterlab/builder@^4.1.5, you have a dependency on 3.6.3
jupyterlab-francy:   warnings.warn(msg[-1].strip())

Problem with "open" on Debian/Ubuntu et al

On my Debian and Ubuntu systems the test file francy-1.2.4 /tst/canvas.tst runs into an error at the command DrawSplash(canvas);. The reason is that the corresponding method tries to open an HTML file in my standard browser with the command open. But on my system /bin/open is a link to openvt, while I guess you want to call the program called xdg-open which would open a local html-file in my preferred browser.

Unfortunately, I don't know if changing open to xdg-open in your code would work on most Linux systems.

Modal menus subject to bugs

Currently, I'm unable to get any graph node modal menus on the Jupyter notebook with a Python kernel. This regression happened after a development installation. Previously, I had them. I'll check again and add more details here.

Moreover on Jupyterlab, right clicking opens a specific Jupyterlab context menu. See jupyterlab/jupyterlab#3521

ParentNode - name clash with QPA package

After @sebasguts added Francy to the Docker container for the GAP master branch, package tests using that container all fail with the following:

Error, operation` ParentNode' was created as an attribute, use `DeclareAttribute'

See e.g. https://travis-ci.org/gap-system/gap-docker-pkg-tests-master/builds/392020023

Indeed, QPA does DeclareOperation( "ParentNode", [IsSuffixTreeNode] ); and Francy does DeclareAttribute("ParentNode", IsShape); so it's not possible to load QPA after Francy. Could we resolve this in Francy as soon as possible please?

Clashes with GRAPE

It seems there is a clash with GRAPE package.

Error, BIND_GLOBAL: variable `IsGraph' must be unbound at /home/pedro/lib/gap/lib/global.g:137 called from
BIND_GLOBAL( arg[1], CALL_FUNC_LIST( NewCategory, arg ) 
 ); at /home/pedro/lib/gap/lib/type.g:145 called from
<function "DeclareCategory">( <arguments> )
 called from read-eval loop at /home/pedro/lib/gap/pkg/francy/gap/graph.gd:19
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> 

Thanks,
Pedro

Merging zerline/francy-widget

Hi Manuel

Do you think we could merge my francy-widget into francy as a subpackage?

If so, do you have specifications for me before I attempt a PR?

Best,

Cannot add Jupyter notebook extension

On Mac OS X, I followed the instructions in the README file, with the following results.

$ pip install jupyter_francy

Got errors about insufficient permissions, because I set up my pip as root for some reason, so...

$ sudo pip install jupyter_francy

Did the whole installation, completing with this line of output:

Successfully installed jupyter-francy-0.8.10b0

Then this step failed, as shown:

$ jupyter nbextension enable --py --sys-prefix jupyter_francy
Traceback (most recent call last):
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/bin/jupyter-nbextension", line 11, in <module>
    load_entry_point('notebook==5.0.0', 'console_scripts', 'jupyter-nbextension')()
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/vendor/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/notebook/nbextensions.py", line 900, in start
    super(NBExtensionApp, self).start()
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/jupyter_core/application.py", line 256, in start
    self.subapp.start()
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/notebook/nbextensions.py", line 808, in start
    self.toggle_nbextension_python(self.extra_args[0])
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/notebook/nbextensions.py", line 784, in toggle_nbextension_python
    logger=self.log)
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/notebook/nbextensions.py", line 445, in enable_nbextension_python
    logger=logger)
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/notebook/nbextensions.py", line 360, in _set_nbextension_state_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/lib/python2.7/site-packages/notebook/nbextensions.py", line 1034, in _get_nbextension_metadata
    m = import_item(module)
  File "/usr/local/Cellar/jupyter/1.0.0_1/libexec/vendor/lib/python2.7/site-packages/traitlets/utils/importstring.py", line 42, in import_item
    return __import__(parts[0])
ImportError: No module named jupyter_francy

Because pip list does not mention jupyter_francy, but rather jupyter-francy, I also tried

$ jupyter nbextension enable --py --sys-prefix jupyter-francy

but that produced the same results (except with - in place of _ of course).

What am I doing wrong?

Canvas test failures

The tests in the 2.0.0 release fail in canvas.tst, because the string returned by FrancyId(canvas) does not match the expected value. The same is true for the id field in the output of PrintObj(canvas). If I am reading the code correctly, the ID is a random uuid prepended with F. This means that test is very nearly guaranteed to fail.

Update JSON Schema on GAP Package

The JSON Schema is not used by the gap package, but contains the definition of the whole API and is the contract between Francy GAP and Francy JS (or any other that might come up)...

Francy modal menus are not language-agnostic

Hi again!

I'm trying to get a modal menu on graph nodes, on a python kernel.

Francy JS code (in francy-core/src/render/callback.js) calls a Trigger function, which does not exist in Python.

Did you think of any more general message handling feature?

minimize intersections of lables in .HASSE

It should be nice to have a way to minimize intersections of edges. This is interesting when drawing Hasse diagrams. Graphviz has this possibility, but with d3 this can be somehow difficult to achieve.
Thanks,
Pedro

francy-widget for Jupyterlab does not work

My own francy-widget depends on francy for all javascript and does not work on Jupyterlab: the browser does not seem to find the JS code, there is an error about not finding a file, although I can open the file from that same path.

I've been told that it comes from an incomplete javascript installation of francy.

I'll add more details later.

Select Renderer from GAP

It should be possible to specify the renderer to use on GAP.
When a user specifies the renderer this way, the client should only allow the user to use the current renderer.

Whitespace clean files?

Looking at the code, I noticed a few places that have dangling whitespace. It's probably a good idea to just clean those away, and then use a git-hook or your editor to clean them (or refuse commits if they exist).

Strange `release.txt` file, also `RELEASE.md`?

There is a file release.txt which says this:

This major release includes multiple bug fixes and performance improvements.

We dropped support to jupyter notebooks extension.

So it looks as if this meant to be a kind of NEWS or CHANGES file. But then it should at the very least indicate which version it refers to (I'd suggest to also include the date that release was made).

At the same time there is a file RELEASE.md which despite its similar name seems to be totally unrelated, and serves as a reminder for @mcmartins . I would recommend to move that into a subdir dev or etc, and exclude it from the release tarball.

GAP and JS Tests

It is needed to implement proper tests on both modules. This should include code coverage and a travis build.

Development installation

Hi Manuel!

I've been trying to install jupyter_francy in development mode, but the JS files do not seem to get built. I have tried following commands (from ./js/packages/francy-extension-jupyter):

$ pip install -vvv -e .
/.../
running egg_info
writing jupyter_francy.egg-info/PKG-INFO
writing dependency_links to jupyter_francy.egg-info/dependency_links.txt
writing requirements to jupyter_francy.egg-info/requires.txt
writing top-level names to jupyter_francy.egg-info/top_level.txt
reading manifest file 'jupyter_francy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no directories found matching 'jupyter_francy/nbextension'
warning: no directories found matching 'jupyter_francy/labextension'

$ python setup.py egg_info
running egg_info
writing jupyter_francy.egg-info/PKG-INFO
writing dependency_links to jupyter_francy.egg-info/dependency_links.txt
writing requirements to jupyter_francy.egg-info/requires.txt
writing top-level names to jupyter_francy.egg-info/top_level.txt
reading manifest file 'jupyter_francy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no directories found matching 'jupyter_francy/nbextension'
warning: no directories found matching 'jupyter_francy/labextension'
writing manifest file 'jupyter_francy.egg-info/SOURCES.txt'

$ python setup.py sdist
-> no JS files at all in the resulting .tar.gz

Create Gap Package

XGap is too tightly coupled with the XWindow system making it difficult to reuse.

Francy should implement basic representation of canvas, shapes, groups, links and actions in the form of json. These features should output json-ld in order to allow any technology to build and display graphics.

By being able to use these objects, one will be able to use them and generate meaningful graphics for mathematical structures.

francy 2.0.0 release is missing tarball and/or has wrong metadata

The francy 2.0.0 PackageInfo.g file indicates that the release archive is at https://github.com/gap-packages/francy/releases/download/v2.0.0/francy-2.0.0.tar.gz but that gives a 404 error. Indeed https://github.com/gap-packages/francy/releases/tag/v2.0.0 has no custom assets, only the auto-generated tarballs. Please do not use those for releases, as their checksums are not guaranteed to be stable -- while they are for now (there was a big kerfuffle about this some time ago), it is a bad practice anyway.

(If you were using ReleaseTools that would automatically take care of all that)

messages on canvas not removable

Hi Manuel,
I am implementing an interface for coco2p to francy and came upon a problem when removing messages using a callback. I attached a minimal example for the explanation:

tstfrancymsg.g.gz

  • When adding msg1 and immediately removing it, it remains on the screen.
  • When adding msg1 and msg2 and then removing msg1 the msg1 is removed. Trying to remove msg2 afterwards remains unsuccessful.
  • When adding msg1 and msg2 and the remove both at once, nothing happens
  • When adding msg1 and remove it and the add msg2, then msg2 overwrites msg1

It seems that francy is not always redrawing the screen when removing a message.

Best,
Christian

New release?

@mcmartins there are several PRs from dependabot - perhaps a time for a new release, to include into the forthcoming GAP release?

Fix archive on the website

The website serves https://github.com/gap-packages/Francy/archive/v1.0.0.tar.gz - this is not a suitable name for a GAP package archive, as it does not contain the name of the package. Also, if you look at https://github.com/gap-packages/francy/releases then v1.0.0 is a tag but not a release. That's why I see now problems when trying to pick up francy:

* Francy - new version 1.0.0 discovered!!!
  ============================================
  Getting new archives from 
  https://github.com/gap-packages/Francy/archive/v1.0.0[ ".tar.gz" ]
  unpacking v1.0.0.tar.gz
#E  component `HTMLStart' must be bound to a string denoting a relative path t\
o a readable file
#E  component `PDFFile' must be bound to a string denoting a relative path to \
a readable file
#E  component `SixFile' must be bound to a string denoting a relative path to \
a readable file
  ERROR (Francy): validation of the info file not successful! SKIPPING!!!

Following instructions from

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.