Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #16945
| Path | csiph.com!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Soren Stoutner <soren@debian.org> |
| Newsgroups | linux.debian.devel.mentors, linux.debian.maint.python |
| Subject | Re: need help for my first python package |
| Date | Mon, 23 Jun 2025 22:00:01 +0200 |
| Message-ID | <L0VuF-cEOw-1@gated-at.bofh.it> (permalink) |
| References | <L0Vbj-cEHO-3@gated-at.bofh.it> |
| X-Mailbox-Line | From debian-mentors-request@lists.debian.org Mon Jun 23 19:59:34 2025 |
| Old-Return-Path | <soren@debian.org> |
| X-Amavis-Spam-Status | No, score=-115.916 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, BODY_8BITS=1.5, DKIMWL_WL_HIGH=-2.907, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LDO_WHITELIST=-5, PGPSIGNATURE=-5, RCVD_IN_DNSWL_MED=-2.3, UNPARSEABLE_RELAY=0.001, USER_IN_DKIM_WELCOMELIST=-0.01, USER_IN_DKIM_WHITELIST=-100] autolearn=ham autolearn_force=no |
| Organization | Debian |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWIg4F7bGiws7ReTkyy kYoXFRrd6/4yMA0PAAACaklEQVQ4y22TwXabMBBFJaPuNZGSNZZp1uhM6BpkJeu4VFk3bsL/f0Lf CHC6qHyOgbl68zTDoIwaVfh3tUopTUGpbFToDiFnY9IY2oMAZYMiS4R9SfbSXepSS5EcFAa/muIU aRj8mkoUqrEraFzhYegBmqig0LyCIyM8DAwPlpBqmJVYaD2UeWZ3abVjsqKIojg+hY4omsyIcNSi qIBM6jJWOveS6kvBeVvHJ+VYzJUW88RmA12UiBx3HEcUMRuzIZI6tBQovTrPclNB3AuUXoXvs0XY C3B2baJpW4Dn2ZpVMInCirkxoyhM1qpK5nFrO65QvCrCqql2DyPgvm94iMQz5/PmISuEotxQGMD5 M5G1N9CjXJ5HQH96BZG2xx6AzejYZccxT4Re3Zr4bPKkCcGcz5Or3dVEABkAUY/znnVcQVVkrXVU vomoEJFe7x4nQuaZmZELL6qnXZGIB5YV/Q2IogtSmyNybEcBX2+QCLOAQYm+gmoORUrYzV7dc6R2 T1WPm45oVEQqsjtoIovHyTmcyxMhVVxTqapomZyLlAmTKC9AmjgamXXGZo+epNrXO3wGGiPRHbKL FnMy2RRgRb1gzFXXGjhICp8wqaTtdtyQH6nWTfkatJvJJoUCbOjSC7wR9/naEVognxrOFdLh7Ugx QpA/0QT4pRV0+u2dqsXD5y9EBDjVAJS3ZZLxmZblgmsU8x7mBeCKg48Py7WU2IiH1epbEbC8K9Ms y0cpcySVUcdQVrBY+rEsv+XpYgFKXT8B3v2yATxv8fKK2EfC358tsIMLYqfD401xA0j1EY4P/wWf IbhlOWyBv4OQsywBM8MAAAAAAElFTkSuQmCC |
| MIME-Version | 1.0 |
| Content-Type | multipart/signed; boundary="nextPart2876582.BEx9A2HvPv"; micalg="pgp-sha512"; protocol="application/pgp-signature" |
| X-Debian-User | soren |
| X-Mailing-List | <debian-mentors@lists.debian.org> archive/latest/115942 |
| List-ID | <debian-mentors.lists.debian.org> |
| List-URL | <https://lists.debian.org/debian-mentors/> |
| List-Archive | https://lists.debian.org/msgid-search/2272014.NgBsaNRSFp@soren-desktop |
| Approved | robomod@news.nic.it |
| Lines | 195 |
| Sender | robomod@news.nic.it |
| X-Original-Cc | Marc Haber <mh+debian-mentors@zugschlus.de>, Debian Python <debian-python@lists.debian.org> |
| X-Original-Date | Mon, 23 Jun 2025 12:59:03 -0700 |
| X-Original-Message-ID | <2272014.NgBsaNRSFp@soren-desktop> |
| X-Original-References | <aFmtINz7LgufLc-9@torres.zugschlus.de> |
| Xref | csiph.com linux.debian.devel.mentors:47666 linux.debian.maint.python:16945 |
Cross-posted to 2 groups.
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Marc,
I am CCing debian-python as that mailing list often fields Python related
packaging questions, and you are more likely to get good Python related
responses there than debian-mentors.
Most Python packages are maintained in the Python team namespace, which is a
very active team. I would recommend you consider joining the team.
https://salsa.debian.org/python-team/tools/python-modules/blob/master/
policy.rst
I don’t really know very much Python, but I have ended up maintaining a lot of
Python packages, mostly by accident. So, take everything I say here with a
grain of salt and I am happy to have anyone on debian-python correct me if I
am wrong.
On Monday, June 23, 2025 12:38:08 PM Mountain Standard Time Marc Haber wrote:
> Hi,
>
> I am re-working my first Debian package, console-log, which I wrote back
> two decades ago. The rewrite is going to be in python, and I have never
> packaged python code before. The code is not yet in git.
>
> What I have:
> .
> ├── debian
> │ ├── changelog
> │ ├── control
> │ ├── copyright
> │ ├── rules
> │ └── source
> │ └── format
> ├── pyproject.toml
> └── src
> ├── console_log
> │ ├── base.py
> │ ├── config.py
> │ ├── __init__.py
> │ └── pagers
> │ ├── __init__.py
> │ └── less.py
> ├── console-log.generator
> └── do_console_log
>
> console-log.generator will go to
> /usr/lib/systemd/system-generators; do_console_log ends up in
> /usr/share/console-log. Both programs are not supposed to be called from
> a user. do_console_log imports from console-log/pagers. There will be
> other modules at the side of less.py. I am moving both from
> debian/console-log.install.
>
> Google tells me that I am supposed to use dh-python and pyproject. Here
> is what I coughed up:
>
> [206/6622]mh@swivel:~/packages/console-log/console-log (wip-systemd *+%) $
cat
> debian/rules #!/usr/bin/make -f
>
> %:
> dh $@ --with python3 --buildsystem=pybuild
“--with python3” is considered deprecated syntax, although it still works.
The replacement is to build-depend on “dh-sequence-python3”. Here is an
example:
https://salsa.debian.org/python-team/packages/python-construct-classes/-/blob/
debian/master/debian/control?ref_type=heads#L7
> [207/6622]mh@swivel:~/packages/console-log/console-log (wip-systemd *+%) $
cat
> pyproject.toml [build-system]
> requires = ["setuptools>=61.0", "wheel"]
> build-backend = "setuptools.build_meta"
>
> [project]
> name = "console-log"
> version = "2.0"
> description = "Console Log - Displays Logs on Virtual Consoles"
> authors = [
> { name = "Marc Haber", email = "mh+debian-packages@zugschlus.de" }
> ]
> license = "GPL-2.0"
> requires-python = ">=3.7"
> dependencies = [
> ]
>
> [tool.setuptools.packages.find]
> where = ["src"]
> [208/6623]mh@swivel:~/packages/console-log/console-log (wip-systemd *+%) $
>
> However, building this does not seem to give the desired results:
>
> (1)
> My package contains /usr/lib/python3/console_log-2.0.dist-info, and
> lintian doesn't like that. How can I preent that from being installed?
Nothing should be installed directly into /usr/lib/python3/. Rather, all your
Python modules and dist-info should be installed into /usr/lib/python3/dist-
packages.
> (2)
> Additionally, the package doesn't build twice in a row since .pybuild
> and build directories are generated and not cleaned up on package clean.
>
> Am I supposed to clean those two directories up in dh_override_auto_clean?
Not typically. I have never had to do that with a Python package. Perhaps
there is something you are missing that someone on debian-python can point
out.
From a big picture, if your source package is only building one binary
package, you can include the following in debian/rules and a lot of the
packaging is automatic:
export PYBUILD_NAME=package-class-name
This generates a binary package named python3-package-class-name and puts
things in the right place. For example:
https://salsa.debian.org/python-team/packages/python-construct-classes/-/blob/
debian/master/debian/rules?ref_type=heads#L3
There are ways to make this work if you have more than one binary package, but
I find those things to be a bit complex. In that case, you can leave out the
PYBUILD_NAME variable and use debian/*.install files.
> (3)
> Is it okay to move the two binaries from src/ to the respective
> directories in the package via debian/console-log.install or, how would I
> tell setuptools to install those files to their targets?
Any way that works is probably fine. In looking at other packages, I have
seen it done with debian/*.install or in debian/rules with
execute_after_dh_auto_install. Note that if you go the PYBUILD_NAME route I
think you need to use debian/rules.
--
Soren Stoutner
soren@debian.org
Back to linux.debian.maint.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: need help for my first python package Soren Stoutner <soren@debian.org> - 2025-06-23 22:00 +0200 Re: need help for my first python package Marc Haber <mh+debian-mentors@zugschlus.de> - 2025-06-24 10:40 +0200
csiph-web