All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/python-mpmath: new package
@ 2024-04-27 15:30 Julien Olivain
  2024-04-27 15:30 ` [Buildroot] [PATCH 2/2] package/python-sympy: " Julien Olivain
  2024-05-09 20:30 ` [Buildroot] [PATCH 1/2] package/python-mpmath: " Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2024-04-27 15:30 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, James Hilliard, Asaf Kahlon, Thomas Petazzoni

mpmath is a free (BSD licensed) Python library for real and
complex floating-point arithmetic with arbitrary precision.

https://mpmath.org/

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                       |  2 ++
 package/Config.in                                |  1 +
 package/python-mpmath/Config.in                  |  7 +++++++
 package/python-mpmath/python-mpmath.hash         |  3 +++
 package/python-mpmath/python-mpmath.mk           | 14 ++++++++++++++
 .../tests/package/sample_python_mpmath.py        | 16 ++++++++++++++++
 .../testing/tests/package/test_python_mpmath.py  | 12 ++++++++++++
 7 files changed, 55 insertions(+)
 create mode 100644 package/python-mpmath/Config.in
 create mode 100644 package/python-mpmath/python-mpmath.hash
 create mode 100644 package/python-mpmath/python-mpmath.mk
 create mode 100644 support/testing/tests/package/sample_python_mpmath.py
 create mode 100644 support/testing/tests/package/test_python_mpmath.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..e44a7298822 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1766,6 +1766,7 @@ F:	support/testing/tests/package/sample_python_gnupg.py
 F:	support/testing/tests/package/sample_python_hwdata.py
 F:	support/testing/tests/package/sample_python_midiutil.py
 F:	support/testing/tests/package/sample_python_ml_dtypes.py
+F:	support/testing/tests/package/sample_python_mpmath.py
 F:	support/testing/tests/package/sample_python_pyalsa.py
 F:	support/testing/tests/package/sample_python_spake2.py
 F:	support/testing/tests/package/test_acl.py
@@ -1851,6 +1852,7 @@ F:	support/testing/tests/package/test_python_hwdata.py
 F:	support/testing/tests/package/test_python_magic_wormhole.py
 F:	support/testing/tests/package/test_python_midiutil.py
 F:	support/testing/tests/package/test_python_ml_dtypes.py
+F:	support/testing/tests/package/test_python_mpmath.py
 F:	support/testing/tests/package/test_python_pyalsa.py
 F:	support/testing/tests/package/test_python_spake2.py
 F:	support/testing/tests/package/test_rdma_core.py
diff --git a/package/Config.in b/package/Config.in
index 1935077f0f4..09e8b47a3c7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1197,6 +1197,7 @@ menu "External python modules"
 	source "package/python-modbus-tk/Config.in"
 	source "package/python-more-itertools/Config.in"
 	source "package/python-mpd2/Config.in"
+	source "package/python-mpmath/Config.in"
 	source "package/python-msgfy/Config.in"
 	source "package/python-msgpack/Config.in"
 	source "package/python-multidict/Config.in"
