Closed tobiasdiez closed 2 years ago
Replying to @tobiasdiez:
Since the PoissonTensor class is relatively short...
Just underlines my argument. ;)
Short code is much easier to review. Besides, since all the symplectic part relies on the Poisson structure, it's good to review that one first.
The sage.all imports are needed due to half-finished module imports otherwise. I plan to address this in forthcoming tickets.
What do you mean?
Branch pushed to git repo; I updated commit sha1. New commits:
d968468 | A bit more code cleanup |
Changed dependencies from #31003 to #31003, #30551
Added #30551 dependency because of future.annotations
What's the story behind the ..._test.py
files? Is it related to #30738?
I'd say we should drop these features such as typing, pytest etc. in this ticket for now, otherwise this ticket will stay on hold as long as #30738, #30551, #31003, #29775 etc. and all their follow ups have not been settled.
Taking a look at the discussions, that could take a while, whereas this ticket seems in principle to be ready for review.
Branch pushed to git repo; I updated commit sha1. New commits:
1c2cd6d | Add more examples |
Replying to @mjungmath:
The sage.all imports are needed due to half-finished module imports otherwise. I plan to address this in forthcoming tickets.
What do you mean?
Without these imports I get the following error:
ImportError while importing test module '/mnt/d/Programming/sage/src/sage/manifolds/differentiable/examples/symplectic_vector_space_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
sage/manifolds/differentiable/examples/symplectic_vector_space_test.py:2: in <module>
from sage.manifolds.differentiable.symplectic_form import SymplecticForm
sage/manifolds/differentiable/symplectic_form.py:34: in <module>
from sage.symbolic.expression import Expression
sage/symbolic/expression.pyx:310: in init sage.symbolic.expression
from .ring import SR
sage/symbolic/ring.pyx:1: in init sage.symbolic.ring
# -*- coding: utf-8 -*-
sage/rings/integer.pyx:1: in init sage.rings.integer
r"""
sage/rings/rational.pyx:95: in init sage.rings.rational
import sage.rings.real_mpfr
sage/rings/real_mpfr.pyx:1: in init sage.rings.real_mpfr
r"""
sage/libs/mpmath/utils.pyx:1: in init sage.libs.mpmath.utils
"""
sage/rings/complex_mpfr.pyx:1: in init sage.rings.complex_mpfr
"""
sage/rings/complex_double.pyx:98: in init sage.rings.complex_double
from . import complex_mpfr
E ImportError: cannot import name complex_mpfr
I tried to make progress towards solving this in #30741, but I cannot really work on this until #30371 is merged.
Replying to @mjungmath:
What's the story behind the
..._test.py
files? Is it related to #30738?
It doesn't really rely on #30738, but it uses pytest as well, yes. I'm not a big fan of doctests (as unit tests) and was told that I can always extract them to test files if I prefer that.
Replying to @mjungmath:
I'd say we should drop these features such as typing, pytest etc. in this ticket for now, otherwise this ticket will stay on hold as long as #30738, #30551, #31003, #29775 etc. and all their follow ups have not been settled.
The added typing doesn't have any dependencies (beyond #30551, which will be merged in 9.4). The pytests rely only on #31003, which is hopefully close to be merged. If you prefer, I can extract the pytests to a new ticket although it feels strange to separate the implementation from its tests.
Technically, yes. However, I have the feeling that there are still too many open discussions about using pytest and typing and how to pull it on the current framework. I doubt this ticket will get a positive review until everything is clarified in a broader context like #29775 and #30738. See also comment:28 from Travis.
Anyway, I think that symplectic forms are a great and extremely useful addition to Sage! I am looking forward to have that feature acutally in there. Thanks! :)
Replying to @tobiasdiez:
I tried to make progress towards solving this in #30741, but I cannot really work on this until #30371 is merged.
It's best to keep workarounds for your experimental setup on your branches and not to push them to tickets. We cannot merge such code and it complicates the discussions in the review. I recommend to use git add -p
and git cherry-pick
to make clean branches.
Replying to @mjungmath:
I have the feeling that there are still too many open discussions about using pytest and typing and how to pull it on the current framework.
I agree! Since it's also a lot of work to remove the typing information again, I would say we wait until the development cycle of 9.4 is started, which will resolve #30551 and thereby the other typing tickets. When the time comes, we can reevaluate to split of the pytests to a new ticket. I think this is a resonable time plan anyway, since this is my first bigger contribution to sage and I'm expecting quite some comments concerning the actual implementation, beyond pytest and typing.
Replying to @mkoeppe:
It's best to keep workarounds for your experimental setup on your branches and not to push them to tickets. We cannot merge such code and it complicates the discussions in the review. I recommend to use
git add -p
andgit cherry-pick
to make clean branches.
Thanks, but the problem does not come from my editable setup. Pytest simply doesn't import sage.all
before importing the test file, and without such an import other imports such as from sage.symbolic.expression import Expression
do not work (because they implicitly rely on a certain import order that is provided by sage.all).
The reference to #30371 was only because I cannot efficiently work on #30741 without recompiling cython files for which I need #30371.
Replying to @tobiasdiez:
the problem does not come from my editable setup. Pytest simply doesn't import
sage.all
before importing the test file, and without such an import other imports such asfrom sage.symbolic.expression import Expression
do not work (because they implicitly rely on a certain import order that is provided by sage.all).
Thanks for the clarification. Would it be enough to do the import in the src/conftest.py
file added by #31003?
Replying to @mkoeppe:
Thanks for the clarification. Would it be enough to do the import in the
src/conftest.py
file added by #31003?
Sadly not. The fixture in conftest.py
does load sage.all
, but this is only used when the test are run and not on test discovery. Hence, this only prevents these problems on runtime, but not if the import of the test module already fails. Anyway, for the modularization effort is still desired that one can import and use any sage module without using sage.all
before.
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
66c2987 | build/pkgs/{sage_sws2rst,sage_docbuild}/install-requires.txt: New |
7f8ec6c | build/pkgs/sagelib/src/tox.ini: Add factor sitepackages |
0283da5 | build/make/Makefile.in: Add wheel, setuptools_wheel to PYTHON_TOOLCHAIN to make sure that PEP 517 packages have a complete build system |
f720722 | build/pkgs/sagelib/src/tox.ini: Add factor nobuildisolation |
c451b31 | src/setup.cfg.m4 (install_requires): Add sage_conf |
6700223 | Merge tag '9.3.rc0' into t/30913/sagelib__add_setup_cfg__install_requires_ |
04da2c6 | build/pkgs/ipywidgets: Patch out declaring install-requires of nbformat and jupyterlab-widgets |
815c944 | Merge #30913 |
b06731c | Remove Python 3.6 support from metadata and documentation |
2087571 | Add symplectic structures (Trac 30362 squashed) |
Rebased (squashed) on top of updated #30551
Changed dependencies from #31003, #30551 to #30551
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
14619d1 | Add symplectic structures (Trac 30362 squashed) |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
daf5af8 | Add symplectic structures (Trac 30362 squashed) |
Rebased, no longer on top of #30551
Changed dependencies from #30551 to none
Thanks! From my side this is also ready for review!
The ticket still has to depend on #30551, just testing it you don't need the branch to be on top of it.
Dependencies: #30551
There are a lot of doctests missing. For example symplectic_form
and poisson_tensor
in differentiable/manifold.py
.
Thanks for the input. That was one point I was struggling with. The tests are there, just in a different file (e.g. differentiable/poisson_tensor.py) and the methods in manifold.py
is just a convenient helper method. So I was wondering where to add tests, without just copying them all over the place.
Well, it is not only about testing but also about documenting. Keep in mind that EXAMPLE
blocks occur in the official reference manual and therefore provide a guideline for the user how to use that method adequately aside from testing.
Having the same examples in different places in the documentation isn't necessarily a bad thing. What I usually do is to change some values, dimensions or expressions instead of blindly copy.
It is also a good idea to add a SEEALSO
block in the poisson_tensor
method linking to differentiable/poisson_tensor.py
.
Now that Sage 9.4 beta cycle has started, it would be nice to have this ticket make its way into Sage 9.4.
Setting a new milestone for this ticket based on a cursory review.
Branch pushed to git repo; I updated commit sha1. New commits:
0903929 | Final cleanup |
Please excuse that it took me so long, but I've finally found the time to cleanup the code. The tests should be complete and pass now, except for the pytests for S2 which fail because of #32953. Other than this, this is ready for review.
Changed dependencies from #30551 to #32953
Replying to @tobiasdiez:
Please excuse that it took me so long, but I've finally found the time to cleanup the code. The tests should be complete and pass now, except for the pytests for S2 which fail because of #32953. Other than this, this is ready for review.
Happy to see that symplectic structures make their way to Sage! I'll have a look in the coming days. Meanwhile, the patchbot reveals that the doctest coverage is not complete. You can check it by yourself by running sage -coverage src/sage/manifolds
.
Branch pushed to git repo; I updated commit sha1. New commits:
16a08af | Add and fix doctests |
Thanks, I've overlooked that some doctests were missing. Now everything should be in order, except for a few 'false-positves' related to the usage of pytest. For this, I've opened #32975.
Changed dependencies from #32953 to #32953, #32975
Branch pushed to git repo; I updated commit sha1. New commits:
fbc1af8 | Fix S2 tests |
This ticket implements the basics of symplectic structures, like Poisson brackets and Hamiltonian vector fields.
TODO (as follow-up tickets):
EuclideanSpace
to new classVectorSpace
, and letSymplecticVectorSpace
derive fromVectorSpace
CC: @tscrim @nthiery @mjungmath @egourgoulhon @mkoeppe
Component: manifolds
Author: Tobias Diez
Branch:
b78d8a2
Reviewer: Eric Gourgoulhon, Michael Jung, Matthias Koeppe, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/30362