diff --git a/.gitignore b/.gitignore index 40d3cb9db..982941071 100644 --- a/.gitignore +++ b/.gitignore @@ -152,3 +152,4 @@ tmp.tex tests/out.pdf .vscode/* +tmp-* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0198e5076..37bdb0a32 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,9 +17,3 @@ repos: hooks: - id: isort args: ["--profile", "black"] - - - repo: https://github.com/asottile/pyupgrade - rev: v1.25.0 - hooks: - - id: pyupgrade - args: [--py36-plus] diff --git a/debug/feynman.ipynb b/debug/feynman.ipynb index 5f9db6bd6..91ed61beb 100644 --- a/debug/feynman.ipynb +++ b/debug/feynman.ipynb @@ -121,7 +121,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.3" + "version": "3.11.4" } }, "nbformat": 4, diff --git a/debug/feynmp.ipynb b/debug/feynmp.ipynb index a80a8015a..173069fe6 100644 --- a/debug/feynmp.ipynb +++ b/debug/feynmp.ipynb @@ -170,7 +170,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.3" + "version": "3.11.4" } }, "nbformat": 4, diff --git a/docs/source/gallery/overleaf/overleaf.ipynb b/docs/source/gallery/overleaf/overleaf.ipynb index dccc1eebf..fe6358780 100644 --- a/docs/source/gallery/overleaf/overleaf.ipynb +++ b/docs/source/gallery/overleaf/overleaf.ipynb @@ -769,7 +769,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.11.4" } }, "nbformat": 4, diff --git a/docs/source/gallery/pyfeyn/pyfeyn.ipynb b/docs/source/gallery/pyfeyn/pyfeyn.ipynb index cfa5e5753..38d3f9e3b 100644 --- a/docs/source/gallery/pyfeyn/pyfeyn.ipynb +++ b/docs/source/gallery/pyfeyn/pyfeyn.ipynb @@ -507,7 +507,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.11.4" } }, "nbformat": 4, diff --git a/docs/source/renderers/latex/tikz/tikzfeynman.ipynb b/docs/source/renderers/latex/tikz/tikzfeynman.ipynb index 7e05ae4fb..72f180fc3 100644 --- a/docs/source/renderers/latex/tikz/tikzfeynman.ipynb +++ b/docs/source/renderers/latex/tikz/tikzfeynman.ipynb @@ -517,7 +517,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.3" + "version": "3.11.4" } }, "nbformat": 4, diff --git a/poetry.lock b/poetry.lock index f097e1657..ef1405ecb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1114,13 +1114,13 @@ numpy = ">=1.6" [[package]] name = "feynml" -version = "0.2.11" +version = "0.2.12" description = "Feynman diagram markup language" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "feynml-0.2.11-py3-none-any.whl", hash = "sha256:cd45cf69501b30916481d4fe721d28bc85c9ba0ef08c9798f921d9010cf66d51"}, - {file = "feynml-0.2.11.tar.gz", hash = "sha256:2799c771ceaebe2329072ecc421e4d026aad9436f7dde36fb6434aea5fea8b0e"}, + {file = "feynml-0.2.12-py3-none-any.whl", hash = "sha256:d334e6b5ab6d0c4a252cb95adbb801782cb907df72a0719dc9ee6ed49c0c15af"}, + {file = "feynml-0.2.12.tar.gz", hash = "sha256:5a906635f2c3b2c12543667ce6ce76542af62fd9d31c5ce887546d6c80408a75"}, ] [package.dependencies] @@ -3363,13 +3363,13 @@ test = ["pydocstyle", "pytest (>=6.0,<7.0)", "pytest-cov (>=2.5.1)", "scikit-hep [[package]] name = "pyparsing" -version = "3.1.0" +version = "3.1.1" description = "pyparsing module - Classes and methods to define and execute parsing grammars" optional = false python-versions = ">=3.6.8" files = [ - {file = "pyparsing-3.1.0-py3-none-any.whl", hash = "sha256:d554a96d1a7d3ddaf7183104485bc19fd80543ad6ac5bdb6426719d766fb06c1"}, - {file = "pyparsing-3.1.0.tar.gz", hash = "sha256:edb662d6fe322d6e990b1594b5feaeadf806803359e3d4d42f11e295e588f0ea"}, + {file = "pyparsing-3.1.1-py3-none-any.whl", hash = "sha256:32c7c0b711493c72ff18a981d24f28aaf9c1fb7ed5e9667c9e84e3db623bdbfb"}, + {file = "pyparsing-3.1.1.tar.gz", hash = "sha256:ede28a1a32462f5a9705e07aea48001a08f7cf81a021585011deba701581a0db"}, ] [package.extras] @@ -4998,4 +4998,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "319d2e9991c9c1ddc054fbede4ac77a39f4dd4ba8d85f1870c40fd20b9b639e4" +content-hash = "1a30713f9df9e5efa639debaa7b57c0023563dcce758aaa10df528394e7ecff8" diff --git a/pyfeyn2/render/latex/tikzfeynman.py b/pyfeyn2/render/latex/tikzfeynman.py index f60fdf16c..15405add4 100644 --- a/pyfeyn2/render/latex/tikzfeynman.py +++ b/pyfeyn2/render/latex/tikzfeynman.py @@ -2,10 +2,13 @@ from typing import List from warnings import warn +from feynml.connector import Connector +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.vertex import Vertex from pylatex import Command from pylatex.utils import NoEscape -from pyfeyn2.feynmandiagram import Connector, FeynmanDiagram, Leg, Vertex from pyfeyn2.render.latex.latex import LatexRender # converte FeynmanDiagram to tikz-feynman diff --git a/pyfeyn2/render/render.py b/pyfeyn2/render/render.py index d0caff6ee..41fa5a0c4 100644 --- a/pyfeyn2/render/render.py +++ b/pyfeyn2/render/render.py @@ -1,7 +1,10 @@ import abc from typing import List -from pyfeyn2.feynmandiagram import FeynmanDiagram, Leg, Propagator, Vertex +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.propagator import Propagator +from feynml.vertex import Vertex class Render: diff --git a/pyfeyn2/render/text/ascii.py b/pyfeyn2/render/text/ascii.py index 538aa7b82..d5153bdde 100644 --- a/pyfeyn2/render/text/ascii.py +++ b/pyfeyn2/render/text/ascii.py @@ -1,7 +1,8 @@ from typing import List from warnings import warn -from pyfeyn2.feynmandiagram import Point +from feynml.point import Point + from pyfeyn2.render.render import Render from pyfeyn2.render.text.label import Label from pyfeyn2.render.text.line import ASCIILine diff --git a/pyproject.toml b/pyproject.toml index 6d1cbeafa..3bfb20c3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ mkfeyndiag = "pyfeyn2.mkfeyndiag:main" optional = true [tool.poetry.group.docs.dependencies] -sphinx = "*" +sphinx = "<7.0.0" sphinx-rtd-theme = "*" sphinxcontrib-napoleon = "*" nbsphinx = "*" diff --git a/pytest.ini b/pytest.ini index 249c095ae..483b0fba1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,3 @@ [pytest] minversion = 6.0 -addopts = -v --cov=pyfeyn2 --cov-config=.coveragerc --cov-append --cov-report=term --cov-report=xml --doctest-modules --ignore=docs/source/conf.py -pytest_plugins = ['pytest_profiling'] +addopts = -Werror -v --cov=pyfeyn2 --cov-config=.coveragerc --cov-append --cov-report=term --cov-report=xml --doctest-modules --ignore=docs/source/conf.py diff --git a/tests/test_all.py b/tests/test_all.py index 76ce78963..0803546c1 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -1,6 +1,9 @@ +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.propagator import Propagator +from feynml.vertex import Vertex from matplotlib import pyplot as plt -from pyfeyn2.feynmandiagram import FeynmanDiagram, Leg, Propagator, Vertex from pyfeyn2.render.all import AllRender diff --git a/tests/test_dot.py b/tests/test_dot.py index 3058d5998..40c73dab6 100644 --- a/tests/test_dot.py +++ b/tests/test_dot.py @@ -1,9 +1,9 @@ from pyfeyn2.render.latex.dot import DotRender, feynman_to_dot -from tests.test_feynman import test_gluons, test_many_gluons +from tests.test_feynman import get_test_gluons, get_test_many_gluons def test_dot(): - fd = test_gluons() + fd = get_test_gluons() print(feynman_to_dot(fd)) dr = DotRender(fd) @@ -12,7 +12,7 @@ def test_dot(): def test_dot2(): - fd = test_many_gluons() + fd = get_test_many_gluons() print(feynman_to_dot(fd)) dr = DotRender(fd) diff --git a/tests/test_feynman.py b/tests/test_feynman.py index 410f2465c..602640951 100644 --- a/tests/test_feynman.py +++ b/tests/test_feynman.py @@ -1,7 +1,10 @@ -from pyfeyn2.feynmandiagram import FeynmanDiagram, Leg, Propagator, Vertex +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.propagator import Propagator +from feynml.vertex import Vertex -def test_gluons(): +def get_test_gluons(): fd = FeynmanDiagram() v1 = Vertex("v1").with_xy(-1, 0) v2 = Vertex("v2").with_xy(1, 0) @@ -18,7 +21,7 @@ def test_gluons(): return fd -def test_many_gluons(): +def get_test_many_gluons(): fd = FeynmanDiagram() v1 = Vertex("v1") v2 = Vertex("v2") diff --git a/tests/test_fml.py b/tests/test_fml.py index 4e48cfb4e..6c6029ead 100644 --- a/tests/test_fml.py +++ b/tests/test_fml.py @@ -1,21 +1,19 @@ from pathlib import Path +# Load an FML file and check that it is the same as the original +# FeynmanDiagram object +from feynml.feynmandiagram import FeynmanDiagram +from feynml.feynml import FeynML +from feynml.head import Head +from feynml.leg import Leg +from feynml.meta import Meta +from feynml.momentum import Momentum +from feynml.propagator import Propagator +from feynml.vertex import Vertex from xsdata.formats.dataclass.parsers import XmlParser from xsdata.formats.dataclass.serializers import XmlSerializer from xsdata.formats.dataclass.serializers.config import SerializerConfig -# Load an FML file and check that it is the same as the original -# FeynmanDiagram object -from pyfeyn2.feynmandiagram import ( - FeynmanDiagram, - FeynML, - Head, - Leg, - Meta, - Momentum, - Propagator, - Vertex, -) from pyfeyn2.render.pyx.pyxrender import PyxRender diff --git a/tests/test_renders.py b/tests/test_renders.py index 216b689ee..0149c5299 100644 --- a/tests/test_renders.py +++ b/tests/test_renders.py @@ -1,6 +1,9 @@ import pytest +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.propagator import Propagator +from feynml.vertex import Vertex -from pyfeyn2.feynmandiagram import FeynmanDiagram, Leg, Propagator, Vertex from pyfeyn2.render.all import AllRender, renders diff --git a/tests/test_text.py b/tests/test_text.py index 69f4ccbd8..cedc69d58 100644 --- a/tests/test_text.py +++ b/tests/test_text.py @@ -1,11 +1,11 @@ from pyfeyn2.auto.position import feynman_adjust_points from pyfeyn2.render.text.ascii import ASCIIRender from pyfeyn2.render.text.unicode import UnicodeRender -from tests.test_feynman import test_many_gluons +from tests.test_feynman import get_test_many_gluons def test_ascii(): - fd = test_many_gluons() + fd = get_test_many_gluons() fd = feynman_adjust_points(fd, clear_vertices=True) tfd = ASCIIRender(fd) @@ -14,7 +14,7 @@ def test_ascii(): def test_unicode(): - fd = test_many_gluons() + fd = get_test_many_gluons() fd = feynman_adjust_points(fd, clear_vertices=True) tfd = UnicodeRender(fd) diff --git a/tests/test_tikz.py b/tests/test_tikz.py index 4f78888af..2b39c2364 100644 --- a/tests/test_tikz.py +++ b/tests/test_tikz.py @@ -1,10 +1,10 @@ from pyfeyn2.auto.position import feynman_adjust_points from pyfeyn2.render.latex.tikzfeynman import TikzFeynmanRender -from tests.test_feynman import test_gluons, test_many_gluons +from tests.test_feynman import get_test_gluons, get_test_many_gluons def test_tikz(): - fd = test_gluons() + fd = get_test_gluons() tfd = TikzFeynmanRender(fd) print(tfd.get_src()) @@ -12,7 +12,7 @@ def test_tikz(): def test_dot_positions(): - fd = test_many_gluons() + fd = get_test_many_gluons() fd = feynman_adjust_points(fd, clear_vertices=True) tfd = TikzFeynmanRender(fd) diff --git a/tests/test_xml.py b/tests/test_xml.py index e46f36de5..29115a476 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -1,11 +1,13 @@ from pathlib import Path +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.propagator import Propagator +from feynml.vertex import Vertex from xsdata.formats.dataclass.parsers import XmlParser from xsdata.formats.dataclass.serializers import XmlSerializer from xsdata.formats.dataclass.serializers.config import SerializerConfig -from pyfeyn2.feynmandiagram import FeynmanDiagram, Leg, Propagator, Vertex - def test_print_as_xml(): fd = FeynmanDiagram()