Skip to content

Allow configuring the Python interpreter - #757

Merged
fsundermeyer merged 2 commits into
openSUSE:4.0.beta16from
KucharczykL:nix-support
Sep 15, 2026
Merged

fsundermeyer merged 2 commits into
openSUSE:4.0.beta16from
KucharczykL:nix-support

Conversation

@KucharczykL

Copy link
Copy Markdown

Hi, this PR make it possible to set the Python interpreter using ~/.config/daps/dapsrc or in DC file. Environment variable is not respected which seems to be true for all DAPS configuration options for some reason.

PYTHON=".venv/bin/python"

I did not add --python or any similar command-line arguments.

This makes it easier to package for systems like NixOS, or to make it easy to use different than system Python in case something breaks (case in point: Tumbleweed recently removed the python311-lxml package, breaking DAPS, see https://suse.slack.com/archives/C02DEAP3U5P/p1788274848540109).

I tested building on Tumbleweed and NixOS. There's a package using this change in https://build.suse.de/package/show/home:LKucharczyk:branches:Documentation:Tools/daps but currently blocked.

The Python helper scripts (daps-xmlwellformed, getentityname.py and
validate-tables.py) are currently always invoked directly, so they run
with the interpreter from their shebang line. That interpreter needs the
lxml module, which is not necessarily the case for the system Python.

Add a PYTHON config key that selects the interpreter used for these
scripts. The default is empty, in which case the scripts are invoked
directly as before, so the behaviour is unchanged for existing
installations and for packages that pin the shebang line.

PYTHON is part of VARLIST, so it uses the regular config precedence and
is exported to the makefiles like the other keys.
@fsundermeyer
fsundermeyer marked this pull request as draft September 8, 2026 14:18
@fsundermeyer

Copy link
Copy Markdown
Member

Thanks a lot Lukas!

I am not sure what to make of this--it is unobtrusive, but somewhat "hackish".
IMHO the problems you are describing for Tumbleweed and NixOS look like packaging problems to me that should be resolved on a packaging level, not within the code. (The problem you are describing for Tumbleweed can be solved via spec file. the update will be published soon with 4.0~beta16).

@tomschr What is your take her?

BTW: The fact that environment variables are largely ignored is on purpose, Also somewhat hackish, I probably should re-visit this.

@tomschr

tomschr commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

I was also unsure, so I asked Gemini and let them review this PR. Here is what it said:

While I understand the perspective that this is a "packaging problem," I believe this change provides a necessary escape hatch for users and developers. Here's why:

  1. User Empowerment: It allows users to immediately work around system-level issues (like the Tumbleweed lxml problem mentioned in the PR) without waiting for a package fix.
  2. Developer Flexibility: It makes it much easier for developers to use DAPS with Python virtual environments (venv), which is a standard development practice.
  3. Improved Portability: It helps DAPS run on non-standard systems like NixOS, where hardcoded shebangs are often problematic.

The solution is not "hackish." It's a common and pragmatic approach for tools that depend on external scripts. By making it a configurable option that defaults to the old behavior, the change is unobtrusive to existing users.

In my opinion, this PR makes DAPS more robust and developer-friendly. I would recommend leaving a comment in support of merging it.

@KucharczykL

Copy link
Copy Markdown
Author

I am not sure what to make of this--it is unobtrusive, but somewhat "hackish". IMHO the problems you are describing for Tumbleweed and NixOS look like packaging problems to me that should be resolved on a packaging level, not within the code. (The problem you are describing for Tumbleweed can be solved via spec file. the update will be published soon with 4.0~beta16).

In the end the packager will always have to make changes to the software to adapt it to the particular system but this makes it easier.

What exactly do you consider hackish? I can try to fix it if needed.

The assembly resource validation rule in make/assembly2db.mk still
invoked daps-xmlwellformed directly, bypassing the PYTHON config key
introduced for the other Python helper script call sites.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@KucharczykL
KucharczykL marked this pull request as ready for review September 15, 2026 13:54
@fsundermeyer
fsundermeyer merged commit 2ef6b31 into openSUSE:4.0.beta16 Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants