diff mbox series

[2/2] python-falcon: new package

Message ID 20180828101618.4746-2-grzegorz@blach.pl
State Accepted
Headers show
Series [1/2] python-mimeparse: new package | expand

Commit Message

Grzegorz Blach Aug. 28, 2018, 10:16 a.m. UTC
An unladen web framework for building APIs and app backends.

http://falconframework.org

Signed-off-by: Grzegorz Blach <grzegorz@blach.pl>
---
 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/python-falcon/Config.in          |  9 +++++++++
 package/python-falcon/python-falcon.hash |  5 +++++
 package/python-falcon/python-falcon.mk   | 13 +++++++++++++
 5 files changed, 29 insertions(+)
 create mode 100644 package/python-falcon/Config.in
 create mode 100644 package/python-falcon/python-falcon.hash
 create mode 100644 package/python-falcon/python-falcon.mk

Comments

Joseph Kogut Aug. 28, 2018, 4:34 p.m. UTC | #1
Hi Grzegorz,

On Tue, Aug 28, 2018 at 3:52 AM Grzegorz Blach <grzegorz@blach.pl> wrote:
>
> An unladen web framework for building APIs and app backends.
>
> http://falconframework.org
>
> Signed-off-by: Grzegorz Blach <grzegorz@blach.pl>
> ---
>  DEVELOPERS                               |  1 +
>  package/Config.in                        |  1 +
>  package/python-falcon/Config.in          |  9 +++++++++
>  package/python-falcon/python-falcon.hash |  5 +++++
>  package/python-falcon/python-falcon.mk   | 13 +++++++++++++
>  5 files changed, 29 insertions(+)
>  create mode 100644 package/python-falcon/Config.in
>  create mode 100644 package/python-falcon/python-falcon.hash
>  create mode 100644 package/python-falcon/python-falcon.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index a9d5942adb..af039cc2ff 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -851,6 +851,7 @@ F:  package/libwebsock/
>  F:     package/sofia-sip/
>
>  N:     Grzegorz Blach <grzegorz@blach.pl>
> +F:     package/python-falcon
>  F:     package/python-mimeparse
>
>  N:     Guillaume Gardet <guillaume.gardet@oliseo.fr>
> diff --git a/package/Config.in b/package/Config.in
> index 0640a399bb..e243db552e 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -799,6 +799,7 @@ menu "External python modules"
>         source "package/python-engineio/Config.in"
>         source "package/python-enum/Config.in"
>         source "package/python-enum34/Config.in"
> +       source "package/python-falcon/Config.in"
>         source "package/python-flask/Config.in"
>         source "package/python-flask-cors/Config.in"
>         source "package/python-flask-babel/Config.in"
> diff --git a/package/python-falcon/Config.in b/package/python-falcon/Config.in
> new file mode 100644
> index 0000000000..ffd66eec1b
> --- /dev/null
> +++ b/package/python-falcon/Config.in
> @@ -0,0 +1,9 @@
> +config BR2_PACKAGE_PYTHON_FALCON
> +       bool "python-falcon"
> +       select BR2_PACKAGE_PYTHON_SIX # runtime
> +       select BR2_PACKAGE_PYTHON_MIMEPARSE # runtime
> +       help
> +         An unladen web framework for building APIs and app
> +         backends.
> +
> +         http://falconframework.org
> diff --git a/package/python-falcon/python-falcon.hash b/package/python-falcon/python-falcon.hash
> new file mode 100644
> index 0000000000..7f6ee6ea3d
> --- /dev/null
> +++ b/package/python-falcon/python-falcon.hash
> @@ -0,0 +1,5 @@
> +# md5, sha256 from https://pypi.org/pypi/falcon/json
> +md5    3cb880665ee2cd52143cf8a7790a35e6  falcon-1.4.1.tar.gz
> +sha256 3981f609c0358a9fcdb25b0e7fab3d9e23019356fb429c635ce4133135ae1bc4  falcon-1.4.1.tar.gz
> +# Locally computed sha256 checksums
> +sha256 e9e7f1a7ba764f042e56afce6f3563c2be9c4fffbb1404b20f8050ae051f577c  LICENSE
> diff --git a/package/python-falcon/python-falcon.mk b/package/python-falcon/python-falcon.mk
> new file mode 100644
> index 0000000000..52911c5428
> --- /dev/null
> +++ b/package/python-falcon/python-falcon.mk
> @@ -0,0 +1,13 @@
> +################################################################################
> +#
> +# python-falcon
> +#
> +################################################################################
> +
> +PYTHON_FALCON_VERSION = 1.4.1
> +PYTHON_FALCON_SOURCE = falcon-$(PYTHON_FALCON_VERSION).tar.gz
> +PYTHON_FALCON_SITE = https://files.pythonhosted.org/packages/2f/e6/5045da9df509b9259037f065d15608930fd6c997ee930ad230f9fbfecf15
> +PYTHON_FALCON_SETUP_TYPE = setuptools
> +PYTHON_FALCON_LICENSE_FILES = LICENSE

