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.3.0.tar.gz (327.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.3.0-cp310-abi3-manylinux_2_31_riscv64.whl (873.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.31+ riscv64

python_alpm-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

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

python_alpm-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: python_alpm-0.3.0.tar.gz
  • Upload date:
  • Size: 327.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_alpm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8090b6ccedde801531dfcc68aa428129a43b4e01c1cb479b61123800f1cf8bb8
MD5 1c6a4ff3db7008eeeb87267f24f0280e
BLAKE2b-256 ed855d0daf5c8a706cd5d908509cba6dc1c7224c13f08a09899c058e72c9b137

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_alpm-0.3.0-cp310-abi3-manylinux_2_31_riscv64.whl
  • Upload date:
  • Size: 873.8 kB
  • Tags: CPython 3.10+, manylinux: glibc 2.31+ riscv64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_alpm-0.3.0-cp310-abi3-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 4140f01e85d81fb861fa4e4cb4ff3ec6feda041ec5a4e34b39d66a7389c85f88
MD5 323ef82a0389adab5e864ccc64cf274c
BLAKE2b-256 90b431b1a6e7a0912b84928f34801396c867aa1d3e598e5cc712037eca0176db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_alpm-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_alpm-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a72b68000faa91cc437e36cd29404629ba95f9dca348729c4259f4197d2cb79
MD5 4b048ed390e8a4f4768e5b30eaf071ac
BLAKE2b-256 ad335a780d812788ac2a6c2247eaf66d6c4535dc47fbb0e0d0d0e4851bdb4570

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_alpm-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for python_alpm-0.3.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 96c7eef914a0e06ea2c27161dee03fb676a6776ec0e86acf3d6ab6678d05505f
MD5 598659ef2ad686990401247056fedaf5
BLAKE2b-256 9220af180a74d33e34dd4af99387f0db7764c5d27ac925017883df34e24ae830

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