Opened 5 years ago

Closed 5 years ago

#20815 closed enhancement (fixed)

libbraiding as an optional package.

Reported by: mmarco Owned by:
Priority: major Milestone: sage-7.3
Component: packages: optional Keywords:
Cc: kcrisman, amitjamadagni, fugelde, tscrim, jdemeyer Merged in:
Authors: Miguel Marco Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 47d64ef (Commits, GitHub, GitLab) Commit: 47d64ef506b5ebdde2869491e5e05d5e293d37d2
Dependencies: Stopgaps:

Status badges

Description (last modified by mmarco)

braiding[1] is a C++ program writen by Juan Gonzalez-Meneses to compute several properties of braids. Specially related to the conjugacy problem in the braid group.

I did a fork of it[2] to convert it into a shared library[2].

The cython interface, and the methods in the braid groups are being worked on.

[1] https://github.com/jeanluct/cbraid [2] https://github.com/miguelmarco/libbraiding

Attachments (1)

libbraiding-1.0.tar.gz (368.3 KB) - added by mmarco 5 years ago.

Download all attachments as: .zip

Change History (32)

Changed 5 years ago by mmarco

comment:1 Changed 5 years ago by mmarco

  • Description modified (diff)

comment:2 Changed 5 years ago by mmarco

  • Branch set to u/mmarco/libbraiding_as_an_optional_package_

comment:3 Changed 5 years ago by mmarco

  • Cc kcrisman amitjamadagni fugelde tscrim jdemeyer added
  • Commit set to 774d04802bc4f3fc1970cf8498aae7a59c067d76
  • Status changed from new to needs_review

New commits:

774d048Add libbraiding package

comment:4 Changed 5 years ago by tscrim

From what we did with libhomfly, I felt that it would have been better to do everything on one ticket. That way we could make changes at all stages (the backend library, cython interface, and the Sage frontend) in one localized place. To me, it doesn't quite make sense to just add the spkg.

comment:5 Changed 5 years ago by mmarco

  • Description modified (diff)

Fair enough. Working on that now.

comment:6 Changed 5 years ago by mmarco

  • Status changed from needs_review to needs_work

comment:7 Changed 5 years ago by git

  • Commit changed from 774d04802bc4f3fc1970cf8498aae7a59c067d76 to a6453b180c76aa1b1b24aca30525beb608b70b57

Branch pushed to git repo; I updated commit sha1. New commits:

a6453b1cython interface. Some docstrings missing.

comment:8 Changed 5 years ago by git

  • Commit changed from a6453b180c76aa1b1b24aca30525beb608b70b57 to 27be32be6c9b9538d0b414cba2c42025dd24ceb1

Branch pushed to git repo; I updated commit sha1. New commits:

27be32bPolished doctests, added to module list and documentation

comment:9 Changed 5 years ago by git

  • Commit changed from 27be32be6c9b9538d0b414cba2c42025dd24ceb1 to 1f76bcfc26c4aa445048401ad7de202f4b74772c

Branch pushed to git repo; I updated commit sha1. New commits:

4047b09Raise error if libbraiding package is not installed
1f76bcfAdded methods to braids

comment:10 Changed 5 years ago by mmarco

  • Status changed from needs_work to needs_review

I think it id ready for review.

comment:11 Changed 5 years ago by jdemeyer

  • Status changed from needs_review to needs_work

Remove these comments:

#clang C++
#clib braiding

comment:12 Changed 5 years ago by git

  • Commit changed from 1f76bcfc26c4aa445048401ad7de202f4b74772c to f065a2dc349c90ab289d7cef25f103df7c0d432d

Branch pushed to git repo; I updated commit sha1. New commits:

f065a2dRemoved pragma-like comments,

comment:13 Changed 5 years ago by mmarco

  • Status changed from needs_work to needs_review

Done.

comment:14 Changed 5 years ago by jdemeyer

  • Status changed from needs_review to needs_work
sage -t src/sage/libs/braiding.pyx
**********************************************************************
File "src/sage/libs/braiding.pyx", line 66, in sage.libs.braiding.conjugatingbraid
Failed example:
    from sage.libs.braiding import conjugatingbraid
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.conjugatingbraid[0]>", line 1, in <module>
        from sage.libs.braiding import conjugatingbraid
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 99, in sage.libs.braiding.leftnormalform
Failed example:
    from sage.libs.braiding import leftnormalform
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.leftnormalform[0]>", line 1, in <module>
        from sage.libs.braiding import leftnormalform
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 130, in sage.libs.braiding.rightnormalform
Failed example:
    from sage.libs.braiding import rightnormalform
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.rightnormalform[0]>", line 1, in <module>
        from sage.libs.braiding import rightnormalform
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 162, in sage.libs.braiding.greatestcommondivisor
Failed example:
    from sage.libs.braiding import greatestcommondivisor
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.greatestcommondivisor[0]>", line 1, in <module>
        from sage.libs.braiding import greatestcommondivisor
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 196, in sage.libs.braiding.leastcommonmultiple
Failed example:
    from sage.libs.braiding import leastcommonmultiple
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.leastcommonmultiple[0]>", line 1, in <module>
        from sage.libs.braiding import leastcommonmultiple
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 228, in sage.libs.braiding.centralizer
Failed example:
    from sage.libs.braiding import centralizer
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.centralizer[0]>", line 1, in <module>
        from sage.libs.braiding import centralizer
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 266, in sage.libs.braiding.supersummitset
Failed example:
    from sage.libs.braiding import supersummitset
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.supersummitset[0]>", line 1, in <module>
        from sage.libs.braiding import supersummitset
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 297, in sage.libs.braiding.ultrasummitset
Failed example:
    from sage.libs.braiding import ultrasummitset
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.ultrasummitset[0]>", line 1, in <module>
        from sage.libs.braiding import ultrasummitset
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 328, in sage.libs.braiding.thurston_type
Failed example:
    from sage.libs.braiding import thurston_type
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.thurston_type[0]>", line 1, in <module>
        from sage.libs.braiding import thurston_type
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 369, in sage.libs.braiding.rigidity
Failed example:
    from sage.libs.braiding import rigidity
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.rigidity[0]>", line 1, in <module>
        from sage.libs.braiding import rigidity
    ImportError: No module named braiding
