All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] package/python-orjson: new package
@ 2022-04-19 21:24 Graeme Smecher
  2022-04-19 21:24 ` [Buildroot] [PATCH] Adds python-orjson support Graeme Smecher
  0 siblings, 1 reply; 5+ messages in thread
From: Graeme Smecher @ 2022-04-19 21:24 UTC (permalink / raw)
  To: buildroot; +Cc: Graeme Smecher


The python-orjson package is: [1]

	"[...] a fast, correct JSON library for Python. It benchmarks as
	the fastest Python library for JSON and is more correct than the
	standard json library or other third-party libraries. It
	serializes dataclass, datetime, numpy, and UUID instances
	natively."

For buildroot (at least for my purposes), the ability to efficiently
serialize numpy arrays is the distinguishing feature from other Python
JSON libraries (of which, simplejson, json, and ujson are already
packaged here.)

1: https://pypi.org/project/orjson/

Signed-off-by: Graeme Smecher <gsmecher@threespeedlogic.com>

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

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

* [Buildroot] [PATCH] Adds python-orjson support.
  2022-04-19 21:24 [Buildroot] package/python-orjson: new package Graeme Smecher
@ 2022-04-19 21:24 ` Graeme Smecher
  2022-05-03 19:48   ` Arnout Vandecappelle
  0 siblings, 1 reply; 5+ messages in thread
From: Graeme Smecher @ 2022-04-19 21:24 UTC (permalink / raw)
  To: buildroot; +Cc: Graeme Smecher

---
 DEVELOPERS                               |  3 +++
 package/Config.in                        |  1 +
 package/python-orjson/Config.in          | 12 ++++++++++++
 package/python-orjson/python-orjson.hash |  3 +++
 package/python-orjson/python-orjson.mk   | 22 ++++++++++++++++++++++
 5 files changed, 41 insertions(+)
 create mode 100644 package/python-orjson/Config.in
 create mode 100644 package/python-orjson/python-orjson.hash
 create mode 100644 package/python-orjson/python-orjson.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index ca9decb58f..0846aac835 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3058,3 +3058,6 @@ F:	package/quazip/
 F:	package/shapelib/
 F:	package/simple-mail/
 F:	package/tinc/
+
+N:	Graeme Smecher <gsmecher@threespeedlogic.com>
+F:	package/python-orjson/
diff --git a/package/Config.in b/package/Config.in
index c599271c65..1494387c2e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1111,6 +1111,7 @@ menu "External python modules"
 	source "package/python-numpy/Config.in"
 	source "package/python-oauthlib/Config.in"
 	source "package/python-opcua-asyncio/Config.in"
+	source "package/python-orjson/Config.in"
 	source "package/python-packaging/Config.in"
 	source "package/python-paho-mqtt/Config.in"
 	source "package/python-paramiko/Config.in"
diff --git a/package/python-orjson/Config.in b/package/python-orjson/Config.in
new file mode 100644
index 0000000000..fa96eee57d
--- /dev/null
+++ b/package/python-orjson/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_PYTHON_ORJSON
+	bool "python-orjson"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_PYTHON_CFFI # runtime
+	help
+	  orjson is a fast, correct JSON library for Python. It benchmarks as
+	  the fastest Python library for JSON and is more correct than the
+	  standard json library or other third-party libraries. It serializes
+	  dataclass, datetime, numpy, and UUID instances natively.
+
+	  https://github.com/ijl/orjson
diff --git a/package/python-orjson/python-orjson.hash b/package/python-orjson/python-orjson.hash
new file mode 100644
index 0000000000..8f9cc2a7c9
--- /dev/null
+++ b/package/python-orjson/python-orjson.hash
@@ -0,0 +1,3 @@
+sha256  4713b120ad86b1b273f5952cbf9578c13d0f453064bd26d823e04a10c84824e6  python-orjson-3.6.7.tar.gz
+sha256  a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
+sha256  23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
diff --git a/package/python-orjson/python-orjson.mk b/package/python-orjson/python-orjson.mk
new file mode 100644
index 0000000000..5de4b2c5fa
--- /dev/null
+++ b/package/python-orjson/python-orjson.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# python-orjson
+#
+################################################################################
+
+PYTHON_ORJSON_VERSION = 3.6.7
+PYTHON_ORJSON_SITE = $(call github,ijl,orjson,$(PYTHON_ORJSON_VERSION))
+PYTHON_ORJSON_LICENSE = Apache-2.0 or MIT
+PYTHON_ORJSON_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
+PYTHON_ORJSON_DEPENDENCIES = host-python-cffi
+PYTHON_ORJSON_CARGO_ENV = \
+	PYO3_CROSS_LIB_DIR="$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
+
+# orjson uses "maturin" to generate distribution packages - rather than teach
+# buildroot how to understand this, we reach in and install directly.
+define PYTHON_ORJSON_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(@D)/target/$(RUSTC_TARGET_NAME)/release/liborjson.so \
+		$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/orjson.so
+endef
+
+$(eval $(cargo-package))
-- 
2.35.1

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

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

* Re: [Buildroot] [PATCH] Adds python-orjson support.
  2022-04-19 21:24 ` [Buildroot] [PATCH] Adds python-orjson support Graeme Smecher
