Title: Python packaging tools can't resolve the package metadata without `libsystemd` · Issue #167 · systemd/python-systemd · GitHub
Open Graph Title: Python packaging tools can't resolve the package metadata without `libsystemd` · Issue #167 · systemd/python-systemd
X Title: Python packaging tools can't resolve the package metadata without `libsystemd` · Issue #167 · systemd/python-systemd
Description: I ran into this whilst trying to move my project to replace poetry with uv. One interesting property of uv, is that it creates a lockfile that works for all platforms. This means that even if systemd-python is only installed on Linux ("s...
Open Graph Description: I ran into this whilst trying to move my project to replace poetry with uv. One interesting property of uv, is that it creates a lockfile that works for all platforms. This means that even if syste...
X Description: I ran into this whilst trying to move my project to replace poetry with uv. One interesting property of uv, is that it creates a lockfile that works for all platforms. This means that even if syste...
Opengraph URL: https://github.com/systemd/python-systemd/issues/167
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python packaging tools can't resolve the package metadata without `libsystemd`","articleBody":"I ran into this whilst trying to move my project to replace `poetry` with `uv`.\n\nOne interesting property of `uv`, is that it creates a lockfile that works for all platforms. This means that even if `systemd-python` is only installed on Linux (`\"systemd-python\u003e=231; sys_platform == 'linux'\"` in the dependencies), it *needs* to be able to resolve the package metadata.\n\nThe problem is, as far as I can tell, `mesonpy` always run the meson build, even just for resolving the package metadata. And because the current meson build will hard-fail if libsystemd isn't available, regardless of the platform, it makes generating/updating the `uv` lockfile impossible on non-linux platforms.\n\n```\n❯ uv sync\n × Failed to build `systemd-python==235`\n ├─▶ The build backend returned an error\n ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)\n\n [stderr]\n Cannot find libsystemd or libsystemd-journal:\n\n Package libsystemd was not found in the pkg-config search path.\n Perhaps you should add the directory containing `libsystemd.pc'\n to the PKG_CONFIG_PATH environment variable\n No package 'libsystemd' found\n\n Package libsystemd-journal was not found in the pkg-config search path.\n Perhaps you should add the directory containing `libsystemd-journal.pc'\n to the PKG_CONFIG_PATH environment variable\n No package 'libsystemd-journal' found\n\n\n hint: This usually indicates a problem with the package or the build environment.\n help: `systemd-python` (v235) was included because `matrix-synapse[systemd]` (v1.148.0rc1) depends on `systemd-python\u003e=231`\n```\n\nSome background about this issue on the mesonpy side can be read here: https://github.com/mesonbuild/meson-python/issues/236\n\nNow, this could be solved by making the C extension optional, and throw at runtime if it was built without it. It's not ideal, it would stop failing at build-time, but would make it possible to use `python-systemd` in projects using `uv` without requiring `libsystemd` to be available\n\nAnother very creative solution would be to write a special build backend which delegates to mesonpy in most cases, but provides its own `prepare_metadata_for_build_wheel` implementation… but that feels a bit overkill\n\nLast but not least, using another build backend than `mesonpy` could be a solution, but definitely more involved.\n\nI'll put up a draft PR for the first solution shortly to let you evaluate how that feels","author":{"url":"https://github.com/sandhose","@type":"Person","name":"sandhose"},"datePublished":"2026-02-20T16:25:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/167/python-systemd/issues/167"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c6d75dd-cd97-a40c-f288-f020a29ee771 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE8C:2CFBC2:F348C5:150681E:6A4DF1F6 |
| html-safe-nonce | e981e9298ec11159e763ebdf687476f103c9059290fdf542bb2c3097dbe73ffe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRThDOjJDRkJDMjpGMzQ4QzU6MTUwNjgxRTo2QTRERjFGNiIsInZpc2l0b3JfaWQiOiI1NjkxNTM2NTcxOTAxMDE0NTE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ecf6594fd1793950b5da84af7cc23f053f7322bc8be91e938a1d08eb2f4eb47a |
| hovercard-subject-tag | issue:3969340145 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/systemd/python-systemd/167/issue_layout |
| twitter:image | https://opengraph.githubassets.com/185913c48f71fc4b0ebc49e69b83f5aed8c0f5978ffca6a5f7e429cf5decbb0f/systemd/python-systemd/issues/167 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/185913c48f71fc4b0ebc49e69b83f5aed8c0f5978ffca6a5f7e429cf5decbb0f/systemd/python-systemd/issues/167 |
| og:image:alt | I ran into this whilst trying to move my project to replace poetry with uv. One interesting property of uv, is that it creates a lockfile that works for all platforms. This means that even if syste... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sandhose |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566 |
| turbo-cache-control | no-preview |
| go-import | github.com/systemd/python-systemd git https://github.com/systemd/python-systemd.git |
| octolytics-dimension-user_id | 1918868 |
| octolytics-dimension-user_login | systemd |
| octolytics-dimension-repository_id | 38590109 |
| octolytics-dimension-repository_nwo | systemd/python-systemd |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38590109 |
| octolytics-dimension-repository_network_root_nwo | systemd/python-systemd |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f4bb89367ca678f057d79b1abc45d6675b1bd5b2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width