All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/3] utils/check-package: make check-package easier to run
@ 2024-10-09 14:14 Brandon Maier via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements Brandon Maier via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Brandon Maier via buildroot @ 2024-10-09 14:14 UTC (permalink / raw)
  To: buildroot; +Cc: Brandon Maier, Ricardo Martincoski

Try to make `utils/check-package` easier to run with Python's inline
script requirements. See the second patch for a detailed description.

We also attempt to document the requirements for running check-package.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
Changes in v2:
- fix utils/check-package to use Python v3.9 [Arnout]

---
Brandon Maier (3):
      docs/manual/adding-packages-tips: mention check-package requirements
      utils/check-package: add inline script requirements
      docs/manual/adding-packages-tips: mention uv

 docs/manual/adding-packages-tips.adoc | 17 +++++++++++++++++
 utils/check-package                   |  7 +++++++
 2 files changed, 24 insertions(+)
---
base-commit: 09964bc5c0f8b329cda6383a1297029354269da9
change-id: 20241008-check-package-requirements-8bcbcf2c276c

Best regards,
-- 
Brandon Maier <brandon.maier@collins.com>

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

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

* [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements
  2024-10-09 14:14 [Buildroot] [PATCH v2 0/3] utils/check-package: make check-package easier to run Brandon Maier via buildroot
@ 2024-10-09 14:14 ` Brandon Maier via buildroot
  2024-10-26 11:40   ` Thomas Petazzoni via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements Brandon Maier via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv Brandon Maier via buildroot
  2 siblings, 1 reply; 10+ messages in thread
From: Brandon Maier via buildroot @ 2024-10-09 14:14 UTC (permalink / raw)
  To: buildroot; +Cc: Brandon Maier, Ricardo Martincoski

Call out the requirements to run check-package and mention that Docker
can be used to run check-package without installing dependencies.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
 docs/manual/adding-packages-tips.adoc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/docs/manual/adding-packages-tips.adoc b/docs/manual/adding-packages-tips.adoc
index b04b42b51f92aaa2ba4dc759a3fe9db8b6ec5cfc..182204101413d879eb6aa4777d43abac5f48e8d5 100644
--- a/docs/manual/adding-packages-tips.adoc
+++ b/docs/manual/adding-packages-tips.adoc
@@ -64,6 +64,16 @@ The tool can also be used for packages in a br2-external:
 $ check-package -b /path/to/br2-ext-tree/package/my-package/*
 ----
 
+The +check-package+ script requires you install +shellcheck+ v0.7.1 and the
+Python PyPi packages +flake8+ and +python-magic+. You can use a different
+version of ShellCheck, but you may see warnings from unrelated files.
+
+If you have Docker or Podman you can run check-package without installing dependencies:
+
+----
+$ ./utils/docker-run ./utils/check-package
+----
+
 [[testing-package]]
 ==== How to test your package
 

-- 
2.46.0

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

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

* [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements
  2024-10-09 14:14 [Buildroot] [PATCH v2 0/3] utils/check-package: make check-package easier to run Brandon Maier via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements Brandon Maier via buildroot
@ 2024-10-09 14:14 ` Brandon Maier via buildroot
  2024-10-26 11:41   ` Thomas Petazzoni via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv Brandon Maier via buildroot
  2 siblings, 1 reply; 10+ messages in thread
From: Brandon Maier via buildroot @ 2024-10-09 14:14 UTC (permalink / raw)
  To: buildroot; +Cc: Brandon Maier, Ricardo Martincoski

The check-package tool requires some PyPi package to be installed before
it can run. This is typically done by manually installing them into the
user's global Python environment or setting up a virtual environment,
then manually installing each dependency.

Python recently defined a format for managing script dependencies as
inline metadata[1]. This can be used with the `uv` tool to run a Python
script and automatically install the minimum required version of Python
and PyPi dependencies.

With this change, it's now possible to run check-package with

  uv run -s ./utils/check-package

Note that, because check-package does not have the '.py' file extension
we must specify the `-s` or `--script` argument. That argument was added
very recently in release 0.4.19[2].

I set the minimum python to 3.9 as that is the oldest version still
supported[3]. I verified 3.9 works by running

  uv run -p 3.9 -s ./utils/check-package `git ls-tree -r --name-only HEAD` --ignore-list=.checkpackageignore

[1] https://packaging.python.org/en/latest/specifications/inline-script-metadata/#script-type
[2] https://github.com/astral-sh/uv/releases/tag/0.4.19
[3] https://devguide.python.org/versions/

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
Changes in v2:
- fix utils/check-package to use Python v3.9 [Arnout]
---
 utils/check-package | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/utils/check-package b/utils/check-package
index 872e66c126b8ec4d5207235d69f0c02ad1757a06..6a5e89daa3ce4f173cb21beb75122bcd40b80123 100755
--- a/utils/check-package
+++ b/utils/check-package
@@ -1,5 +1,12 @@
 #!/usr/bin/env python3
 # See utils/checkpackagelib/readme.txt before editing this file.
+# /// script
+# requires-python = ">=3.9"
+# dependencies = [
+#     "flake8",
+#     "python-magic",
+# ]
+# ///
 
 import argparse
 import inspect

-- 
2.46.0

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

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

* [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv
  2024-10-09 14:14 [Buildroot] [PATCH v2 0/3] utils/check-package: make check-package easier to run Brandon Maier via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements Brandon Maier via buildroot
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements Brandon Maier via buildroot
@ 2024-10-09 14:14 ` Brandon Maier via buildroot
  2024-10-26 11:44   ` Thomas Petazzoni via buildroot
  2 siblings, 1 reply; 10+ messages in thread
From: Brandon Maier via buildroot @ 2024-10-09 14:14 UTC (permalink / raw)
  To: buildroot; +Cc: Brandon Maier, Ricardo Martincoski

Mention that `uv` can be used to run check-package without installing
PyPi packages.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
---
 docs/manual/adding-packages-tips.adoc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/manual/adding-packages-tips.adoc b/docs/manual/adding-packages-tips.adoc
index 182204101413d879eb6aa4777d43abac5f48e8d5..98dfcd8988521a0a9d0739d39704b36447a77485 100644
--- a/docs/manual/adding-packages-tips.adoc
+++ b/docs/manual/adding-packages-tips.adoc
@@ -74,6 +74,13 @@ If you have Docker or Podman you can run check-package without installing depend
 $ ./utils/docker-run ./utils/check-package
 ----
 
+It can also be run directly with +uv+ version 0.4.19 or later, however you will
+still need to manually install ShellCheck.
+
+----
+$ uv run -s ./utils/check-package
+----
+
 [[testing-package]]
 ==== How to test your package
 

-- 
2.46.0

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

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

* Re: [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements Brandon Maier via buildroot
@ 2024-10-26 11:40   ` Thomas Petazzoni via buildroot
  2024-11-11 10:31     ` Peter Korsgaard
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-10-26 11:40 UTC (permalink / raw)
  To: Brandon Maier via buildroot; +Cc: Brandon Maier, Ricardo Martincoski

On Wed, 09 Oct 2024 14:14:56 +0000
Brandon Maier via buildroot <buildroot@buildroot.org> wrote:

> Call out the requirements to run check-package and mention that Docker
> can be used to run check-package without installing dependencies.
> 
> Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> ---
>  docs/manual/adding-packages-tips.adoc | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Applied to master after rewording the part that bothered Arnout.

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] 10+ messages in thread

* Re: [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements Brandon Maier via buildroot
@ 2024-10-26 11:41   ` Thomas Petazzoni via buildroot
  2024-11-11 10:31     ` Peter Korsgaard
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-10-26 11:41 UTC (permalink / raw)
  To: Brandon Maier via buildroot; +Cc: Brandon Maier, Ricardo Martincoski

On Wed, 09 Oct 2024 14:14:57 +0000
Brandon Maier via buildroot <buildroot@buildroot.org> wrote:

> The check-package tool requires some PyPi package to be installed before
> it can run. This is typically done by manually installing them into the
> user's global Python environment or setting up a virtual environment,
> then manually installing each dependency.
> 
> Python recently defined a format for managing script dependencies as
> inline metadata[1]. This can be used with the `uv` tool to run a Python
> script and automatically install the minimum required version of Python
> and PyPi dependencies.
> 
> With this change, it's now possible to run check-package with
> 
>   uv run -s ./utils/check-package
> 
> Note that, because check-package does not have the '.py' file extension
> we must specify the `-s` or `--script` argument. That argument was added
> very recently in release 0.4.19[2].
> 
> I set the minimum python to 3.9 as that is the oldest version still
> supported[3]. I verified 3.9 works by running
> 
>   uv run -p 3.9 -s ./utils/check-package `git ls-tree -r --name-only HEAD` --ignore-list=.checkpackageignore
> 
> [1] https://packaging.python.org/en/latest/specifications/inline-script-metadata/#script-type
> [2] https://github.com/astral-sh/uv/releases/tag/0.4.19
> [3] https://devguide.python.org/versions/
> 
> Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> ---
> Changes in v2:
> - fix utils/check-package to use Python v3.9 [Arnout]
> ---
>  utils/check-package | 7 +++++++
>  1 file changed, 7 insertions(+)

In fact, I had applied an earlier version, but I fixed the 3.8 -> 3.9
issue.

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] 10+ messages in thread

* Re: [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv
  2024-10-09 14:14 ` [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv Brandon Maier via buildroot
@ 2024-10-26 11:44   ` Thomas Petazzoni via buildroot
  2024-10-28 13:53     ` Brandon Maier via buildroot
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-10-26 11:44 UTC (permalink / raw)
  To: Brandon Maier via buildroot; +Cc: Brandon Maier, Ricardo Martincoski

On Wed, 09 Oct 2024 14:14:58 +0000
Brandon Maier via buildroot <buildroot@buildroot.org> wrote:

> +----
> +$ uv run -s ./utils/check-package
> +----

-s doesn't exist here:

🐧  uv run -s ./utils/check-package 
error: unexpected argument '-s' found

Usage: uv run [OPTIONS] <COMMAND>

For more information, try '--help'.

I have:

🐧  uv --version
uv 0.4.10

Thanks,

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

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

* Re: [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv
  2024-10-26 11:44   ` Thomas Petazzoni via buildroot
@ 2024-10-28 13:53     ` Brandon Maier via buildroot
  0 siblings, 0 replies; 10+ messages in thread
From: Brandon Maier via buildroot @ 2024-10-28 13:53 UTC (permalink / raw)
  To: Thomas Petazzoni, Brandon Maier via buildroot; +Cc: Ricardo Martincoski

Hi Thomas,

On Sat Oct 26, 2024 at 11:44 AM UTC, Thomas Petazzoni via buildroot wrote:
> On Wed, 09 Oct 2024 14:14:58 +0000
> Brandon Maier via buildroot <buildroot@buildroot.org> wrote:
>
> > +----
> > +$ uv run -s ./utils/check-package
> > +----
>
> -s doesn't exist here:
>
> 🐧  uv run -s ./utils/check-package
> error: unexpected argument '-s' found
>
> Usage: uv run [OPTIONS] <COMMAND>
>
> For more information, try '--help'.
>
> I have:
>
> 🐧  uv --version
> uv 0.4.10

I call this out in the patch documentation, `uv` version 0.4.19 or later
is required. The '-s' flag was added only recently.

The other option would be to rename `./utils/check-package` to have the
'.py' extension. The '-s' is only required to tell `uv` it's a Python
script.

Thanks for reviewing my series!
Brandon
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements
  2024-10-26 11:40   ` Thomas Petazzoni via buildroot
@ 2024-11-11 10:31     ` Peter Korsgaard
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2024-11-11 10:31 UTC (permalink / raw)
  To: buildroot

On 10/26/24 13:40, Thomas Petazzoni via buildroot wrote:
> On Wed, 09 Oct 2024 14:14:56 +0000
> Brandon Maier via buildroot <buildroot@buildroot.org> wrote:
> 
>> Call out the requirements to run check-package and mention that Docker
>> can be used to run check-package without installing dependencies.
>>
>> Signed-off-by: Brandon Maier <brandon.maier@collins.com>
>> ---
>>   docs/manual/adding-packages-tips.adoc | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
> 
> Applied to master after rewording the part that bothered Arnout.

Committed to 2024.02.x and 2024.08.x, thanks.

-- 
Bye, Peter Korsgaard

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

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

* Re: [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements
  2024-10-26 11:41   ` Thomas Petazzoni via buildroot
@ 2024-11-11 10:31     ` Peter Korsgaard
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2024-11-11 10:31 UTC (permalink / raw)
  To: buildroot

On 10/26/24 13:41, Thomas Petazzoni via buildroot wrote:
> On Wed, 09 Oct 2024 14:14:57 +0000
> Brandon Maier via buildroot <buildroot@buildroot.org> wrote:
> 
>> The check-package tool requires some PyPi package to be installed before
>> it can run. This is typically done by manually installing them into the
>> user's global Python environment or setting up a virtual environment,
>> then manually installing each dependency.
>>
>> Python recently defined a format for managing script dependencies as
>> inline metadata[1]. This can be used with the `uv` tool to run a Python
>> script and automatically install the minimum required version of Python
>> and PyPi dependencies.
>>
>> With this change, it's now possible to run check-package with
>>
>>    uv run -s ./utils/check-package
>>
>> Note that, because check-package does not have the '.py' file extension
>> we must specify the `-s` or `--script` argument. That argument was added
>> very recently in release 0.4.19[2].
>>
>> I set the minimum python to 3.9 as that is the oldest version still
>> supported[3]. I verified 3.9 works by running
>>
>>    uv run -p 3.9 -s ./utils/check-package `git ls-tree -r --name-only HEAD` --ignore-list=.checkpackageignore
>>
>> [1] https://packaging.python.org/en/latest/specifications/inline-script-metadata/#script-type
>> [2] https://github.com/astral-sh/uv/releases/tag/0.4.19
>> [3] https://devguide.python.org/versions/
>>
>> Signed-off-by: Brandon Maier <brandon.maier@collins.com>
>> ---
>> Changes in v2:
>> - fix utils/check-package to use Python v3.9 [Arnout]
>> ---
>>   utils/check-package | 7 +++++++
>>   1 file changed, 7 insertions(+)
> 
> In fact, I had applied an earlier version, but I fixed the 3.8 -> 3.9
> issue.

Committed to 2024.02.x and 2024.08.x, thanks.

-- 
Bye, Peter Korsgaard

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

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

end of thread, other threads:[~2024-11-11 10:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 14:14 [Buildroot] [PATCH v2 0/3] utils/check-package: make check-package easier to run Brandon Maier via buildroot
2024-10-09 14:14 ` [Buildroot] [PATCH v2 1/3] docs/manual/adding-packages-tips: mention check-package requirements Brandon Maier via buildroot
2024-10-26 11:40   ` Thomas Petazzoni via buildroot
2024-11-11 10:31     ` Peter Korsgaard
2024-10-09 14:14 ` [Buildroot] [PATCH v2 2/3] utils/check-package: add inline script requirements Brandon Maier via buildroot
2024-10-26 11:41   ` Thomas Petazzoni via buildroot
2024-11-11 10:31     ` Peter Korsgaard
2024-10-09 14:14 ` [Buildroot] [PATCH v2 3/3] docs/manual/adding-packages-tips: mention uv Brandon Maier via buildroot
2024-10-26 11:44   ` Thomas Petazzoni via buildroot
2024-10-28 13:53     ` Brandon Maier 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.