I know python-falcon supports compiling itself using Cython, would it
be helpful to do something like:

ifeq ($(BR2_PACKAGE_HOST_PYTHON_CYTHON),y)
PYTHON_FALCON_DEPENDENCIES += host-cython
endif

So that if host-cython is selected, python-falcon will utilize it during setup?

It might also be helpful to mention in the help text that the package
will optionally compile with Cython for enhanced performance, though
I'm not sure if that's the Buildroot way of doing things, maybe
someone else can chime in.

> +
> +$(eval $(python-package))
> --
> 2.17.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Aug. 29, 2018, 7:44 p.m. UTC | #2
Hello,

Thanks for your contribution!

On Tue, 28 Aug 2018 12:16:18 +0200, Grzegorz Blach wrote:
> An unladen web framework for building APIs and app backends.
> 
> http://falconframework.org
> 
> Signed-off-by: Grzegorz Blach <grzegorz@blach.pl>

I've applied to next. Two nits below though.

>  N:	Grzegorz Blach <grzegorz@blach.pl>
> +F:	package/python-falcon

The final slash was missing here.

> +PYTHON_FALCON_VERSION = 1.4.1
> +PYTHON_FALCON_SOURCE = falcon-$(PYTHON_FALCON_VERSION).tar.gz
> +PYTHON_FALCON_SITE = https://files.pythonhosted.org/packages/2f/e6/5045da9df509b9259037f065d15608930fd6c997ee930ad230f9fbfecf15
> +PYTHON_FALCON_SETUP_TYPE = setuptools
> +PYTHON_FALCON_LICENSE_FILES = LICENSE

The PYTHON_FALCON_LICENSE variable was missing. Interestingly, it was
present in your first version of the patch, but following Yegor's
review, you re-did the package using scanpypi, and scanpypi didn't add
the license information.

Yegor: could you tweak scanpypi so that it warns if no licensing
information could be added to the package ? Perhaps it should even in
this case generate something like:

PYTHON_FALCON_LICENSE = FIXME before submitting

Thanks!

Thomas
Yegor Yefremov Aug. 29, 2018, 7:45 p.m. UTC | #3
On Wed, Aug 29, 2018 at 9:44 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> Thanks for your contribution!
>
> On Tue, 28 Aug 2018 12:16:18 +0200, Grzegorz Blach wrote:
> > An unladen web framework for building APIs and app backends.
> >
> > http://falconframework.org
> >
> > Signed-off-by: Grzegorz Blach <grzegorz@blach.pl>
>
> I've applied to next. Two nits below though.
>
> >  N:   Grzegorz Blach <grzegorz@blach.pl>
> > +F:   package/python-falcon
>
> The final slash was missing here.
>
> > +PYTHON_FALCON_VERSION = 1.4.1
> > +PYTHON_FALCON_SOURCE = falcon-$(PYTHON_FALCON_VERSION).tar.gz
> > +PYTHON_FALCON_SITE = https://files.pythonhosted.org/packages/2f/e6/5045da9df509b9259037f065d15608930fd6c997ee930ad230f9fbfecf15
> > +PYTHON_FALCON_SETUP_TYPE = setuptools
> > +PYTHON_FALCON_LICENSE_FILES = LICENSE
>
> The PYTHON_FALCON_LICENSE variable was missing. Interestingly, it was
> present in your first version of the patch, but following Yegor's
> review, you re-did the package using scanpypi, and scanpypi didn't add
> the license information.
>
> Yegor: could you tweak scanpypi so that it warns if no licensing
> information could be added to the package ? Perhaps it should even in
> this case generate something like:
>
> PYTHON_FALCON_LICENSE = FIXME before submitting

Will take a look. Thanks.

Yegor

> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Thomas Petazzoni Aug. 29, 2018, 7:47 p.m. UTC | #4
Hello Joseph,

On Tue, 28 Aug 2018 09:34:56 -0700, Joseph Kogut wrote:

> I know python-falcon supports compiling itself using Cython, would it
> be helpful to do something like:
> 
> ifeq ($(BR2_PACKAGE_HOST_PYTHON_CYTHON),y)
> PYTHON_FALCON_DEPENDENCIES += host-cython
> endif

I am not very familiar with Cython. How does that work, what does that
do ? Is it sufficient for Cython to be installed in $(HOST_DIR) to
allow python-falcon to detect it and use it ?

> So that if host-cython is selected, python-falcon will utilize it during setup?
> 
> It might also be helpful to mention in the help text that the package
> will optionally compile with Cython for enhanced performance, though
> I'm not sure if that's the Buildroot way of doing things, maybe
> someone else can chime in.

Yes, if there are some optional dependencies, we can mention them in
the package Config.in help text.

Could you provide a follow-up adding this Cython support in
python-falcon ?

Thanks!

Thomas
Grzegorz Blach Aug. 29, 2018, 8:25 p.m. UTC | #5
On 08/29/2018 09:47 PM, Thomas Petazzoni wrote:
> Hello Joseph,
> 
> On Tue, 28 Aug 2018 09:34:56 -0700, Joseph Kogut wrote:
> 
>> I know python-falcon supports compiling itself using Cython, would it
>> be helpful to do something like:
>>
>> ifeq ($(BR2_PACKAGE_HOST_PYTHON_CYTHON),y)
>> PYTHON_FALCON_DEPENDENCIES += host-cython
>> endif
> 
> I am not very familiar with Cython. How does that work, what does that
> do ? Is it sufficient for Cython to be installed in $(HOST_DIR) to
> allow python-falcon to detect it and use it ?
> 

If BR2_PACKAGE_HOST_PYTHON_CYTHON is enabled in config, Falcon uses 
Cython to compile own code.  Cython on target is not required in this 
case.  Settings PYTHON_FALCON_DEPENDENCIES += host-python-cython
in python-falcon/Config.in also is not required, but may be usable to 
guarantee, that host-python-cython is always installed
before python-falcon.

>> So that if host-cython is selected, python-falcon will utilize it during setup?
>>
>> It might also be helpful to mention in the help text that the package
>> will optionally compile with Cython for enhanced performance, though
>> I'm not sure if that's the Buildroot way of doing things, maybe
>> someone else can chime in.
> 
> Yes, if there are some optional dependencies, we can mention them in
> the package Config.in help text.
> 
> Could you provide a follow-up adding this Cython support in
> python-falcon ?
> 
> Thanks!
> 
> Thomas
>
Thomas Petazzoni Aug. 29, 2018, 8:37 p.m. UTC | #6
Hello,

On Wed, 29 Aug 2018 22:25:30 +0200, Grzegorz Blach wrote:

> If BR2_PACKAGE_HOST_PYTHON_CYTHON is enabled in config, Falcon uses 
> Cython to compile own code.  Cython on target is not required in this 
> case.

