Control: tags 1070794 wontfix
# Solution options provided below.
# (BTS processing instructions have to go in the top)

On Thu, 9 May 2024 09:20:01 +0000 Hang Lei <hang...@microsoft.com> wrote:
Package: debhelper
Version: 13.11.10

Dear Maintainer,

I'm writing to discuss a change introduced in debhelper 13.10.10: this 
PR<https://salsa.debian.org/debian/debhelper/-/merge_requests/120> fixes 
#1048890<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1048890> by deleting the 
__pycache__ folder.

[...]

Considering the impact on performance, I believe that removing the __pycache__ 
directory may not be beneficial. Could we explore the possibility of reverting 
this change?

Thanks for your time and consideration.

Related issue: [Packaging] Add Ubuntu 24.04 Noble Numbat support by bebound * Pull 
Request #28888 * Azure/azure-cli 
(github.com)<https://github.com/Azure/azure-cli/pull/28888>

Cheers,
Hang

Hi Hang

Thanks for reaching out. :)

No Debian package ships `.pyc` files directly in the `.deb`. Instead they generate them during installation. I am not super well-versed in this area, so I cannot be fully helpful on all of the rationales behind the decision to byte-compile on install (and clean up on removal). You would have to ask the Debian Python Team / Debian Python Policy maintainers if that rationale is important. As I recall, it involves (or involved) cases like people running python code as root, reproducible builds, multiple interpreter support (including embedded interpreters) and special cases in that ballpark.

What I do know, is that this byte compilation for Debian packages is generally triggered by using `dh_python3` from the `dh-python` package for python3 files[1]. The `dh_python3` helper is *not* enabled by default. With modern debhelper versions adding `dh-sequence-python3` to Build-Depends would do. Older versions of `debhelper` would require a `dh ... --with python3`.

Since the package in question does not seem to install the python files in the "standard" locations (I noted an `/opt` in the GitHub PR), you may have to consult the `dh-python` documentation for having it set up the recompilation correctly. See https://salsa.debian.org/python-team/tools/dh-python/-/blob/master/dh_python3.rst?ref_type=heads (heading "private dirs" seems relevant)

That documentation also has sections for exceptions to the byte compilation via the `bcep` files. Like if certain files can only be compiled with a given version of python (etc.).

This is the only solution I can offer you with the current Python landscape in Debian. If you want to change that landscape, I am afraid I will have to ask you to raise the concerns with the Python team and they are the authority on this topic. Because it is not my jurisdiction and I cannot offer to be middleman in challenging the landscape, I have tagged this bug as `wontfix`, since it is the closest tag we have for this case.

I hope it was helpful and enable you to restore the original performance.

Best regards,
Niels

[1]: Historically, there was also a `dh_python`, which may be relevant if you still support python2 and Debian/Ubuntu releases that still have `python2`. That is probably so old that it only works with
`dh ... --with python`.

Reply via email to