diff --git a/poetry.lock b/poetry.lock index 3707366..6c22aad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -37,7 +37,6 @@ files = [ ] [package.dependencies] -exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} @@ -65,7 +64,7 @@ version = "3.0.0" description = "Annotate AST trees with source code positions" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["dev"] files = [ {file = "asttokens-3.0.0-py3-none-any.whl", hash = "sha256:e3078351a059199dd5138cb1c706e6430c05eff2ff136af5eb4790f9d28932e2"}, {file = "asttokens-3.0.0.tar.gz", hash = "sha256:0dcd8baa8d62b0c1d118b399b2ddba3c4aff271d0d7a9e0d4c1681c79035bbc7"}, @@ -159,14 +158,14 @@ files = [ [[package]] name = "click" -version = "8.2.0" +version = "8.1.8" description = "Composable command line interface toolkit" optional = false -python-versions = ">=3.10" +python-versions = ">=3.7" groups = ["main", "dev"] files = [ - {file = "click-8.2.0-py3-none-any.whl", hash = "sha256:6b303f0b2aa85f1cb4e5303078fadcbcd4e476f114fab9b5007005711839325c"}, - {file = "click-8.2.0.tar.gz", hash = "sha256:f5452aeddd9988eefa20f90f05ab66f17fce1ee2a36907fd30b05bbb5953814d"}, + {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, + {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, ] [package.dependencies] @@ -367,9 +366,6 @@ files = [ {file = "coverage-7.8.0.tar.gz", hash = "sha256:7a3d62b3b03b4b6fd41a085f3574874cf946cb4604d2b4d3e8dca8cd570ca501"}, ] -[package.dependencies] -tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} - [package.extras] toml = ["tomli ; python_full_version <= \"3.11.0a6\""] @@ -395,7 +391,7 @@ version = "5.2.1" description = "Decorators for Humans" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["dev"] files = [ {file = "decorator-5.2.1-py3-none-any.whl", hash = "sha256:d316bb415a2d9e2d2b3abcc4084c6502fc09240e292cd76a76afc106a1c8e04a"}, {file = "decorator-5.2.1.tar.gz", hash = "sha256:65f266143752f734b0a7cc83c46f4618af75b8c5911b00ccb61d0ac9b6da0360"}, @@ -448,7 +444,6 @@ click = ">=8.0.0,<9" colorama = {version = ">=0.4.6", markers = "sys_platform == \"win32\""} packaging = ">=23.2" requirements-parser = ">=0.11.0,<1" -tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} [[package]] name = "diskcache" @@ -474,32 +469,13 @@ files = [ {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, ] -[[package]] -name = "exceptiongroup" -version = "1.3.0" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -groups = ["main", "dev"] -markers = "python_version == \"3.10\"" -files = [ - {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, - {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, -] - -[package.dependencies] -typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} - -[package.extras] -test = ["pytest (>=6)"] - [[package]] name = "executing" version = "2.2.0" description = "Get the currently executing AST node of a frame, and other information" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["dev"] files = [ {file = "executing-2.2.0-py2.py3-none-any.whl", hash = "sha256:11387150cad388d62750327a53d3339fad4888b39a6fe233c3afbb54ecffd3aa"}, {file = "executing-2.2.0.tar.gz", hash = "sha256:5d108c028108fe2551d1a7b2e8b713341e2cb4fc0aa7dcf966fa4327a5226755"}, @@ -825,54 +801,13 @@ files = [ {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] -[[package]] -name = "ipython" -version = "8.36.0" -description = "IPython: Productive Interactive Computing" -optional = false -python-versions = ">=3.10" -groups = ["main"] -markers = "python_version == \"3.10\"" -files = [ - {file = "ipython-8.36.0-py3-none-any.whl", hash = "sha256:12b913914d010dcffa2711505ec8be4bf0180742d97f1e5175e51f22086428c1"}, - {file = "ipython-8.36.0.tar.gz", hash = "sha256:24658e9fe5c5c819455043235ba59cfffded4a35936eefceceab6b192f7092ff"}, -] - -[package.dependencies] -colorama = {version = "*", markers = "sys_platform == \"win32\""} -decorator = "*" -exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} -jedi = ">=0.16" -matplotlib-inline = "*" -pexpect = {version = ">4.3", markers = "sys_platform != \"win32\" and sys_platform != \"emscripten\""} -prompt_toolkit = ">=3.0.41,<3.1.0" -pygments = ">=2.4.0" -stack_data = "*" -traitlets = ">=5.13.0" -typing_extensions = {version = ">=4.6", markers = "python_version < \"3.12\""} - -[package.extras] -all = ["ipython[black,doc,kernel,matplotlib,nbconvert,nbformat,notebook,parallel,qtconsole]", "ipython[test,test-extra]"] -black = ["black"] -doc = ["docrepr", "exceptiongroup", "intersphinx_registry", "ipykernel", "ipython[test]", "matplotlib", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "sphinxcontrib-jquery", "tomli ; python_version < \"3.11\"", "typing_extensions"] -kernel = ["ipykernel"] -matplotlib = ["matplotlib"] -nbconvert = ["nbconvert"] -nbformat = ["nbformat"] -notebook = ["ipywidgets", "notebook"] -parallel = ["ipyparallel"] -qtconsole = ["qtconsole"] -test = ["packaging", "pickleshare", "pytest", "pytest-asyncio (<0.22)", "testpath"] -test-extra = ["curio", "ipython[test]", "jupyter_ai", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.23)", "pandas", "trio"] - [[package]] name = "ipython" version = "9.2.0" description = "IPython: Productive Interactive Computing" optional = false python-versions = ">=3.11" -groups = ["main"] -markers = "python_version >= \"3.11\"" +groups = ["dev"] files = [ {file = "ipython-9.2.0-py3-none-any.whl", hash = "sha256:fef5e33c4a1ae0759e0bba5917c9db4eb8c53fee917b6a526bd973e1ca5159f6"}, {file = "ipython-9.2.0.tar.gz", hash = "sha256:62a9373dbc12f28f9feaf4700d052195bf89806279fc8ca11f3f54017d04751b"}, @@ -905,8 +840,7 @@ version = "1.1.1" description = "Defines a variety of Pygments lexers for highlighting IPython code." optional = false python-versions = ">=3.8" -groups = ["main"] -markers = "python_version >= \"3.11\"" +groups = ["dev"] files = [ {file = "ipython_pygments_lexers-1.1.1-py3-none-any.whl", hash = "sha256:a9462224a505ade19a605f71f8fa63c2048833ce50abc86768a0d81d876dc81c"}, {file = "ipython_pygments_lexers-1.1.1.tar.gz", hash = "sha256:09c0138009e56b6854f9535736f4171d855c8c08a563a0dcd8022f78355c7e81"}, @@ -921,7 +855,7 @@ version = "0.19.2" description = "An autocompletion tool for Python that can be used for text editors." optional = false python-versions = ">=3.6" -groups = ["main"] +groups = ["dev"] files = [ {file = "jedi-0.19.2-py2.py3-none-any.whl", hash = "sha256:a8ef22bde8490f57fe5c7681a3c83cb58874daf72b4784de3cce5b6ef6edb5b9"}, {file = "jedi-0.19.2.tar.gz", hash = "sha256:4770dc3de41bde3966b02eb84fbcf557fb33cce26ad23da12c742fb50ecb11f0"}, @@ -1114,7 +1048,7 @@ version = "0.1.7" description = "Inline Matplotlib backend for Jupyter" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["dev"] files = [ {file = "matplotlib_inline-0.1.7-py3-none-any.whl", hash = "sha256:df192d39a4ff8f21b1895d72e6a13f5fcc5099f00fa84384e0ea28c2cc0653ca"}, {file = "matplotlib_inline-0.1.7.tar.gz", hash = "sha256:8423b23ec666be3d16e16b60bdd8ac4e86e840ebd1dd11a30b9f117f2fa0ab90"}, @@ -1197,7 +1131,6 @@ files = [ [package.dependencies] mypy_extensions = ">=1.0.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typing_extensions = ">=4.6.0" [package.extras] @@ -1463,7 +1396,6 @@ files = [ [package.dependencies] numpy = [ - {version = ">=1.22.4", markers = "python_version < \"3.11\""}, {version = ">=1.23.2", markers = "python_version == \"3.11\""}, {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, ] @@ -1517,7 +1449,7 @@ version = "0.8.4" description = "A Python Parser" optional = false python-versions = ">=3.6" -groups = ["main"] +groups = ["dev"] files = [ {file = "parso-0.8.4-py2.py3-none-any.whl", hash = "sha256:a418670a20291dacd2dddc80c377c5c3791378ee1e8d12bffc35420643d43f18"}, {file = "parso-0.8.4.tar.gz", hash = "sha256:eb3a7b58240fb99099a345571deecc0f9540ea5f4dd2fe14c2a99d6b281ab92d"}, @@ -1533,7 +1465,7 @@ version = "4.9.0" description = "Pexpect allows easy control of interactive console applications." optional = false python-versions = "*" -groups = ["main"] +groups = ["dev"] markers = "sys_platform != \"win32\" and sys_platform != \"emscripten\"" files = [ {file = "pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523"}, @@ -1692,19 +1624,19 @@ type = ["mypy (>=1.14.1)"] [[package]] name = "pluggy" -version = "1.5.0" +version = "1.6.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" groups = ["main", "dev"] files = [ - {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, - {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, + {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, + {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, ] [package.extras] dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] +testing = ["coverage", "pytest", "pytest-benchmark"] [[package]] name = "pre-commit" @@ -1768,7 +1700,7 @@ version = "3.0.51" description = "Library for building powerful interactive command lines in Python" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["dev"] files = [ {file = "prompt_toolkit-3.0.51-py3-none-any.whl", hash = "sha256:52742911fde84e2d423e2f9a4cf1de7d7ac4e51958f648d9540e0fb8db077b07"}, {file = "prompt_toolkit-3.0.51.tar.gz", hash = "sha256:931a162e3b27fc90c86f1b48bb1fb2c528c2761475e57c9c06de13311c7b54ed"}, @@ -1783,7 +1715,7 @@ version = "0.7.0" description = "Run a subprocess in a pseudo terminal" optional = false python-versions = "*" -groups = ["main"] +groups = ["dev"] markers = "sys_platform != \"win32\" and sys_platform != \"emscripten\"" files = [ {file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"}, @@ -1796,7 +1728,7 @@ version = "0.2.3" description = "Safely evaluate AST nodes without side effects" optional = false python-versions = "*" -groups = ["main"] +groups = ["dev"] files = [ {file = "pure_eval-0.2.3-py3-none-any.whl", hash = "sha256:1db8e35b67b3d218d818ae653e27f06c3aa420901fa7b081ca98cbedc874e0d0"}, {file = "pure_eval-0.2.3.tar.gz", hash = "sha256:5f4e983f40564c576c7c8635ae88db5956bb2229d7e9237d03b3c0b0190eaf42"}, @@ -1945,7 +1877,7 @@ version = "2.19.1" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["main", "dev"] files = [ {file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"}, {file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"}, @@ -1983,7 +1915,6 @@ files = [ [package.dependencies] packaging = ">=25" -tomli = {version = ">=2.2.1", markers = "python_version < \"3.11\""} [package.extras] docs = ["furo (>=2024.8.6)", "sphinx-autodoc-typehints (>=3.2)"] @@ -2003,11 +1934,9 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] @@ -2292,7 +2221,6 @@ files = [ [package.dependencies] markdown-it-py = ">=2.2.0" pygments = ">=2.13.0,<3.0.0" -typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.11\""} [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] @@ -2434,14 +2362,14 @@ test = ["Cython", "array-api-strict (>=2.0,<2.1.1)", "asv", "gmpy2", "hypothesis [[package]] name = "setuptools" -version = "80.4.0" +version = "80.7.1" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.9" groups = ["dev"] files = [ - {file = "setuptools-80.4.0-py3-none-any.whl", hash = "sha256:6cdc8cb9a7d590b237dbe4493614a9b75d0559b888047c1f67d49ba50fc3edb2"}, - {file = "setuptools-80.4.0.tar.gz", hash = "sha256:5a78f61820bc088c8e4add52932ae6b8cf423da2aff268c23f813cfbb13b4006"}, + {file = "setuptools-80.7.1-py3-none-any.whl", hash = "sha256:ca5cc1069b85dc23070a6628e6bcecb3292acac802399c7f8edc0100619f9009"}, + {file = "setuptools-80.7.1.tar.gz", hash = "sha256:f6ffc5f0142b1bd8d0ca94ee91b30c0ca862ffd50826da1ea85258a06fd94552"}, ] [package.extras] @@ -2520,7 +2448,7 @@ version = "0.6.3" description = "Extract data from python stack frames and tracebacks for informative displays" optional = false python-versions = "*" -groups = ["main"] +groups = ["dev"] files = [ {file = "stack_data-0.6.3-py3-none-any.whl", hash = "sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695"}, {file = "stack_data-0.6.3.tar.gz", hash = "sha256:836a778de4fec4dcd1dcd89ed8abff8a221f58308462e1c4aa2a3cf30148f0b9"}, @@ -2620,49 +2548,6 @@ files = [ [package.extras] tests = ["pytest", "pytest-cov"] -[[package]] -name = "tomli" -version = "2.2.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.8" -groups = ["main", "dev"] -markers = "python_version == \"3.10\"" -files = [ - {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, - {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, - {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, - {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, - {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, - {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, - {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, - {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, - {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, - {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, - {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, - {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, - {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, - {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, - {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, - {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, - {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, - {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, -] - [[package]] name = "tox" version = "4.26.0" @@ -2684,8 +2569,6 @@ packaging = ">=24.2" platformdirs = ">=4.3.6" pluggy = ">=1.5" pyproject-api = ">=1.8" -tomli = {version = ">=2.2.1", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=4.12.2", markers = "python_version < \"3.11\""} virtualenv = ">=20.31" [package.extras] @@ -2697,7 +2580,7 @@ version = "5.14.3" description = "Traitlets Python configuration system" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["dev"] files = [ {file = "traitlets-5.14.3-py3-none-any.whl", hash = "sha256:b74e89e397b1ed28cc831db7aea759ba6640cb3de13090ca145426688ff1ac4f"}, {file = "traitlets-5.14.3.tar.gz", hash = "sha256:9ed0579d3502c94b4b3732ac120375cda96f923114522847de4b3bb98b96b6b7"}, @@ -2709,18 +2592,18 @@ test = ["argcomplete (>=3.0.3)", "mypy (>=1.7.0)", "pre-commit", "pytest (>=7.0, [[package]] name = "typer" -version = "0.15.3" +version = "0.15.4" description = "Typer, build great CLIs. Easy to code. Based on Python type hints." optional = false python-versions = ">=3.7" groups = ["main"] files = [ - {file = "typer-0.15.3-py3-none-any.whl", hash = "sha256:c86a65ad77ca531f03de08d1b9cb67cd09ad02ddddf4b34745b5008f43b239bd"}, - {file = "typer-0.15.3.tar.gz", hash = "sha256:818873625d0569653438316567861899f7e9972f2e6e0c16dab608345ced713c"}, + {file = "typer-0.15.4-py3-none-any.whl", hash = "sha256:eb0651654dcdea706780c466cf06d8f174405a659ffff8f163cfbfee98c0e173"}, + {file = "typer-0.15.4.tar.gz", hash = "sha256:89507b104f9b6a0730354f27c39fae5b63ccd0c95b1ce1f1a6ba0cfd329997c3"}, ] [package.dependencies] -click = ">=8.0.0" +click = ">=8.0.0,<8.2" rich = ">=10.11.0" shellingham = ">=1.3.0" typing-extensions = ">=3.7.4.3" @@ -2800,33 +2683,13 @@ platformdirs = ">=3.9.1,<5" docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8) ; platform_python_implementation == \"PyPy\" or platform_python_implementation == \"GraalVM\" or platform_python_implementation == \"CPython\" and sys_platform == \"win32\" and python_version >= \"3.13\"", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10) ; platform_python_implementation == \"CPython\""] -[[package]] -name = "vivarium-interface" -version = "0.0.5" -description = "" -optional = false -python-versions = ">=3.6" -groups = ["main"] -files = [ - {file = "vivarium-interface-0.0.5.tar.gz", hash = "sha256:4385710751051f8068d02715b4daaa2abd8967a713d08648bf65b48a38c8003b"}, -] - -[package.dependencies] -bigraph-viz = "*" -graphviz = "*" -imageio = "*" -IPython = "*" -matplotlib = "*" -pandas = "*" -process-bigraph = "*" - [[package]] name = "wcwidth" version = "0.2.13" description = "Measures the displayed width of unicode strings in a terminal" optional = false python-versions = "*" -groups = ["main"] +groups = ["dev"] files = [ {file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"}, {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"}, @@ -2834,5 +2697,5 @@ files = [ [metadata] lock-version = "2.1" -python-versions = ">=3.10, <4.0" -content-hash = "a161c6afaa1d234bcd33a1aabb0a8be7a143a6814c08328f4648095977cebd8d" +python-versions = ">=3.11, <4.0" +content-hash = "169a95ebf7cbe15107bdc43704a2e7e3578d6f52e93f4b5e0a32f43bbe786726" diff --git a/pyproject.toml b/pyproject.toml index 2928f88..270ccc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ authors = [ ] license = {text = "MIT"} readme = "README.md" -requires-python = ">=3.10, <4.0" +requires-python = ">=3.11, <4.0" packages = [ {include = "simple_process_bigraph_runtime"}, {include = "tests"} @@ -15,10 +15,9 @@ packages = [ dependencies = [ "process-bigraph (>=0.0.35, <1.0)", "typer (>=0.15.3, <1.0)", -# "process-bigraph-lang @ git+https://github.com/biosimulations/process-bigraph-lang.git#bind-to-object", - "process-bigraph-lang @ ../process-bigraph-lang", - "spatio-flux @ git+https://github.com/vivarium-collective/spatio-flux.git", - "vivarium-interface (>=0.0.5,<0.0.6)" + "process-bigraph-lang @ git+https://github.com/biosimulations/process-bigraph-lang.git#bind-to-object", +# "process-bigraph-lang @ ../process-bigraph-lang", + "spatio-flux @ git+https://github.com/vivarium-collective/spatio-flux.git" ] [tool.poetry] @@ -30,6 +29,7 @@ deptry = "^0.23.0" mypy = "^1.15.0" pre-commit = "^4.2.0" tox = "^4.25.0" +ipython = "^9.2.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/src/simple_process_bigraph_runtime/main.py b/src/simple_process_bigraph_runtime/main.py index 5b1d672..8c7766c 100644 --- a/src/simple_process_bigraph_runtime/main.py +++ b/src/simple_process_bigraph_runtime/main.py @@ -7,7 +7,6 @@ from process_bigraph import Composite, ProcessTypes # type: ignore[import-untyped] from process_bigraph_lang.dsl.model import Model from typing_extensions import Annotated -from vivarium import Vivarium # type: ignore[import-untyped] import simple_process_bigraph_runtime.registry.spatio_flux_library as spatioflux import simple_process_bigraph_runtime.registry.toy_library as toy @@ -54,8 +53,6 @@ def playground(): pass def generatePythonModel(pblang_path: os.PathLike[str]) -> Model: - absolute_path: str = validate_pb_absolute_path(os.path.abspath(pblang_path)) - return dsl_adapter.generateModelAst(pblang_path) def validate_pb_absolute_path(absolute_path: str) -> str: diff --git a/src/simple_process_bigraph_runtime/registry/spatio_flux_library.py b/src/simple_process_bigraph_runtime/registry/spatio_flux_library.py index 5a67179..5ef42bf 100644 --- a/src/simple_process_bigraph_runtime/registry/spatio_flux_library.py +++ b/src/simple_process_bigraph_runtime/registry/spatio_flux_library.py @@ -1,6 +1,5 @@ from bigraph_schema import default # type: ignore[import-untyped] from spatio_flux import processes # type: ignore[import-untyped] -from vivarium import Vivarium # type: ignore[import-untyped] from simple_process_bigraph_runtime.environment.process_bigraph_env import ProcessBigraphEnv diff --git a/src/simple_process_bigraph_runtime/registry/toy_library.py b/src/simple_process_bigraph_runtime/registry/toy_library.py index 411e892..3482c96 100644 --- a/src/simple_process_bigraph_runtime/registry/toy_library.py +++ b/src/simple_process_bigraph_runtime/registry/toy_library.py @@ -3,7 +3,6 @@ from process_bigraph import Process, Step # type: ignore[import-untyped] from process_bigraph.composite import SyncUpdate # type: ignore[import-untyped] -from vivarium import Vivarium # type: ignore[import-untyped] from simple_process_bigraph_runtime.environment.process_bigraph_env import ProcessBigraphEnv diff --git a/tests/conftest.py b/tests/conftest.py index 48e28fd..6b46f57 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ from tests.fixtures.model_fixtures import ( # noqa: F401 - model_path_abc, + model_paths_abc_steps, + model_paths_abc_processes, ) \ No newline at end of file diff --git a/tests/fixtures/data/abc.json b/tests/fixtures/data/abc.json deleted file mode 100644 index 4d8451c..0000000 --- a/tests/fixtures/data/abc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "composition": { - "MyProcess": "process[glucose:float,glucose:float]", - "cell": { - "glucose" : "float", - "calcium" : "float" - } - }, - "interface": { }, - "bridge": { }, - "state": { - "MyProcess": { - "address": "local:!processes.MyProcess", - "config": { - "calcium_growth": 0.1, - "glucose_growth": 0.1, - "dt" : "0.1", - "alpha": "0.1" - }, - "interval": 1.0, - "inputs": {"glucose": ["cell", "glucose"]}, - "outputs": {"calcium": ["cell", "calcium"]} - }, - "cell": { - "glucose" : "3.0", - "calcium" : "0.0" - } - } -} - - diff --git a/tests/fixtures/data/abc.store b/tests/fixtures/data/abc.store deleted file mode 100644 index d37265d..0000000 --- a/tests/fixtures/data/abc.store +++ /dev/null @@ -1,17 +0,0 @@ -import math - -def MyProcess_update_glucose(glucose: float, - glucose_growth: float, dt: float): - my_update(glucose, glucose_growth, dt) - -def MyProcess_update_calcium(calcium: float, calcium_growth: float, - alpha: float, dt: float): - calcium * (1-exp(dt)) + alpha * calcium_growth * dt - -def my_update(substrate, rate, interval): - return substrate + rate * interval - -def exp(value: float): - return math.exp(value) - - diff --git a/tests/fixtures/data/abc.pblang b/tests/fixtures/data/abc_processes.pblang similarity index 100% rename from tests/fixtures/data/abc.pblang rename to tests/fixtures/data/abc_processes.pblang diff --git a/tests/fixtures/data/abc_processes.pblang.json b/tests/fixtures/data/abc_processes.pblang.json new file mode 100644 index 0000000..3ba5211 --- /dev/null +++ b/tests/fixtures/data/abc_processes.pblang.json @@ -0,0 +1,260 @@ +{ + "obj_type": "Model", + "definitions": [], + "types": [ + { + "name": "float", + "obj_type": "Type", + "builtin": "builtin", + "superType": null, + "default": null, + "update": null, + "subtypes": [] + }, + { + "name": "string", + "obj_type": "Type", + "builtin": "builtin", + "superType": null, + "default": null, + "update": null, + "subtypes": [] + } + ], + "units": [], + "processDefs": [ + { + "name": "add_nums", + "obj_type": "ProcessDef", + "params": [], + "vars": [ + { + "name": "left_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + }, + { + "name": "right_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + }, + { + "name": "result", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + } + ], + "inputs": [ + { + "ref": "#/processDefs@0/vars@0", + "ref_text": "left_hand_addend" + }, + { + "ref": "#/processDefs@0/vars@1", + "ref_text": "right_hand_addend" + } + ], + "outputs": [ + { + "ref": "#/processDefs@0/vars@2", + "ref_text": "result" + } + ], + "updates": [], + "python_path": { + "obj_type": "PythonPath", + "path": [ + "toy", + "AddFloatsProcess" + ] + } + }, + { + "name": "print_result", + "obj_type": "ProcessDef", + "params": [ + { + "name": "output_file_path", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@1", + "ref_text": "string" + }, + "default": { + "val": "~/abc_result.txt" + }, + "unit_ref": null + } + ], + "vars": [ + { + "name": "result", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + } + ], + "inputs": [ + { + "ref": "#/processDefs@0/vars@2", + "ref_text": "result" + } + ], + "outputs": [], + "updates": [], + "python_path": { + "obj_type": "PythonPath", + "path": [ + "toy", + "SaveFloatToFileStep" + ] + } + } + ], + "store_defs": [ + { + "name": "left_hand", + "obj_type": "StoreDef", + "parent": null, + "states": [ + { + "name": "left_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": { + "val": 2.07 + }, + "unit_ref": null + } + ] + }, + { + "name": "right_hand", + "obj_type": "StoreDef", + "parent": null, + "states": [ + { + "name": "right_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": { + "val": 3.5 + }, + "unit_ref": null + } + ] + }, + { + "name": "resulting_calculation", + "obj_type": "StoreDef", + "parent": null, + "states": [ + { + "name": "result", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + } + ] + } + ], + "compositeDefs": [ + { + "name": "CellComposite", + "obj_type": "CompositeDef", + "stores": [ + { + "name": "lhs", + "obj_type": "Store", + "store_def": { + "ref": "#/store_defs@0", + "ref_text": "left_hand" + } + }, + { + "name": "rhs", + "obj_type": "Store", + "store_def": { + "ref": "#/store_defs@1", + "ref_text": "right_hand" + } + }, + { + "name": "res", + "obj_type": "Store", + "store_def": { + "ref": "#/store_defs@2", + "ref_text": "resulting_calculation" + } + } + ], + "processes": [ + { + "name": "addition", + "obj_type": "Process", + "process_def": { + "ref": "#/processDefs@0", + "ref_text": "add_nums" + }, + "stores": [ + { + "ref": "#/compositeDefs@0/stores@0", + "ref_text": "lhs" + }, + { + "ref": "#/compositeDefs@0/stores@1", + "ref_text": "rhs" + }, + { + "ref": "#/compositeDefs@0/stores@2", + "ref_text": "res" + } + ] + }, + { + "name": "printing", + "obj_type": "Process", + "process_def": { + "ref": "#/processDefs@1", + "ref_text": "print_result" + }, + "stores": [ + { + "ref": "#/compositeDefs@0/stores@2", + "ref_text": "res" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/data/abc_steps.pblang b/tests/fixtures/data/abc_steps.pblang new file mode 100644 index 0000000..eccda9b --- /dev/null +++ b/tests/fixtures/data/abc_steps.pblang @@ -0,0 +1,31 @@ +// my model +type float builtin +type string builtin + +process_def add_nums path toy.AddFloatsStep + var left_hand_addend: float + var right_hand_addend: float + var result: float + inputs left_hand_addend right_hand_addend + outputs result + +process_def print_result path toy.SaveFloatToFileStep + param output_file_path: string default "~/abc_result.txt" + var result: float + inputs result + +store_def left_hand + state_def left_hand_addend: float default 2.07 + +store_def right_hand + state_def right_hand_addend: float default 3.5 + +store_def resulting_calculation + state_def result: float + +composite_def CellComposite + store lhs: left_hand + store rhs: right_hand + store res: resulting_calculation + process addition: add_nums stores lhs rhs res + process printing: print_result stores res \ No newline at end of file diff --git a/tests/fixtures/data/abc_steps.pblang.json b/tests/fixtures/data/abc_steps.pblang.json new file mode 100644 index 0000000..0b4c13e --- /dev/null +++ b/tests/fixtures/data/abc_steps.pblang.json @@ -0,0 +1,260 @@ +{ + "obj_type": "Model", + "definitions": [], + "types": [ + { + "name": "float", + "obj_type": "Type", + "builtin": "builtin", + "superType": null, + "default": null, + "update": null, + "subtypes": [] + }, + { + "name": "string", + "obj_type": "Type", + "builtin": "builtin", + "superType": null, + "default": null, + "update": null, + "subtypes": [] + } + ], + "units": [], + "processDefs": [ + { + "name": "add_nums", + "obj_type": "ProcessDef", + "params": [], + "vars": [ + { + "name": "left_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + }, + { + "name": "right_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + }, + { + "name": "result", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + } + ], + "inputs": [ + { + "ref": "#/processDefs@0/vars@0", + "ref_text": "left_hand_addend" + }, + { + "ref": "#/processDefs@0/vars@1", + "ref_text": "right_hand_addend" + } + ], + "outputs": [ + { + "ref": "#/processDefs@0/vars@2", + "ref_text": "result" + } + ], + "updates": [], + "python_path": { + "obj_type": "PythonPath", + "path": [ + "toy", + "AddFloatsStep" + ] + } + }, + { + "name": "print_result", + "obj_type": "ProcessDef", + "params": [ + { + "name": "output_file_path", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@1", + "ref_text": "string" + }, + "default": { + "val": "~/abc_result.txt" + }, + "unit_ref": null + } + ], + "vars": [ + { + "name": "result", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + } + ], + "inputs": [ + { + "ref": "#/processDefs@0/vars@2", + "ref_text": "result" + } + ], + "outputs": [], + "updates": [], + "python_path": { + "obj_type": "PythonPath", + "path": [ + "toy", + "SaveFloatToFileStep" + ] + } + } + ], + "store_defs": [ + { + "name": "left_hand", + "obj_type": "StoreDef", + "parent": null, + "states": [ + { + "name": "left_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": { + "val": 2.07 + }, + "unit_ref": null + } + ] + }, + { + "name": "right_hand", + "obj_type": "StoreDef", + "parent": null, + "states": [ + { + "name": "right_hand_addend", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": { + "val": 3.5 + }, + "unit_ref": null + } + ] + }, + { + "name": "resulting_calculation", + "obj_type": "StoreDef", + "parent": null, + "states": [ + { + "name": "result", + "obj_type": "SchemaItem", + "type": { + "ref": "#/types@0", + "ref_text": "float" + }, + "default": null, + "unit_ref": null + } + ] + } + ], + "compositeDefs": [ + { + "name": "CellComposite", + "obj_type": "CompositeDef", + "stores": [ + { + "name": "lhs", + "obj_type": "Store", + "store_def": { + "ref": "#/store_defs@0", + "ref_text": "left_hand" + } + }, + { + "name": "rhs", + "obj_type": "Store", + "store_def": { + "ref": "#/store_defs@1", + "ref_text": "right_hand" + } + }, + { + "name": "res", + "obj_type": "Store", + "store_def": { + "ref": "#/store_defs@2", + "ref_text": "resulting_calculation" + } + } + ], + "processes": [ + { + "name": "addition", + "obj_type": "Process", + "process_def": { + "ref": "#/processDefs@0", + "ref_text": "add_nums" + }, + "stores": [ + { + "ref": "#/compositeDefs@0/stores@0", + "ref_text": "lhs" + }, + { + "ref": "#/compositeDefs@0/stores@1", + "ref_text": "rhs" + }, + { + "ref": "#/compositeDefs@0/stores@2", + "ref_text": "res" + } + ] + }, + { + "name": "printing", + "obj_type": "Process", + "process_def": { + "ref": "#/processDefs@1", + "ref_text": "print_result" + }, + "stores": [ + { + "ref": "#/compositeDefs@0/stores@2", + "ref_text": "res" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/model_fixtures.py b/tests/fixtures/model_fixtures.py index bda9302..25b35ca 100644 --- a/tests/fixtures/model_fixtures.py +++ b/tests/fixtures/model_fixtures.py @@ -3,6 +3,15 @@ import pytest @pytest.fixture -def model_path_abc() -> Path: +def model_paths_abc_steps() -> tuple[Path, Path]: """Fixture for a model file.""" - return Path(__file__).parent / "data" / "abc.pblang" + return (Path(__file__).parent / "data" / "abc_steps.pblang", + Path(__file__).parent / "data" / "abc_steps.pblang.json") + + +@pytest.fixture +def model_paths_abc_processes() -> tuple[Path, Path]: + """Fixture for a model file.""" + return (Path(__file__).parent / "data" / "abc_processes.pblang", + Path(__file__).parent / "data" / "abc_processes.pblang.json") + diff --git a/tests/test_add.py b/tests/test_add.py index 2c8ab41..ce41e2e 100644 --- a/tests/test_add.py +++ b/tests/test_add.py @@ -1,8 +1,8 @@ import tempfile from pathlib import Path -from process_bigraph_lang.dsl.model import Model, ProcessDef -from vivarium import Vivarium # type: ignore[import-untyped] +from process_bigraph_lang.antlr_dsl.generate import bind_model +from process_bigraph_lang.dsl.model import Model import simple_process_bigraph_runtime.registry.toy_library as toy from simple_process_bigraph_runtime.environment.process_bigraph_env import ProcessBigraphEnv @@ -10,22 +10,22 @@ from simple_process_bigraph_runtime.generation.process_generator import register_process_defs from simple_process_bigraph_runtime.generation.type_generator import register_types from simple_process_bigraph_runtime.generation.unit_generator import register_units -from simple_process_bigraph_runtime.main import generatePythonModel, performConversion -def test_add_with_process(model_path_abc: Path) -> None: +def test_add_with_process(model_paths_abc_processes: tuple[Path, Path]) -> None: with tempfile.TemporaryDirectory() as tmp_dirname: - # parse DSL - ast_model: Model = generatePythonModel(model_path_abc) + # read JSON from DSL in second argument of tuple + json_path = model_paths_abc_processes[1] + with open(json_path, 'r') as file: + model_json = file.read() - # specify the python path for the processes - add_num = ast_model.processDefs[0] - add_num.python_path.path = ['toy', 'AddFloatsProcess'] - print_results = ast_model.processDefs[1] - print_results.python_path.path = ['toy', 'SaveFloatToFileStep'] + ast_model: Model = Model.model_validate_json(model_json) + bind_model(ast_model) # set the output file path output_file_path = Path(tmp_dirname) / "output.txt" + print_results = ast_model.processDefs[1] + assert print_results.params[0].default is not None print_results.params[0].default.val = str(output_file_path) assembler = ProcessBigraphEnv() @@ -51,19 +51,30 @@ def test_add_with_process(model_path_abc: Path) -> None: assert contents.strip() == "55.7" -def test_add_with_step(model_path_abc: Path) -> None: +def test_add_with_step(model_paths_abc_steps: tuple[Path, Path]) -> None: with tempfile.TemporaryDirectory() as tmp_dirname: - # parse DSL - ast_model: Model = generatePythonModel(model_path_abc) + # read JSON from DSL in second argument of tuple + json_path = model_paths_abc_steps[1] + with open(json_path, 'r') as file: + model_json = file.read() + ast_model: Model = Model.model_validate_json(model_json) + bind_model(ast_model) + + model_json = ast_model.model_dump_json(indent=2) # specify the python path for the processes add_num = ast_model.processDefs[0] + assert add_num.python_path is not None add_num.python_path.path = ['toy', 'AddFloatsStep'] print_results = ast_model.processDefs[1] + assert print_results.python_path is not None print_results.python_path.path = ['toy', 'SaveFloatToFileStep'] + model_json = ast_model.model_dump_json(indent=2) + # set the output file path output_file_path = Path(tmp_dirname) / "output.txt" + assert print_results.params[0].default is not None print_results.params[0].default.val = str(output_file_path) assembler = ProcessBigraphEnv() @@ -82,10 +93,14 @@ def test_add_with_step(model_path_abc: Path) -> None: print(assembler.core.process_registry.registry) # run the process - assembler.run(10.0) assembler.step() # Check the output file, its contents should be 5.57 (only executed once) with open(output_file_path, 'r') as f: contents = f.read() assert contents.strip() == "5.57" + + + # model: Model = Model.model_validate_json(model_json) + # bind_model(model) + diff --git a/tests/test_parser.py b/tests/test_parser.py new file mode 100644 index 0000000..33dc911 --- /dev/null +++ b/tests/test_parser.py @@ -0,0 +1,41 @@ +import tempfile +from pathlib import Path + +from process_bigraph_lang.antlr_dsl.generate import bind_model +from process_bigraph_lang.dsl.model import Model + +from simple_process_bigraph_runtime.main import generatePythonModel + + +def test_parse_abc_with_process(model_paths_abc_processes: tuple[Path, Path]) -> None: + pblang_path = model_paths_abc_processes[0] + json_path = model_paths_abc_processes[1] + + # create the AST Model by parsing the pblang DSL + parsed_ast_model: Model = generatePythonModel(pblang_path) + + # read JSON from DSL in second argument of tuple + with open(json_path, 'r') as file: + model_json = file.read() + + loaded_ast_model: Model = Model.model_validate_json(model_json) + bind_model(loaded_ast_model) + + assert loaded_ast_model == parsed_ast_model + + +def test_parse_add_with_steps(model_paths_abc_steps: tuple[Path, Path]) -> None: + pblang_path = model_paths_abc_steps[0] + json_path = model_paths_abc_steps[1] + + # create the AST Model by parsing the pblang DSL + parsed_ast_model: Model = generatePythonModel(pblang_path) + + # read JSON from DSL in second argument of tuple + with open(json_path, 'r') as file: + model_json = file.read() + + loaded_ast_model: Model = Model.model_validate_json(model_json) + bind_model(loaded_ast_model) + + assert loaded_ast_model == parsed_ast_model