@ 2022-05-03 19:48   ` Arnout Vandecappelle
  0 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2022-05-03 19:48 UTC (permalink / raw)
  To: Graeme Smecher, buildroot

The commit message should have been like this:

package/python-orjson: new package

Signed-off-by: Graeme Smecher <gsmecher@threespeedlogic.com>


On 19/04/2022 23:24, Graeme Smecher wrote:
> ---
>   DEVELOPERS                               |  3 +++
>   package/Config.in                        |  1 +
>   package/python-orjson/Config.in          | 12 ++++++++++++
>   package/python-orjson/python-orjson.hash |  3 +++
>   package/python-orjson/python-orjson.mk   | 22 ++++++++++++++++++++++
>   5 files changed, 41 insertions(+)
>   create mode 100644 package/python-orjson/Config.in
>   create mode 100644 package/python-orjson/python-orjson.hash
>   create mode 100644 package/python-orjson/python-orjson.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index ca9decb58f..0846aac835 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -3058,3 +3058,6 @@ F:	package/quazip/
>   F:	package/shapelib/
>   F:	package/simple-mail/
>   F:	package/tinc/
> +
> +N:	Graeme Smecher <gsmecher@threespeedlogic.com>

  This should have been alphabetic.

> +F:	package/python-orjson/
> diff --git a/package/Config.in b/package/Config.in
> index c599271c65..1494387c2e 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1111,6 +1111,7 @@ menu "External python modules"
>   	source "package/python-numpy/Config.in"
>   	source "package/python-oauthlib/Config.in"
>   	source "package/python-opcua-asyncio/Config.in"
> +	source "package/python-orjson/Config.in"
>   	source "package/python-packaging/Config.in"
>   	source "package/python-paho-mqtt/Config.in"
>   	source "package/python-paramiko/Config.in"
> diff --git a/package/python-orjson/Config.in b/package/python-orjson/Config.in
> new file mode 100644
> index 0000000000..fa96eee57d
> --- /dev/null
> +++ b/package/python-orjson/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_PYTHON_ORJSON
> +	bool "python-orjson"
> +	depends on BR2_PACKAGE_PYTHON3
> +	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> +	select BR2_PACKAGE_PYTHON_CFFI # runtime
> +	help
> +	  orjson is a fast, correct JSON library for Python. It benchmarks as

  Wrap at 72 columns (the tab counts for 8). utils/check-package warns about this.


  Applied to master with those things fixed, thanks.

  Regards,
  Arnout


> +	  the fastest Python library for JSON and is more correct than the
> +	  standard json library or other third-party libraries. It serializes
> +	  dataclass, datetime, numpy, and UUID instances natively.
> +
> +	  https://github.com/ijl/orjson
> diff --git a/package/python-orjson/python-orjson.hash b/package/python-orjson/python-orjson.hash
> new file mode 100644
> index 0000000000..8f9cc2a7c9
> --- /dev/null
> +++ b/package/python-orjson/python-orjson.hash
> @@ -0,0 +1,3 @@
> +sha256  4713b120ad86b1b273f5952cbf9578c13d0f453064bd26d823e04a10c84824e6  python-orjson-3.6.7.tar.gz
> +sha256  a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
> +sha256  23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
> diff --git a/package/python-orjson/python-orjson.mk b/package/python-orjson/python-orjson.mk
> new file mode 100644
> index 0000000000..5de4b2c5fa
> --- /dev/null
> +++ b/package/python-orjson/python-orjson.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# python-orjson
> +#
> +################################################################################
> +
> +PYTHON_ORJSON_VERSION = 3.6.7
> +PYTHON_ORJSON_SITE = $(call github,ijl,orjson,$(PYTHON_ORJSON_VERSION))
> +PYTHON_ORJSON_LICENSE = Apache-2.0 or MIT
> +PYTHON_ORJSON_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
> +PYTHON_ORJSON_DEPENDENCIES = host-python-cffi
> +PYTHON_ORJSON_CARGO_ENV = \
> +	PYO3_CROSS_LIB_DIR="$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
> +
> +# orjson uses "maturin" to generate distribution packages - rather than teach
> +# buildroot how to understand this, we reach in and install directly.
> +define PYTHON_ORJSON_INSTALL_TARGET_CMDS
> +	$(INSTALL) -m 0755 -D $(@D)/target/$(RUSTC_TARGET_NAME)/release/liborjson.so \
> +		$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/orjson.so
> +endef
> +
> +$(eval $(cargo-package))
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] Adds python-orjson support.
  2022-04-14 19:40 Graeme Smecher
@ 2022-04-19 21:08 ` Arnout Vandecappelle
  0 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2022-04-19 21:08 UTC (permalink / raw)
  To: Graeme Smecher, buildroot

  Hi Graeme,

  I have a few fairly small remarks. Care to fix them up and resend?

  First of all, the subject line should be:

package/python-orjson: new package

Also, add a Signed-off-by line for yourself at the end of the commit message. 
This is a short way for you to assert that you are entitled to contribute the 
patch under buildroot's GPL license.  See  [1] for more details.

On 14/04/2022 21:40, Graeme Smecher wrote:
> ---
>   package/Config.in                        |  1 +
>   package/python-orjson/Config.in          | 12 ++++++++++
>   package/python-orjson/python-orjson.hash |  3 +++
>   package/python-orjson/python-orjson.mk   | 28 ++++++++++++++++++++++++

  Please add yourself to the DEVELOPERS file [1] for this package. This way, 
you'll get an e-mail if the package fails in the autobuilders, or when a new 
version is released if the package is registered on release-monitoring.org.


>   4 files changed, 44 insertions(+)
>   create mode 100644 package/python-orjson/Config.in
>   create mode 100644 package/python-orjson/python-orjson.hash
>   create mode 100644 package/python-orjson/python-orjson.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 86a1c59696..db0e37b7f7 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1122,6 +1122,7 @@ menu "External python modules"
>   	source "package/python-numpy/Config.in"
>   	source "package/python-oauthlib/Config.in"
>   	source "package/python-opcua-asyncio/Config.in"
> +	source "package/python-orjson/Config.in"
>   	source "package/python-packaging/Config.in"
>   	source "package/python-paho-mqtt/Config.in"
>   	source "package/python-pam/Config.in"
> diff --git a/package/python-orjson/Config.in b/package/python-orjson/Config.in
> new file mode 100644
> index 0000000000..fa96eee57d
> --- /dev/null
> +++ b/package/python-orjson/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_PYTHON_ORJSON
> +	bool "python-orjson"
> +	depends on BR2_PACKAGE_PYTHON3
> +	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> +	select BR2_PACKAGE_PYTHON_CFFI # runtime
> +	help
> +	  orjson is a fast, correct JSON library for Python. It benchmarks as
> +	  the fastest Python library for JSON and is more correct than the
> +	  standard json library or other third-party libraries. It serializes
> +	  dataclass, datetime, numpy, and UUID instances natively.
> +
> +	  https://github.com/ijl/orjson
> diff --git a/package/python-orjson/python-orjson.hash b/package/python-orjson/python-orjson.hash
> new file mode 100644
> index 0000000000..158099c174
> --- /dev/null
> +++ b/package/python-orjson/python-orjson.hash
> @@ -0,0 +1,3 @@
> +sha256  4713b120ad86b1b273f5952cbf9578c13d0f453064bd26d823e04a10c84824e6  3.6.7.tar.gz
> +sha256  a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
> +sha256  23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
> diff --git a/package/python-orjson/python-orjson.mk b/package/python-orjson/python-orjson.mk
> new file mode 100644
> index 0000000000..91ead3b170
> --- /dev/null
> +++ b/package/python-orjson/python-orjson.mk
> @@ -0,0 +1,28 @@
> +################################################################################
> +#
> +# python-orjson
> +#
> +################################################################################
> +
> +PYTHON_ORJSON_VERSION = 3.6.7
> +PYTHON_ORJSON_SOURCE = $(PYTHON_ORJSON_VERSION).tar.gz
> +PYTHON_ORJSON_SITE = https://github.com/ijl/orjson/archive/refs/tags

  Rather than the above two lines, keep the default tarball name 