OK.

> Settings PYTHON_FALCON_DEPENDENCIES += host-python-cython
> in python-falcon/Config.in also is not required, but may be usable to 
> guarantee, that host-python-cython is always installed
> before python-falcon.

Actually our policy is that when a package A can optionally be used by
package B, then package B should have a dependency on package A when
package A is enabled, which is what Joseph was suggesting.

This ensures that package B gets the additional feature
provided/enabled by package A, regardless of the package build order,
and generally makes sure that the features provided by package A
benefits all package that can make use of it.

Best regards,

Thomas
Joseph Kogut Aug. 29, 2018, 9:58 p.m. UTC | #7
Hi Thomas,

On Wed, Aug 29, 2018 at 12:47 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Joseph,
>
> On Tue, 28 Aug 2018 09:34:56 -0700, Joseph Kogut wrote:
>
> > I know python-falcon supports compiling itself using Cython, would it
> > be helpful to do something like:
> >
> > ifeq ($(BR2_PACKAGE_HOST_PYTHON_CYTHON),y)
> > PYTHON_FALCON_DEPENDENCIES += host-cython
> > endif
>
> I am not very familiar with Cython. How does that work, what does that
> do ? Is it sufficient for Cython to be installed in $(HOST_DIR) to
> allow python-falcon to detect it and use it ?
>

Cython allows Python modules to be written using a mix of Python and C
or C++ syntax with optional static typing. During setup, Cython
modules are transpiled to C or C++ and compiled normally as Python
extensions. Most projects that use Cython, including Falcon, have
implementations in vanilla Python, as well as Cython.

Based on my experience porting Kivy, having Cython available on the
host should be enough to compile the extensions.

> > So that if host-cython is selected, python-falcon will utilize it during setup?
> >
> > It might also be helpful to mention in the help text that the package
> > will optionally compile with Cython for enhanced performance, though
> > I'm not sure if that's the Buildroot way of doing things, maybe
> > someone else can chime in.
>
> Yes, if there are some optional dependencies, we can mention them in
> the package Config.in help text.
>

As I noted in my message after this one, I can't think of a reason to
not *always* depend on host-cython here. Compiling the extensions is
essentially an optimization step.

The only reason I can think of to not compile the extensions is if
performance isn't a concern, and you don't have the requisite build
environment during setup.

> Could you provide a follow-up adding this Cython support in
> python-falcon ?
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Thomas Petazzoni Aug. 30, 2018, 7:31 a.m. UTC | #8
Hello,

On Wed, 29 Aug 2018 14:58:34 -0700, Joseph Kogut wrote:

> Cython allows Python modules to be written using a mix of Python and C
> or C++ syntax with optional static typing. During setup, Cython
> modules are transpiled to C or C++ and compiled normally as Python
> extensions. Most projects that use Cython, including Falcon, have
> implementations in vanilla Python, as well as Cython.
> 
> Based on my experience porting Kivy, having Cython available on the
> host should be enough to compile the extensions.

Thanks for the explanation/introduction about Cython!

> As I noted in my message after this one, I can't think of a reason to
> not *always* depend on host-cython here. Compiling the extensions is
> essentially an optimization step.
> 
> The only reason I can think of to not compile the extensions is if
> performance isn't a concern, and you don't have the requisite build
> environment during setup.

A principle in Buildroot is to avoid adding mandatory dependencies if
they are optional. So if people want the extra optimizations provided
by Cython, they should enable Cython, and python-falcon should
optionally depend on it.

Will you send a patch doing this ?

Thanks!

