unix-perms
Manage and interpret Unix file permissions with a Python package that provides intuitive tools for creating, validating, and describing permission modes.
📦 Installation
To install unix-perms, run the following command:
pip install unix-perms
🚀 Features
- Convert octal digits to permission configurations.
- Convert octal representations to Unix permission modes.
- Validate Unix permission modes.
- Create, update, and work with permissions modes using python objects.
📚 Usage
Convert an Octal Digit to Configuration
from unix_perms import from_octal_digit_to_config
config = from_octal_digit_to_config(7)
print(config)
OctalConfig(
description='Read, write, and execute permissions',
read=True,
write=True,
execute=True
)
Convert Octal Representation to Unix Permissions Mode
from unix_perms import from_octal_to_permissions_mode
mode = from_octal_to_permissions_mode(0o777)
print(mode)
777
Validate if an Octal Representation is a Unix Permissions Mode
from unix_perms import is_permissions_mode
print(is_permissions_mode('755'))
print(is_permissions_mode('999'))
True
False
Using PermissionsConfig
from unix_perms import PermissionsConfig
config = PermissionsConfig.from_octal_digit(4)
print(config)
PermissionsConfig(read=True, write=False, execute=False)
Using PermissionsByte
from unix_perms import PermissionsByte, PermissionsConfig
config = PermissionsConfig(read=True, write=False, execute=False)
owner_permissions = PermissionsByte(authority="owner", config=config)
print(owner_permissions.permissions_mode)
print(owner_permissions.permissions_description)
400
Read permission only
Using PermissionsMode
from unix_perms import PermissionsByte, PermissionsConfig, PermissionsMode
owner_permissions = PermissionsByte(
authority="owner", config=WRITE_PERMISSIONS_CONFIG
)
group_permissions = PermissionsByte(
authority="group", config=ALL_PERMISSIONS_CONFIG
)
others_permissions = PermissionsByte(
authority="others", config=READ_PERMISSIONS_CONFIG
)
permissions_mode = PermissionsMode(
owner=owner_permissions, group=group_permissions, others=others_permissions
)
print(permissions_mode.permissions_mode)
group_permissions_new = PermissionsByte(
authority="group", config=ALL_PERMISSIONS_CONFIG
)
permission_mode_sub = permissions_mode - group_permissions_new
print(permission_mode_sub.permissions_mode)
274
204
🤝 License
This project is licensed under the MIT License. See the LICENSE file for more details.
📞 Contact
If you have any questions or need support, feel free to reach out by opening an issue on the GitHub repository.
Metadata
Release files for unix-perms 0.6.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 | Provenance | Actions |
|---|---|---|---|---|
| unix_perms-0.6.0.tar.gz | 7.9 kB | Without provenance | Details for unix_perms-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unix_perms-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for unix_perms-0.6.0-py3-none-any.whl |
Total release size: 17.3 kB
Release files / unix_perms-0.6.0.tar.gz
| Download URL | unix_perms-0.6.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b73d3bfa56f40aeeb788281267ff678ad44a9f1b9dd137dfc9db00ea36b1242b
|
|
BLAKE2b-256 checksum How to use checksums |
1c2bac01d6cb8828ce97f6aa1e4844e34f50a49ca57d63a50f26f548f177e6d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.12.1 Windows/11
|
Release files / unix_perms-0.6.0-py3-none-any.whl
| Download URL | unix_perms-0.6.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0d88b3ff86faac6582a2d670d996d4bf1f59eeb84b43e143d85a08785114e1f
|
|
BLAKE2b-256 checksum How to use checksums |
a9433c174ad65d3a3c1fe41082d7141da9fa2ee23f23df8d174dcb9e01f78927
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.12.1 Windows/11
|
Security for unix-perms 0.6.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.