Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #16946

Re: need help for my first python package

From Marc Haber <mh+debian-mentors@zugschlus.de>
Newsgroups linux.debian.devel.mentors, linux.debian.maint.python
Subject Re: need help for my first python package
Date 2025-06-24 10:40 +0200
Message-ID <L17m9-cMt6-1@gated-at.bofh.it> (permalink)
References <L0Vbj-cEHO-3@gated-at.bofh.it> <L0VuF-cEOw-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


Hi Soren, Hi lists,

On Mon, Jun 23, 2025 at 12:59:03PM -0700, Soren Stoutner wrote:
>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.

I hope that my questions are not too basic-beginnerish for the python 
mailing list. I think that having a simply package that contains a 
python program might help.

>Most Python packages are maintained in the Python team namespace, which is a
>very active team.  I would recommend you consider joining the team.

It is unlikely that I will package python modules in the forseeable 
future. I just happen to use the language.

>On Monday, June 23, 2025 12:38:08 PM Mountain Standard Time Marc Haber wrote:
>>          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

Thank you that's helpful.

I now have:

Build-Depends: debhelper-compat (=13),
     python3-all,
     dh-sequence-python3

and my debian/rules just has

%:
         dh $@ --buildsystem=pybuild

This seems to have solved the clean issue.

>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.

Now, what would I write in my pyproject.toml to achieve that?
>
>> (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.

Using dh-sequence-python3 seems to have solved that.

>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.

But my package doesn't publish a class. It is a self-contained program 
that could be written in any language and it happens to use an internal 
class hierarchy to support different pagers.

>> (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.

I have it in install and it looks like it does the right thing. That 
also means that my pyproject.toml doesn't tell the python side of the 
build to install the programs, which might be wrong.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421

Back to linux.debian.maint.python | Previous | NextPrevious in thread | Find similar


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