package/python-uvicorn: requires PYTHON3_SSL
PATCH v2 1/2 package/python-uvicorn: requires PYTHON3_SSL
From: Marcus Hoffmann <[email protected]>
Uvicorn has a hard requirement on the python ssl module. Without it even running uvicorn --help fails.
--- package/python-uvicorn/Config.in | 1 + 1 file changed, 1 insertion(+)
package/python-uvicorn/Config.in +1 -0
@@ -2,6 +2,7 @@ config BR2_PACKAGE_PYTHON_UVICORN bool "python-uvicorn" select BR2_PACKAGE_PYTHON_CLICK # runtime select BR2_PACKAGE_PYTHON_H11 # runtime + select BR2_PACKAGE_PYTHON3_SSL # runtime help The lightning-fast ASGI server.
Signature · 6 lines
2.38.5 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 2/2 support/testing: add fastapi runtime test
From: Marcus Hoffmann <[email protected]>
Add a runtime test for fastapi. Use uvicorn as the asgi server application as does the fastapi hello world example [1].
Fastapi depends on PydanticV2 now which is written in rust so we need to run the test on armv7.
[1] https://fastapi.tiangolo.com/tutorial/first-steps/
--- .../tests/package/sample_python_fastapi.py | 8 ++++ .../tests/package/test_python_fastapi.py | 47 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 support/testing/tests/package/sample_python_fastapi.py create mode 100644 support/testing/tests/package/test_python_fastapi.py
support/testing/tests/package/sample_python_fastapi.py new file +8 -0
@@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + [email protected]("/") +async def root(): + return {"message": "Hello World"} +
support/testing/tests/package/test_python_fastapi.py new file +47 -0
47 lines not on this page · raw message
Signature · 5 lines
2.38.5 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Quoted 50 lines · ~bubu
From: Marcus Hoffmann <[email protected]>
Add a runtime test for fastapi. Use uvicorn as the asgi server application as does the fastapi hello world example [1].
Fastapi depends on PydanticV2 now which is written in rust so we need to run the test on armv7.
[1] https://fastapi.tiangolo.com/tutorial/first-steps/
Signed-off-by Marcus Hoffmann <[email protected]>--- .../tests/package/sample_python_fastapi.py | 8 ++++ .../tests/package/test_python_fastapi.py | 47 +++++++++++++++++++ 2 files changed, 55 insertions(+)create mode 100644
support/testing/tests/package/sample_python_fastapi.pycreate mode 100644support/testing/tests/package/test_python_fastapi.pysupport/testing/tests/package/sample_python_fastapi.py new file +8
-0@@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + [email protected]("/") +async def root(): + return {"message": "Hello World"} +support/testing/tests/package/test_python_fastapi.py new file +12
-0@@ -0,0 +1,47 @@ +import os +import time + +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonPy3Fastapi(TestPythonPackageBase): + __test__ = True + config = \ + """ + BR2_arm=y + BR2_cortex_a9=y
support/testing/tests/package/test_python_fastapi.py line 22
Quoted 10 lines
support/testing/tests/package/test_python_fastapi.py new file +10
-0+ BR2_ARM_ENABLE_NEON=y + BR2_ARM_ENABLE_VFP=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_FASTAPI=y + BR2_PACKAGE_PYTHON_UVICORN=y + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_CCACHE=y + BR2_CCACHE_DIR="/home/bubu/.buildroot-ccache"
Oops, I forgot to remove the 2 CCACHE lines before submitting. Don't forget to remove these when applying. :-)
Quoted 15 lines
support/testing/tests/package/test_python_fastapi.py new file +15
-0+ """ + sample_scripts = ["tests/package/sample_python_fastapi.py"] + timeout = 60 + + def test_run(self): + self.login() + self.check_sample_scripts_exist() + cmd = "uvicorn sample_python_fastapi:app > /dev/null 2>&1 &" + + _, exit_code = self.emulator.run(cmd, timeout=self.timeout) + + # Give enough time for the uvicorn server to start up + time.sleep(30) + + cmd = "wget -q -O - http://127.0.0.1:8000/"
support/testing/tests/package/test_python_fastapi.py line 47
Quoted 10 lines
support/testing/tests/package/test_python_fastapi.py new file +10
-0+ output, exit_code = self.emulator.run(cmd, timeout=self.timeout) + self.assertEqual(exit_code, 0) + self.assertEqual(output[0], '{"message":"Hello World"}') + + def login(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv7", + kernel="builtin", + options=["-initrd", cpio_file]) + self.emulator.login()
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
In reply to ~bubuQuoted 11 lines · ~bubu
From: Marcus Hoffmann <[email protected]>
Add a runtime test for fastapi. Use uvicorn as the asgi server application as does the fastapi hello world example [1].
Fastapi depends on PydanticV2 now which is written in rust so we need to run the test on armv7.
[1] https://fastapi.tiangolo.com/tutorial/first-steps/
Signed-off-by Marcus Hoffmann <[email protected]>
Both applied to master, but this one with a bunch of modifications:
- fix flake8 errorssupport/testing/tests/package/sample_python_fastapi.py:5:1: E302 expected 2 blank lines, found 1 support/testing/tests/package/sample_python_fastapi.py:8:1: W391 blank line at end of file
- Remove BR2_CCACHE (as requested by Marcus).
- Add a comment explaining that this also tests uvicorn and pydantic.
- Re-try wget in a loop instead of a fixed timeout of 30 seconds.
- Add a DEVELOPERS entry.
Regards,
Arnout
Quoted 64 lines
--- .../tests/package/sample_python_fastapi.py | 8 ++++ .../tests/package/test_python_fastapi.py | 47 +++++++++++++++++++ 2 files changed, 55 insertions(+)create mode 100644
support/testing/tests/package/sample_python_fastapi.pycreate mode 100644support/testing/tests/package/test_python_fastapi.pysupport/testing/tests/package/sample_python_fastapi.py new file +8
-0@@ -0,0 +1,8 @@ +from fastapi import FastAPI + +app = FastAPI() + [email protected]("/") +async def root(): + return {"message": "Hello World"} +support/testing/tests/package/test_python_fastapi.py new file +37
-0@@ -0,0 +1,47 @@ +import os +import time + +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonPy3Fastapi(TestPythonPackageBase): + __test__ = True + config = \ + """ + BR2_arm=y + BR2_cortex_a9=y + BR2_ARM_ENABLE_NEON=y + BR2_ARM_ENABLE_VFP=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_FASTAPI=y + BR2_PACKAGE_PYTHON_UVICORN=y + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_CCACHE=y + BR2_CCACHE_DIR="/home/bubu/.buildroot-ccache" + """ + sample_scripts = ["tests/package/sample_python_fastapi.py"] + timeout = 60 + + def test_run(self): + self.login() + self.check_sample_scripts_exist() + cmd = "uvicorn sample_python_fastapi:app > /dev/null 2>&1 &" + + _, exit_code = self.emulator.run(cmd, timeout=self.timeout) + + # Give enough time for the uvicorn server to start up + time.sleep(30) + + cmd = "wget -q -O - http://127.0.0.1:8000/"
support/testing/tests/package/test_python_fastapi.py line 47
Quoted 10 lines
support/testing/tests/package/test_python_fastapi.py new file +10
-0+ output, exit_code = self.emulator.run(cmd, timeout=self.timeout) + self.assertEqual(exit_code, 0) + self.assertEqual(output[0], '{"message":"Hello World"}') + + def login(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv7", + kernel="builtin", + options=["-initrd", cpio_file]) + self.emulator.login()
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
In reply to ~bubuHello Marcus,
Quoted 11 lines · On Mon, 05 Feb 2024 18:25:10 +0100 ~bubu <[email protected]> wrote:
From: Marcus Hoffmann <[email protected]>
Add a runtime test for fastapi. Use uvicorn as the asgi server application as does the fastapi hello world example [1].
Fastapi depends on PydanticV2 now which is written in rust so we need to run the test on armv7.
[1] https://fastapi.tiangolo.com/tutorial/first-steps/
Signed-off-by Marcus Hoffmann <[email protected]>
It looks like this test is no longer passing in our CI:
https://gitlab.com/buildroot.org/buildroot/-/jobs/7391793123
Could you perhaps have a look?
Thanks a lot!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Hi,
Quoted 15 lines · Thomas Petazzoni via buildroot
Hello Marcus,
Quoted 10 lines · On Mon, 05 Feb 2024 18:25:10 +0100 ~bubu <[email protected]> wrote:
From: Marcus Hoffmann <[email protected]>
Add a runtime test for fastapi. Use uvicorn as the asgi server application as does the fastapi hello world example [1].
Fastapi depends on PydanticV2 now which is written in rust so we need to run the test on armv7.
Quoted 7 lines
Quoted 1 line
Signed-off-by Marcus Hoffmann <[email protected]>It looks like this test is no longer passing in our CI:
https://gitlab.com/buildroot.org/buildroot/-/jobs/7391793123Could you perhaps have a look?
This is caused by our pydantic-core install apparently being broken:
File "/root/sample_python_fastapi.py", line 1, in <module>
from fastapi import FastAPI
File "/usr/lib/python3.12/site-packages/fastapi/__init__.py", line 7,
in <module>
File "/usr/lib/python3.12/site-packages/fastapi/applications.py",
line 16, in <module>
File "/usr/lib/python3.12/site-packages/fastapi/routing.py", line 22,
in <module>
File "/usr/lib/python3.12/site-packages/fastapi/params.py", line 5,
in <module>
File "/usr/lib/python3.12/site-packages/fastapi/openapi/models.py",
line 4, in <module>
File "/usr/lib/python3.12/site-packages/fastapi/_compat.py", line 20,
in <module>
File "/usr/lib/python3.12/site-packages/fastapi/exceptions.py", line
3, in <module>
File "/usr/lib/python3.12/site-packages/pydantic/__init__.py", line
404, in __getattr__
File "/usr/lib/python3.12/importlib/__init__.py", line 90, inimport_module
File "/usr/lib/python3.12/site-packages/pydantic/main.py", line 29,
in <module>
ImportError: cannot import name 'PydanticUndefined' from 'pydantic_core' (unknown location)
People have hit that here through conda forge as well: https://github.com/pydantic/pydantic/issues/8429
James, can you take a look maybe? (We still use pydantic-v1, so I don't really have any idea about pydantic rust core build topics.
Marcus
Quoted 4 lines
Thanks a lot!
Thomas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Quoted 5 lines · On Mon, 22 Jul 2024 16:48:08 +0200 Marcus Hoffmann <[email protected]> wrote:
People have hit that here through conda forge as well:
https://github.com/pydantic/pydantic/issues/8429James, can you take a look maybe? (We still use pydantic-v1, so I don't really have any idea about pydantic rust core build topics.
We have some updates to pydantic-core/pydantic pending:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
(I was about to merge them)
Not sure if they are related / solve the issue?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Quoted 10 lines · Thomas Petazzoni
Quoted 5 lines · On Mon, 22 Jul 2024 16:48:08 +0200 Marcus Hoffmann <[email protected]> wrote:
People have hit that here through conda forge as well:
https://github.com/pydantic/pydantic/issues/8429James, can you take a look maybe? (We still use pydantic-v1, so I don't really have any idea about pydantic rust core build topics.
Quoted 8 lines
We have some updates to pydantic-core/pydantic pending:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/(I was about to merge them)
Not sure if they are related / solve the issue?
These setuptools/setuptools-rust/maturin patches might also help:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 6 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Quoted 5 lines · On Mon, 22 Jul 2024 10:11:31 -0600 James Hilliard <[email protected]>…
Quoted 5 lines
We have some updates to pydantic-core/pydantic pending:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 8 lines
Quoted 3 lines
(I was about to merge them)
Not sure if they are related / solve the issue?
These setuptools/setuptools-rust/maturin patches might also help:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
I applied them. But could we have some better answer than "might also help"? Like actually testing which thing is fixing what?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Quoted 13 lines · Thomas Petazzoni
Quoted 9 lines · On Mon, 22 Jul 2024 10:11:31 -0600 James Hilliard <[email protected]>…
Quoted 8 lines
We have some updates to pydantic-core/pydantic pending:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/(I was about to merge them)
Not sure if they are related / solve the issue?
Quoted 7 lines
Quoted 4 lines
These setuptools/setuptools-rust/maturin patches might also help:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/I applied them. But could we have some better answer than "might also help"? Like actually testing which thing is fixing what?
Well...those are all in the build dependency tree for pydantic-core, so I if there was something there that needed to be updated was thinking that might help.
Quoted 6 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Hi,
Quoted 20 lines · James Hilliard
Quoted 18 lines · Thomas Petazzoni
Quoted 13 lines · On Mon, 22 Jul 2024 10:11:31 -0600 James Hilliard <[email protected]>…
Quoted 8 lines
We have some updates to pydantic-core/pydantic pending:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/(I was about to merge them)
Not sure if they are related / solve the issue?
These setuptools/setuptools-rust/maturin patches might also help:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 6 lines
Quoted 2 lines
I applied them. But could we have some better answer than "might also help"? Like actually testing which thing is fixing what?
Well...those are all in the build dependency tree for pydantic-core, so I if there was something there that needed to be updated was thinking that might help.
It's still failing after all the bumps but reverting a14c862c08865e053d5fce90a0d0323b8f9e4bc0 "Create a .gitignore file in the CANONICAL_O directory" fixes it.
And also someone sent a mail to the list today complaining about a similar problem.
So the culprit seems to be https://github.com/PyO3/maturin/issues/1911
Marcus
Quoted 11 lines
Quoted 7 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH buildroot v2 2/2] support/testing: add fastapi runtime test
Quoted 35 lines · Marcus Hoffmann
Hi,
Quoted 20 lines · James Hilliard
Quoted 18 lines · Thomas Petazzoni
Quoted 13 lines · On Mon, 22 Jul 2024 10:11:31 -0600 James Hilliard <[email protected]>…
Quoted 8 lines
We have some updates to pydantic-core/pydantic pending:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/(I was about to merge them)
Not sure if they are related / solve the issue?
These setuptools/setuptools-rust/maturin patches might also help:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/Quoted 6 lines
Quoted 2 lines
I applied them. But could we have some better answer than "might also help"? Like actually testing which thing is fixing what?
Well...those are all in the build dependency tree for pydantic-core, so I if there was something there that needed to be updated was thinking that might help.
It's still failing after all the bumps but reverting
a14c862c08865e053d5fce90a0d0323b8f9e4bc0
"Create a .gitignore file in theCANONICAL_Odirectory" fixes it.
Quoted 7 lines
And also someone sent a mail to the list today complaining about a similar problem.
So the culprit seems to be https://github.com/PyO3/maturin/issues/1911
Hmm, so thinking this is maybe a similar issue to this poetry bug I had fixed a while back:
https://github.com/python-poetry/poetry-core/pull/611
Quoted 15 lines
Marcus
Quoted 11 lines
Quoted 7 lines
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot