Skip to main content

Python bindings for the Rust-based ALPM project

Project description

python-alpm

Python bindings for the Arch Linux Package Management (ALPM) project.

We are currently awaiting decision from PyPI maintainers to allow us to publish this package under the name alpm. Until then, we are using the name python-alpm. You can view the support ticket here.

Documentation

Latest documentation is available at https://alpm.archlinux.page/pdoc.

Installation

pip install python-alpm

Examples

Validating and comparing versions

>>> from alpm.alpm_types import PackageVersion, PackageRelease, FullVersion, SchemaVersion

>>> full_version = FullVersion(pkgver=PackageVersion('0.1.0alpha'), pkgrel=PackageRelease(minor=1))
>>> full_version
FullVersion(pkgver=PackageVersion('0.1.0alpha'), pkgrel=PackageRelease(major=0, minor=1))

>>> PackageVersion('1.0.1') > full_version.pkgver
True

>>> version_one = SchemaVersion.from_str('1.0.0')
>>> version_one
SchemaVersion(major=1, minor=0, patch=0, pre='', build='')

>>> version_one == SchemaVersion(major=1)
True

Parsing .SRCINFO

>>> from alpm.alpm_srcinfo import SourceInfoV1
>>> from alpm.alpm_types import Architecture

>>> srcinfo = SourceInfoV1.from_file("../alpm-srcinfo/tests/correct/all_overrides.srcinfo")

>>> srcinfo.base
PackageBase(name='example', version=FullVersion(pkgver=PackageVersion('0.1.0'), pkgrel=PackageRelease(major=1), epoch=1))

>>> srcinfo.base.architectures
Architectures([Architecture('x86_64'), Architecture('aarch64')])

>>> srcinfo.packages
[Package(name='example')]

>>> srcinfo.packages_for_architecture(Architecture('aarch64'))
[MergedPackage(architecture=Architecture('aarch64'), name='example', version=FullVersion(pkgver=PackageVersion('0.1.0'), pkgrel=PackageRelease(major=1), epoch=1))]

Working with package metadata

>>> from alpm.alpm_srcinfo.source_info.v1.package import Package, Override
>>> from alpm.alpm_types import License

>>> pkg = Package("testpkg")

>>> pkg.description = Override("A test package")
>>> pkg.description
Override(value='A test package')

>>> pkg.licenses = Override([License("MIT"), License("custom-license")])
>>> pkg.licenses
Override(value=[License('MIT'), License('custom-license')])

>>> {str(lic): lic.is_spdx for lic in pkg.licenses.value}
{'MIT': True, 'custom-license': False}

Contributing

Please refer to the contribution guidelines to learn how to contribute to this project.

License

This project can be used under the terms of the Apache-2.0 or MIT. Contributions to this project, unless noted otherwise, are automatically licensed under the terms of both of those licenses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_alpm-0.2.1.tar.gz (315.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

python_alpm-0.2.1-cp310-abi3-manylinux_2_31_riscv64.whl (722.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.31+ riscv64

python_alpm-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (707.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

python_alpm-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (709.0 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

File details

Details for the file python_alpm-0.2.1.tar.gz.

File metadata

  • Download URL: python_alpm-0.2.1.tar.gz
  • Upload date:
  • Size: 315.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.7

File hashes

Hashes for python_alpm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6b1edf9336d45b0960cd9be82fce6eed18bb26336ce031d3b8eb2252f21c7af8
MD5 d2ac8ecbd7f8864ff52866fa7208c21f
BLAKE2b-256 17674323c6f0dba1b145cb5ea1bff5e76a7c7194f51cdf9ac0fded56fb885a2f

See more details on using hashes here.

File details

Details for the file python_alpm-0.2.1-cp310-abi3-manylinux_2_31_riscv64.whl.

File metadata

File hashes

Hashes for python_alpm-0.2.1-cp310-abi3-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 c79b18b5c282d466ac348b0532077e0db6b4912f7992f73eaebc181f40efe56a
MD5 0ef6111af34eb7b93dc0779f8a2fa48f
BLAKE2b-256 8343d02642aa218f9b988e8796dd1d4065a715123fb7281f9045c1baed41a355

See more details on using hashes here.

File details

Details for the file python_alpm-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_alpm-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49f415387bc1eed1736e7f82c09b7f546570bb50ece6e3a6ef1d78e83495b0ef
MD5 b0a40a1a4e0a20852a822a7f675bd2fa
BLAKE2b-256 ab8fefec570db063d1673fabb65ca4d0449896d4e24c78fe0f38744f41b093c6

See more details on using hashes here.

File details

Details for the file python_alpm-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for python_alpm-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb5680cfda100bc731ebccb4314f5c808424d36cd62c9280a934ac451861caae
MD5 106d8ef07443cab7806accff2d7f788c
BLAKE2b-256 2f2ac5ada4158eb261fe9cd961b85c0b9ea2556e84a7cdf9cfe5a10ae2fd4bb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page