From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [PULL 03/19] .dir-locals: include QEMU code in PYTHONPATH
Date: Thu, 12 Nov 2026 19:26:03 +0000 [thread overview]
Message-ID: <87o6btc0ms.fsf@draig.linaro.org> (raw)
In-Reply-To: <CAFEAcA8OOMbrPqhDJ3=K3m5fnfqAQg+Eio46=krPk+PkaLAXeQ@mail.gmail.com> (Peter Maydell's message of "Thu, 12 Nov 2026 17:52:43 +0000")
Peter Maydell <peter.maydell@linaro.org> writes:
> On Thu, 12 Nov 2026 at 17:19, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> Markus Armbruster <armbru@redhat.com> writes:
>>
>> > Peter Maydell <peter.maydell@linaro.org> writes:
>> >
>> >> On Fri, 23 Oct 2026 at 19:06, Alex Bennée <alex.bennee@linaro.org> wrote:
>> >>>
>> >>> When editing python code the linters tools have a hard time with our
>> >>> imports as they can't be found. To ease this we can expand a
>> >>> PYTHONPATH in .dir-locals so at least Emacs users can have less
>> >>> warnings in their editor.
>> >>>
>> >>> I still get complaints from python-mypy about missing library stubs
>> >>> that mean it can't do proper type analysis though.
>
>> >> With this change, emacs now complains and prompts for input every
>> >> time I open a Python file inside the QEMU source tree:
>> >>
>> >> ===begin===
>> >> The local variables list in /home/pm215/qemu/
>> >> or .dir-locals.el contains values that may not be safe (*).
>> >>
>> >> Do you want to apply it? You can type
>> >> y -- to apply the local variables list.
>> >> n -- to ignore the local variables list.
>> >> ! -- to apply the local variables list, and permanently mark these
>> >> values (*) as safe (in the future, they will be set
>> >> automatically.)
>>
>> It should mark them as safe for this particular directory, not generally
>> for setting PYTHONPATH.
>>
>> >> i -- to ignore the local variables list, and permanently mark these
>> >> values (*) as ignored
>> >>
>> >> * eval : (when-let* ((root (locate-dominating-file default-directory
>> >> ".dir-locals.el"))) (setq-local process-environment (copy-sequence
>> >> process-environment)) (setenv "PYTHONPATH" (concat (expand-file-name
>> >> "python" root) ":" (expand-file-name "tests/functional" root))))
>> >> ===endit===
>> >>
>> >> The commit messages says "so Emacs users can have less warnings"
>> >> but from my POV this is "more warnings" (and previously I didn't
>> >> notice any warnings at all).
>> >
>> > Same here.
>> >
>> > What exactly was the problem this patch tried to solve?
>>
>> It ensures the python lsp's don't complain about invalid imports because
>> they don't have visibility of the PYTHONPATH set by ./run
>
> That's a bit unfortunate, but I think it's a lot less bad
> than emacs complaining every single time you open a python file.
If you trust a project not to do bad things you can set:
safe-local-variable-directories
which for me is set to:
("/home/alex/lsrc/qemu.git/")
But I take your point. I'll figure out how to do this without
.dir-locals and send a revert documenting it.
>
> -- PMM
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2026-11-12 19:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 18:05 [PULL 00/19] testing updates (tcg, gdbstub) Alex Bennée
2026-10-23 18:05 ` [PULL 01/19] tests/functional: test_acpi_bits requires TCG Alex Bennée
2026-10-23 18:05 ` [PULL 02/19] tests/tcg: fix buffer overflow in multiarch/linux/linux-sigrtminmax Alex Bennée
2026-10-23 18:05 ` [PULL 03/19] .dir-locals: include QEMU code in PYTHONPATH Alex Bennée
2026-11-12 11:06 ` Peter Maydell
2026-11-12 12:19 ` Markus Armbruster
2026-11-12 17:19 ` Alex Bennée
2026-11-12 17:52 ` Peter Maydell
2026-11-12 19:26 ` Alex Bennée [this message]
2026-10-23 18:05 ` [PULL 04/19] meson: move gdb detection into the top level build file Alex Bennée
2026-10-23 18:05 ` [PULL 05/19] tests/functional: allow tuxrun tests to be passed "accel" Alex Bennée
2026-10-23 18:05 ` [PULL 06/19] tests/functional: split x86_64 tuxrun into tcg and kvm run Alex Bennée
2026-10-23 18:05 ` [PULL 07/19] tests/functional: update x86_64 tuxrun images Alex Bennée
2026-10-23 18:05 ` [PULL 08/19] tests/guest-debug: convert gdb_cmd to an array Alex Bennée
2026-10-23 18:05 ` [PULL 09/19] tests/guest-debug: convert cmd to an qemu_cmd array Alex Bennée
2026-10-23 18:05 ` [PULL 10/19] tests/guest-debug: add --kargs option to run-test Alex Bennée
2026-10-23 18:05 ` [PULL 11/19] tests/guest-debug: add --symbols " Alex Bennée
2026-10-23 18:05 ` [PULL 12/19] tests/functional: teach tuxrun about launching gdb tests Alex Bennée
2026-10-23 18:05 ` [PULL 13/19] tests/functional: add tuxrun kvm gdb test for x86_64 Alex Bennée
2026-10-23 18:05 ` [PULL 14/19] tests/functional: split aarch64 tuxrun into tcg and kvm run Alex Bennée
2026-10-23 18:05 ` [PULL 15/19] tests/functional: update arm64 tuxrun images Alex Bennée
2026-10-23 18:05 ` [PULL 16/19] tests/functional: add tuxrun kvm gdb test for arm64 Alex Bennée
2026-10-23 18:05 ` [PULL 17/19] tests/functional: split s390x tuxrun into tcg and kvm run Alex Bennée
2026-10-23 18:05 ` [PULL 18/19] tests/functional: update s390x tuxrun images Alex Bennée
2026-10-23 18:05 ` [PULL 19/19] tests/functional: add tuxrun kvm gdb test for s390x Alex Bennée
2026-10-24 15:12 ` [PULL 00/19] testing updates (tcg, gdbstub) Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o6btc0ms.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.