Thomas
Grzegorz Blach Aug. 30, 2018, 10:20 a.m. UTC | #9
On 08/30/2018 09:31 AM, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 29 Aug 2018 14:58:34 -0700, Joseph Kogut wrote:
> 
>> Cython allows Python modules to be written using a mix of Python and C
>> or C++ syntax with optional static typing. During setup, Cython
>> modules are transpiled to C or C++ and compiled normally as Python
>> extensions. Most projects that use Cython, including Falcon, have
>> implementations in vanilla Python, as well as Cython.
>>
>> Based on my experience porting Kivy, having Cython available on the
>> host should be enough to compile the extensions.
> 
> Thanks for the explanation/introduction about Cython!
> 
>> As I noted in my message after this one, I can't think of a reason to
>> not *always* depend on host-cython here. Compiling the extensions is
>> essentially an optimization step.
>>
>> The only reason I can think of to not compile the extensions is if
>> performance isn't a concern, and you don't have the requisite build
>> environment during setup.
> 
> A principle in Buildroot is to avoid adding mandatory dependencies if
> they are optional. So if people want the extra optimizations provided
> by Cython, they should enable Cython, and python-falcon should
> optionally depend on it.
> 
> Will you send a patch doing this ?

I've just sent a patch.


> 
> Thanks!
> 
> Thomas
>
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index a9d5942adb..af039cc2ff 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -851,6 +851,7 @@  F:	package/libwebsock/
 F:	package/sofia-sip/
 
 N:	Grzegorz Blach <grzegorz@blach.pl>
+F:	package/python-falcon
 F:	package/python-mimeparse
 
 N:	Guillaume Gardet <guillaume.gardet@oliseo.fr>
diff --git a/package/Config.in b/package/Config.in
index 0640a399bb..e243db552e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -799,6 +799,7 @@  menu "External python modules"
 	source "package/python-engineio/Config.in"
 	source "package/python-enum/Config.in"
 	source "package/python-enum34/Config.in"
+	source "package/python-falcon/Config.in"
 	source "package/python-flask/Config.in"
 	source "package/python-flask-cors/Config.in"
 	source "package/python-flask-babel/Config.in"
diff --git a/package/python-falcon/Config.in b/package/python-falcon/Config.in
new file mode 100644
index 0000000000..ffd66eec1b
--- /dev/null
+++ b/package/python-falcon/Config.in
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_PYTHON_FALCON
+	bool "python-falcon"
+	select BR2_PACKAGE_PYTHON_SIX # runtime
+	select BR2_PACKAGE_PYTHON_MIMEPARSE # runtime
+	help
+	  An unladen web framework for building APIs and app
+	  backends.
+
+	  http://falconframework.org
diff --git a/package/python-falcon/python-falcon.hash b/package/python-falcon/python-falcon.hash
new file mode 100644
index 0000000000..7f6ee6ea3d
--- /dev/null
+++ b/package/python-falcon/python-falcon.hash
@@ -0,0 +1,5 @@ 
+# md5, sha256 from https://pypi.org/pypi/falcon/json
+md5	3cb880665ee2cd52143cf8a7790a35e6  falcon-1.4.1.tar.gz
+sha256	3981f609c0358a9fcdb25b0e7fab3d9e23019356fb429c635ce4133135ae1bc4  falcon-1.4.1.tar.gz
+# Locally computed sha256 checksums
+sha256	e9e7f1a7ba764f042e56afce6f3563c2be9c4fffbb1404b20f8050ae051f577c  LICENSE
diff --git a/package/python-falcon/python-falcon.mk b/package/python-falcon/python-falcon.mk
new file mode 100644
index 0000000000..52911c5428
--- /dev/null
+++ b/package/python-falcon/python-falcon.mk
@@ -0,0 +1,13 @@ 
+################################################################################
+#
+# python-falcon
+#
+################################################################################
+
+PYTHON_FALCON_VERSION = 1.4.1
+PYTHON_FALCON_SOURCE = falcon-$(PYTHON_FALCON_VERSION).tar.gz
+PYTHON_FALCON_SITE = https://files.pythonhosted.org/packages/2f/e6/5045da9df509b9259037f065d15608930fd6c997ee930ad230f9fbfecf15
+PYTHON_FALCON_SETUP_TYPE = setuptools
+PYTHON_FALCON_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))