(python-orjson-3.6.7.tar.gz) and use the github helper:

PYTHON_ORJSON_SITE = $(call github,ijl,orjson,$(PYTHON_ORJSON_VERSION))

> +PYTHON_ORJSON_LICENSE = Apache-2.0 or MIT
> +PYTHON_ORJSON_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
> +PYTHON_ORJSON_DEPENDENCIES = host-python-cffi host-rustc

  host-rustc is already added by cargo-package.

> +PYTHON_ORJSON_CARGO_ENV = \
> +	PYO3_CROSS_LIB_DIR="$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
> +
> +# Vendor the Cargo crates at download time
> +PYTHON_ORJSON_DOWNLOAD_POST_PROCESS = cargo
> +PYTHON_ORJSON_DOWNLOAD_DEPENDENCIES = host-rustc

  These two are (or should be) added automatically already by the cargo 
infrastructure, so are unneeded.

> +PYTHON_ORJSON_DL_ENV = BR_CARGO_MANIFEST_PATH=Cargo.toml

  This is the default, so unneeded.

> +
> +# orjson uses "maturin" to generate distribution packages - rather than teach
> +# buildroot how to understand this, we reach in and install directly.
> +define PYTHON_ORJSON_INSTALL_TARGET_CMDS
> +	$(INSTALL) -m 0755 $(@D)/target/$(RUSTC_TARGET_NAME)/release/liborjson.so \

  We normally add -D to the INSTALL arguments, so the target directory is 
created if it doesn't exist yet.

> +		$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/orjson.so
> +endef
> +
> +$(eval $(cargo-package))


  Regards,
  Arnout


[1] http://elinux.org/Developer_Certificate_Of_Origin
[2] https://buildroot.org/downloads/manual/manual.html#DEVELOPERS

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

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

* [Buildroot] [PATCH] Adds python-orjson support.
@ 2022-04-14 19:40 Graeme Smecher
  2022-04-19 21:08 ` Arnout Vandecappelle
  0 siblings, 1 reply; 5+ messages in thread
From: Graeme Smecher @ 2022-04-14 19:40 UTC (permalink / raw)
  To: buildroot; +Cc: Graeme Smecher

---
 package/Config.in                        |  1 +
 package/python-orjson/Config.in          | 12 ++++++++++
 package/python-orjson/python-orjson.hash |  3 +++
 package/python-orjson/python-orjson.mk   | 28 ++++++++++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 package/python-orjson/Config.in
 create mode 100644 package/python-orjson/python-orjson.hash
 create mode 100644 package/python-orjson/python-orjson.mk

diff --git a/package/Config.in b/package/Config.in
index 86a1c59696..db0e37b7f7 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1122,6 +1122,7 @@ menu "External python modules"
 	source "package/python-numpy/Config.in"
 	source "package/python-oauthlib/Config.in"
 	source "package/python-opcua-asyncio/Config.in"
+	source "package/python-orjson/Config.in"
 	source "package/python-packaging/Config.in"
 	source "package/python-paho-mqtt/Config.in"
 	source "package/python-pam/Config.in"
diff --git a/package/python-orjson/Config.in b/package/python-orjson/Config.in
new file mode 100644
index 0000000000..fa96eee57d
--- /dev/null
+++ b/package/python-orjson/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_PYTHON_ORJSON
+	bool "python-orjson"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_PYTHON_CFFI # runtime
+	help
+	  orjson is a fast, correct JSON library for Python. It benchmarks as
+	  the fastest Python library for JSON and is more correct than the
+	  standard json library or other third-party libraries. It serializes
+	  dataclass, datetime, numpy, and UUID instances natively.
+
+	  https://github.com/ijl/orjson
diff --git a/package/python-orjson/python-orjson.hash b/package/python-orjson/python-orjson.hash
new file mode 100644
index 0000000000..158099c174
--- /dev/null
+++ b/package/python-orjson/python-orjson.hash
@@ -0,0 +1,3 @@
+sha256  4713b120ad86b1b273f5952cbf9578c13d0f453064bd26d823e04a10c84824e6  3.6.7.tar.gz
+sha256  a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2  LICENSE-APACHE
+sha256  23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3  LICENSE-MIT
diff --git a/package/python-orjson/python-orjson.mk b/package/python-orjson/python-orjson.mk
new file mode 100644
index 0000000000..91ead3b170
--- /dev/null
+++ b/package/python-orjson/python-orjson.mk
@@ -0,0 +1,28 @@
+################################################################################
+#
+# python-orjson
+#
+################################################################################
+
+PYTHON_ORJSON_VERSION = 3.6.7
+PYTHON_ORJSON_SOURCE = $(PYTHON_ORJSON_VERSION).tar.gz
+PYTHON_ORJSON_SITE = https://github.com/ijl/orjson/archive/refs/tags
+PYTHON_ORJSON_LICENSE = Apache-2.0 or MIT
+PYTHON_ORJSON_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
+PYTHON_ORJSON_DEPENDENCIES = host-python-cffi host-rustc
+PYTHON_ORJSON_CARGO_ENV = \
+	PYO3_CROSS_LIB_DIR="$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
+
+# Vendor the Cargo crates at download time
+PYTHON_ORJSON_DOWNLOAD_POST_PROCESS = cargo
+PYTHON_ORJSON_DOWNLOAD_DEPENDENCIES = host-rustc
+PYTHON_ORJSON_DL_ENV = BR_CARGO_MANIFEST_PATH=Cargo.toml
+
+# orjson uses "maturin" to generate distribution packages - rather than teach
+# buildroot how to understand this, we reach in and install directly.
+define PYTHON_ORJSON_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 $(@D)/target/$(RUSTC_TARGET_NAME)/release/liborjson.so \
+		$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/orjson.so
+endef
+
+$(eval $(cargo-package))
-- 
2.35.1

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

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

end of thread, other threads:[~2022-05-03 19:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 21:24 [Buildroot] package/python-orjson: new package Graeme Smecher
2022-04-19 21:24 ` [Buildroot] [PATCH] Adds python-orjson support Graeme Smecher
2022-05-03 19:48   ` Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2022-04-14 19:40 Graeme Smecher
2022-04-19 21:08 ` Arnout Vandecappelle

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.