mount
Simple python wrapper around sys/mount.h’s mount and umount2 libc functions.
Installation
This package is available on PyPI, so it can be installed with pip or another regular package manager you use:
python3 -m pip install mount
Usage
This library is a tiny wrapper around mount and umount2 functions, so most information about them you can find in man 2 mount and man 2 umount.
Generally there are only 4 objects provided by this package:
mount.mount function that is wrapper around mount libc function.
mount.umount function that is wrapper around umount2 libc function.
mount.MountFlag enum with available mount flags.
mount.UmountFlag enum with available umount flags.
mount and umount functions raises OSError on errors.
Here is a simple script that will mount in-memory 1G temporary filesystem with NOEXEC and NOSYMFOLLOW flags in temporary created directory:
from tempfile import TemporaryDirectory
from mount import mount, MountFlag
if __name__ == "__main__":
target = TemporaryDirectory()
mount("tmpfs", target.name, "tmpfs", MountFlag.NOEXEC | MountFlag.NOSYMFOLLOW, "size=1G")
print("Mounted to: ", target)
Development
The project is managed with uv:
uv sync
uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pydoclint src/mount
uv run pytest
Tests that perform real mounts need root and are skipped without it. To run them without touching the host mount table, start pytest in a private mount namespace, either unprivileged through a user namespace or as real root:
unshare -rm uv run pytest
sudo unshare -m .venv/bin/pytest
Metadata
Release files for mount 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mount-2.0.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mount-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / mount-2.0.0.tar.gz
| Download URL | mount-2.0.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b980306bed8aaeb7dc8a616a6fe4c68ed99c37becf7d141b09f3b183b0db9856
|
|
BLAKE2b-256 checksum How to use checksums |
8d1dd4bb82202cede82949d1fc794270ff4d477be36d02688506d2be7874c3b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / mount-2.0.0-py3-none-any.whl
| Download URL | mount-2.0.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f5f23ee3edbc8224f9f2f5fedfdae86f4ac41934f0cc7be934348ffea8b588a
|
|
BLAKE2b-256 checksum How to use checksums |
2628c0354e0931c55b93c77829a0f425860ea59ba24843a78539483664d2d0ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency log