decorators-cryptography
decorators-cryptography is a Python library that provides decorators for encrypting and decrypting passed arguments using the cryptography package.
Contents:
Installing Poetry and running the virtual environment
Install Poetry
For Linux, macOS, Windows (WSL):
curl -sSL https://install.python-poetry.org | python3 -
For Windows (Powershell):
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
On macOS and Windows, the installation script will prompt you to add the Poetry executable folder to the PATH variable. Do this by running the following command (don't forget to change {USERNAME} to your username):
macOS
export PATH="/Users/{USERNAME}/.local/bin:$PATH"
Windows
$Env:Path += ";C:\Users\{USERNAME}\AppData\Roaming\Python\Scripts"; setx PATH "$Env:Path"
Check installation:
poetry --version
Installing bash completions (optional):
poetry completions bash >> ~/.bash_completion
Start virtual environment
🔖 Setting up the Poetry environment for PyCharm
Creating a virtual environment:
poetry env use python3.10
Installing dependencies:
poetry install
Launching the shell and activating the virtual environment (from the project folder):
poetry shell
Checking virtual environment activation:
poetry env list
Install pre-commit hooks
In order for pre-commit checks to be performed with each commit, you must:
Install pre-commit
The pre-commit module has already been added to the requirements and should be installed automatically with the virtual environment.
You can check the presence of pre-commit with the command (with the virtual environment activated):
pre-commit --version
# >> pre-commit 2.21.0
If this does not happen, then you need to install pre-commit according to the official instructions:
- install via brew package manager:
brew install pre-commit - installation via poetry:
poetry add pre-commit - pip install:
pip install pre-commit
Install hooks
Installing hooks:
pre-commit install --all
In the future, when executing the git commit command, the checks listed in the .pre-commit-config.yaml file will be performed.
If it is not clear which error is preventing the commit from being executed, you can run the hooks manually with the command:
pre-commit run --all-files
Example Usage
To use the decorators provided by decorators-cryptography, follow the examples below.
from decorators_cryptography import encrypt, decrypt
@encrypt(key="encryption_key")
def sensitive_function(arg1, arg2):
# Your function implementation
pass
@decrypt(key="decryption_key")
def sensitive_function(arg1, arg2):
# Your function implementation
pass
Metadata
Release files for decorators-cryptography 0.1.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 | |
|---|---|---|---|
| decorators_cryptography-0.1.0.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| decorators_cryptography-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / decorators_cryptography-0.1.0.tar.gz
| Download URL | decorators_cryptography-0.1.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15be1d0d500ff97010875e0cc2ae790dfd23b5339877b7190a3ab39717d9b605
|
|
BLAKE2b-256 checksum How to use checksums |
6ab439f2d39ebc8f521ade09cdc787a2a341dddb9aebe91e56122cd0b91c3245
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1039-azure
|
Release files / decorators_cryptography-0.1.0-py3-none-any.whl
| Download URL | decorators_cryptography-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1112a0a7b0e2f75688b003df673dbf01ffc853d1d347463d14e88dc10e85acf
|
|
BLAKE2b-256 checksum How to use checksums |
840c877cd6371630813973babb38779285bf5cf4d3c7b14a0676a356d86c6677
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1039-azure
|