**********************************************************************
File "src/sage/libs/braiding.pyx", line 399, in sage.libs.braiding.sliding_circuits
Failed example:
    from sage.libs.braiding import sliding_circuits
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.libs.braiding.sliding_circuits[0]>", line 1, in <module>
        from sage.libs.braiding import sliding_circuits
    ImportError: No module named braiding
**********************************************************************

New commits:

f065a2dRemoved pragma-like comments,

comment:15 Changed 5 years ago by jdemeyer

This is pointless since the module cannot even be imported without the package:

    if not is_package_installed('libbraiding'):
        raise NotImplementedError("This functionality requires the libbraiding package")

comment:16 follow-up: Changed 5 years ago by mmarco

Ok. Does it make sense to put it in the braid methods?

comment:17 Changed 5 years ago by git

  • Commit changed from f065a2dc349c90ab289d7cef25f103df7c0d432d to aee2f4d521172fa9d8881af15657cd29e3b7385b

Branch pushed to git repo; I updated commit sha1. New commits:

aee2f4dRemoved unnecessary checks for installed package

comment:18 in reply to: ↑ 16 Changed 5 years ago by jdemeyer

Replying to mmarco:

Ok. Does it make sense to put it in the braid methods?

Yes, but

  1. avoid is_package_installed, use except ImportError instead.
  2. use the PackageNotFoundError exception instead of NotImplementedError.

comment:19 Changed 5 years ago by git

  • Commit changed from aee2f4d521172fa9d8881af15657cd29e3b7385b to 17d0e8fed0fd83c18f271fa9a4d6fc43844cd155

Branch pushed to git repo; I updated commit sha1. New commits:

7d6e667Mark import statements in doctests as optional
17d0e8fHandle ImportError exceptions

comment:20 Changed 5 years ago by mmarco

  • Status changed from needs_work to needs_review

comment:21 Changed 5 years ago by jdemeyer

  • Status changed from needs_review to needs_work

The exception should be

PackageNotFoundError("libbraiding")

comment:22 Changed 5 years ago by git

  • Commit changed from 17d0e8fed0fd83c18f271fa9a4d6fc43844cd155 to fa4300c86af40d0834605215f99fc8bb4b86ffea

Branch pushed to git repo; I updated commit sha1. New commits:

fa4300cCorrected Error message

comment:23 Changed 5 years ago by mmarco

  • Status changed from needs_work to needs_review

comment:24 Changed 5 years ago by tscrim

  • Branch changed from u/mmarco/libbraiding_as_an_optional_package_ to public/optional_packages/libbraiding-20815
  • Commit changed from fa4300c86af40d0834605215f99fc8bb4b86ffea to 12e649ceb53dd5dc9f4cac94f2e38d0484f27f48
  • Reviewers set to Travis Scrimshaw

I've done some cleanup of the files wrt documentation and whitespace. Otherwise LGTM.


New commits:

f12c4f3Merge branch 'u/mmarco/libbraiding_as_an_optional_package_' of trac.sagemath.org:sage into u/mmarco/libbraiding_as_an_optional_package_
12e649cSome cleanup of the doc and whitespace.

comment:25 Changed 5 years ago by mmarco

Positive review then?

comment:26 Changed 5 years ago by tscrim

  • Status changed from needs_review to positive_review

Yep.

comment:27 Changed 5 years ago by vbraun

  • Status changed from positive_review to needs_work
sage -t --long src/sage/groups/braid.py
**********************************************************************
File "src/sage/groups/braid.py", line 1445, in sage.groups.braid.Braid.sliding_circuits
Failed example:
    b.sliding_circuits()
Exception raised:
    Traceback (most recent call last):
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 498, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 861, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.groups.braid.Braid.sliding_circuits[3]>", line 1, in <module>
        b.sliding_circuits()
      File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/groups/braid.py", line 1456, in sliding_circuits
        raise PackageNotFoundError("libbraiding")
    NameError: global name 'PackageNotFoundError' is not defined
**********************************************************************
1 item had failures:
   1 of   5 in sage.groups.braid.Braid.sliding_circuits
    [313 tests, 1 failure, 17.35 s]

comment:28 Changed 5 years ago by git

  • Commit changed from 12e649ceb53dd5dc9f4cac94f2e38d0484f27f48 to 96a414db31e8199d9dbbdccb06cd9fc890096cf3

Branch pushed to git repo; I updated commit sha1. New commits:

96a414dSome last little details.

comment:29 Changed 5 years ago by git

  • Commit changed from 96a414db31e8199d9dbbdccb06cd9fc890096cf3 to 47d64ef506b5ebdde2869491e5e05d5e293d37d2

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

47d64efSome last little details.

comment:30 Changed 5 years ago by tscrim

  • Status changed from needs_work to positive_review

Missed one doctest that was suppose to be marked as optional, as well as just a realignment of the doctest output.

comment:31 Changed 5 years ago by vbraun

  • Branch changed from public/optional_packages/libbraiding-20815 to 47d64ef506b5ebdde2869491e5e05d5e293d37d2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.