diff --git a/package/python-mpmath/Config.in b/package/python-mpmath/Config.in
new file mode 100644
index 00000000000..497b7d2ae3d
--- /dev/null
+++ b/package/python-mpmath/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_MPMATH
+	bool "python-mpmath"
+	help
+	  mpmath is a free (BSD licensed) Python library for real and
+	  complex floating-point arithmetic with arbitrary precision.
+
+	  https://mpmath.org/
diff --git a/package/python-mpmath/python-mpmath.hash b/package/python-mpmath/python-mpmath.hash
new file mode 100644
index 00000000000..1b263c925f7
--- /dev/null
+++ b/package/python-mpmath/python-mpmath.hash
@@ -0,0 +1,3 @@
+# Locally computed sha256 checksums
+sha256  7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f  mpmath-1.3.0.tar.gz
+sha256  c26cae81da4508e5e249985777a33821f183223ebb74d7f8cfbf90fe7eef2fb7  LICENSE
diff --git a/package/python-mpmath/python-mpmath.mk b/package/python-mpmath/python-mpmath.mk
new file mode 100644
index 00000000000..caa64929619
--- /dev/null
+++ b/package/python-mpmath/python-mpmath.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-mpmath
+#
+################################################################################
+
+PYTHON_MPMATH_VERSION = 1.3.0
+PYTHON_MPMATH_SOURCE = mpmath-$(PYTHON_MPMATH_VERSION).tar.gz
+PYTHON_MPMATH_SITE = https://mpmath.org/files
+PYTHON_MPMATH_SETUP_TYPE = setuptools
+PYTHON_MPMATH_LICENSE = BSD-3-Clause
+PYTHON_MPMATH_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_mpmath.py b/support/testing/tests/package/sample_python_mpmath.py
new file mode 100644
index 00000000000..5e3d9ad1c24
--- /dev/null
+++ b/support/testing/tests/package/sample_python_mpmath.py
@@ -0,0 +1,16 @@
+#! /usr/bin/env python3
+
+# Test inspired from example published on the project page:
+# https://mpmath.org/
+
+from mpmath import mp
+
+mp.dps = 50
+
+result = mp.quad(lambda x: mp.exp(-x**2), [-mp.inf, mp.inf]) ** 2
+
+# Pi digits can be cross-checked here:
+# https://www.angio.net/pi/digits.html
+expected_result = "3.1415926535897932384626433832795028841971693993751"
+
+assert str(result) == expected_result
diff --git a/support/testing/tests/package/test_python_mpmath.py b/support/testing/tests/package/test_python_mpmath.py
new file mode 100644
index 00000000000..c20c910fbec
--- /dev/null
+++ b/support/testing/tests/package/test_python_mpmath.py
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3MpMath(TestPythonPackageBase):
+    __test__ = True
+
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_MPMATH=y
+        """
+    sample_scripts = ["tests/package/sample_python_mpmath.py"]
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 2/2] package/python-sympy: new package
  2024-04-27 15:30 [Buildroot] [PATCH 1/2] package/python-mpmath: new package Julien Olivain
@ 2024-04-27 15:30 ` Julien Olivain
  2024-05-09 20:30 ` [Buildroot] [PATCH 1/2] package/python-mpmath: " Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Julien Olivain @ 2024-04-27 15:30 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, James Hilliard, Asaf Kahlon, Thomas Petazzoni

SymPy is a Python library for symbolic mathematics. It aims
to become a full-featured computer algebra system (CAS)
while keeping the code as simple as possible in order to be
comprehensible and easily extensible. SymPy is written
entirely in Python.

https://www.sympy.org/

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch series tested on branch master at commit db37b0e with commands:

    make check-package
    ...
    0 warnings generated

    support/testing/run-tests \
        -d dl -o output_folder \
        tests.package.test_python_mpmath
    ...
    OK

    support/testing/run-tests \
        -d dl -o output_folder \
        tests.package.test_python_sympy
    ...
    OK

    cat > python-sympy.config <<EOF
    BR2_PACKAGE_PYTHON3=y
    BR2_PACKAGE_PYTHON_SYMPY=y
    EOF
    utils/test-pkg -a -c python-sympy.config -p python-sympy
    ...
    42 builds, 6 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed
---
 DEVELOPERS                                        |  2 ++
 package/Config.in                                 |  1 +
 package/python-sympy/Config.in                    | 11 +++++++++++
 package/python-sympy/python-sympy.hash            |  7 +++++++
 package/python-sympy/python-sympy.mk              | 14 ++++++++++++++
 .../testing/tests/package/sample_python_sympy.py  | 15 +++++++++++++++
 .../testing/tests/package/test_python_sympy.py    | 13 +++++++++++++
 7 files changed, 63 insertions(+)
 create mode 100644 package/python-sympy/Config.in
 create mode 100644 package/python-sympy/python-sympy.hash
 create mode 100644 package/python-sympy/python-sympy.mk
 create mode 100644 support/testing/tests/package/sample_python_sympy.py
 create mode 100644 support/testing/tests/package/test_python_sympy.py

diff --git a/DEVELOPERS b/DEVELOPERS
index e44a7298822..5ad71778d6c 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1769,6 +1769,7 @@ F:	support/testing/tests/package/sample_python_ml_dtypes.py
 F:	support/testing/tests/package/sample_python_mpmath.py
 F:	support/testing/tests/package/sample_python_pyalsa.py
 F:	support/testing/tests/package/sample_python_spake2.py
+F:	support/testing/tests/package/sample_python_sympy.py
 F:	support/testing/tests/package/test_acl.py
 F:	support/testing/tests/package/test_acpica.py
 F:	support/testing/tests/package/test_acpica/
@@ -1855,6 +1856,7 @@ F:	support/testing/tests/package/test_python_ml_dtypes.py
 F:	support/testing/tests/package/test_python_mpmath.py
 F:	support/testing/tests/package/test_python_pyalsa.py
 F:	support/testing/tests/package/test_python_spake2.py
+F:	support/testing/tests/package/test_python_sympy.py
 F:	support/testing/tests/package/test_rdma_core.py
 F:	support/testing/tests/package/test_rdma_core/
 F:	support/testing/tests/package/test_screen.py
diff --git a/package/Config.in b/package/Config.in
index 09e8b47a3c7..7b90a7080e6 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1370,6 +1370,7 @@ menu "External python modules"
 	source "package/python-sqlparse/Config.in"
 	source "package/python-stack-data/Config.in"
 	source "package/python-starlette/Config.in"
+	source "package/python-sympy/Config.in"
 	source "package/python-systemd/Config.in"
 	source "package/python-tabledata/Config.in"
 	source "package/python-tcolorpy/Config.in"
diff --git a/package/python-sympy/Config.in b/package/python-sympy/Config.in
new file mode 100644
index 00000000000..1ee26222dcf
--- /dev/null
+++ b/package/python-sympy/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_SYMPY
+	bool "python-sympy"
+	select BR2_PACKAGE_PYTHON_MPMATH # runtime
+	help
+	  SymPy is a Python library for symbolic mathematics. It aims
+	  to become a full-featured computer algebra system (CAS)
+	  while keeping the code as simple as possible in order to be
+	  comprehensible and easily extensible. SymPy is written
+	  entirely in Python.
+
+	  https://www.sympy.org/
diff --git a/package/python-sympy/python-sympy.hash b/package/python-sympy/python-sympy.hash
new file mode 100644
index 00000000000..947edfd4e08
--- /dev/null
+++ b/package/python-sympy/python-sympy.hash
@@ -0,0 +1,7 @@
+# md5, sha256 from https://pypi.org/pypi/sympy/json
+md5  3e0033109352d7303ea97b9216e16645  sympy-1.12.tar.gz
+sha256  ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8  sympy-1.12.tar.gz
+# Locally computed sha256 checksums
+sha256  07a5e9819f727b4986ad2829c7a29a6320d42575f720eb24d71b7fef573a0286  LICENSE
+sha256  596639d3681fdb67bb2f05a9fcd2503d88bc549471a89b2e500cd9759ae2a3fa  data/TeXmacs/LICENSE
+sha256  007bc30a58fa40a996e772047120de4eaf31f5110e4f9c3b5f93fcdfbe2eaca1  sympy/parsing/latex/LICENSE.txt
diff --git a/package/python-sympy/python-sympy.mk b/package/python-sympy/python-sympy.mk
new file mode 100644
index 00000000000..0f160649ad4
--- /dev/null
+++ b/package/python-sympy/python-sympy.mk
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-sympy
+#
+################################################################################
+
+PYTHON_SYMPY_VERSION = 1.12
+PYTHON_SYMPY_SOURCE = sympy-$(PYTHON_SYMPY_VERSION).tar.gz
+PYTHON_SYMPY_SITE = https://github.com/sympy/sympy/releases/download/sympy-$(PYTHON_SYMPY_VERSION)
+PYTHON_SYMPY_SETUP_TYPE = setuptools
+PYTHON_SYMPY_LICENSE = BSD-3-Clause
+PYTHON_SYMPY_LICENSE_FILES = LICENSE data/TeXmacs/LICENSE sympy/parsing/latex/LICENSE.txt
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_sympy.py b/support/testing/tests/package/sample_python_sympy.py
new file mode 100644
index 00000000000..2734e9b4feb
--- /dev/null
+++ b/support/testing/tests/package/sample_python_sympy.py
@@ -0,0 +1,15 @@
+#! /usr/bin/env python3
+
+from sympy import symbols, expand, factor
+
+x, y = symbols('x y')
+
+expr = x + 2*y
+
+expanded_expr = expand(x*expr)
+print(expanded_expr)
+assert str(expanded_expr) == "x**2 + 2*x*y"
+
+factored_expr = factor(expanded_expr)
+print(factored_expr)
+assert str(factored_expr) == "x*(x + 2*y)"
diff --git a/support/testing/tests/package/test_python_sympy.py b/support/testing/tests/package/test_python_sympy.py
new file mode 100644
index 00000000000..e2106eb49ab
--- /dev/null
+++ b/support/testing/tests/package/test_python_sympy.py
@@ -0,0 +1,13 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3SymPy(TestPythonPackageBase):
+    __test__ = True
+
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_SYMPY=y
+        """
+    sample_scripts = ["tests/package/sample_python_sympy.py"]
+    timeout = 20
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/python-mpmath: new package
  2024-04-27 15:30 [Buildroot] [PATCH 1/2] package/python-mpmath: new package Julien Olivain
  2024-04-27 15:30 ` [Buildroot] [PATCH 2/2] package/python-sympy: " Julien Olivain
@ 2024-05-09 20:30 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-09 20:30 UTC (permalink / raw)
  To: Julien Olivain; +Cc: James Hilliard, Asaf Kahlon, buildroot

On Sat, 27 Apr 2024 17:30:44 +0200
Julien Olivain <ju.o@free.fr> wrote:

> mpmath is a free (BSD licensed) Python library for real and
> complex floating-point arithmetic with arbitrary precision.
> 
> https://mpmath.org/
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                       |  2 ++
>  package/Config.in                                |  1 +
>  package/python-mpmath/Config.in                  |  7 +++++++
>  package/python-mpmath/python-mpmath.hash         |  3 +++
>  package/python-mpmath/python-mpmath.mk           | 14 ++++++++++++++
>  .../tests/package/sample_python_mpmath.py        | 16 ++++++++++++++++
>  .../testing/tests/package/test_python_mpmath.py  | 12 ++++++++++++
>  7 files changed, 55 insertions(+)
>  create mode 100644 package/python-mpmath/Config.in
>  create mode 100644 package/python-mpmath/python-mpmath.hash
>  create mode 100644 package/python-mpmath/python-mpmath.mk
>  create mode 100644 support/testing/tests/package/sample_python_mpmath.py
>  create mode 100644 support/testing/tests/package/test_python_mpmath.py

Thanks a lot! Both patches applied!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-09 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-27 15:30 [Buildroot] [PATCH 1/2] package/python-mpmath: new package Julien Olivain
2024-04-27 15:30 ` [Buildroot] [PATCH 2/2] package/python-sympy: " Julien Olivain
2024-05-09 20:30 ` [Buildroot] [PATCH 1/2] package/python-mpmath: " Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.