small corrections
Python Code Quality / python-code-quality (push) Successful in 11s
Python Test / python-test (push) Successful in 13s

This commit is contained in:
Brian Bjarke Jensen
2026-01-08 08:33:00 +01:00
parent a616078fa8
commit a81c0964b0
6 changed files with 13 additions and 16 deletions
+1
View File
@@ -9,6 +9,7 @@ repos:
- id: check-added-large-files - id: check-added-large-files
- id: debug-statements - id: debug-statements
- id: name-tests-test - id: name-tests-test
exclude: ^tests/test_data/
- id: check-merge-conflict - id: check-merge-conflict
# Python linting and formatting with Ruff # Python linting and formatting with Ruff
+8 -8
View File
@@ -82,7 +82,7 @@ uv run python-encrypt-code generate-password
Encrypt a Python module or package directory. Encrypt a Python module or package directory.
```bash ```bash
uv run python-encrypt-code encrypt <source_path> -o <output.pec> -p <password> [-aad <json-string>] uv run python-encrypt-code encrypt <source> -o <output> -p <password> [-aad <json-string>]
``` ```
**Options:** **Options:**
@@ -97,12 +97,12 @@ uv run python-encrypt-code encrypt <source_path> -o <output.pec> -p <password> [
Decrypt a file and extract contents to disk. Decrypt a file and extract contents to disk.
```bash ```bash
uv run python-encrypt-code decrypt <encrypted_file> -o <output_dir> uv run python-encrypt-code decrypt <source> -o <output>
``` ```
**Options:** **Options:**
- `encrypted.pec`: Path to encrypted file - `source`: Path to encrypted file
- `-o, --output`: Directory to extract decrypted files - `-o, --output`: Directory to extract decrypted files
### `run-insecure` ### `run-insecure`
@@ -111,13 +111,13 @@ Decrypt and execute a Python script from an encrypted package.
**N.B. this writes decrypted files to a temporary folder on the disk before executing!** **N.B. this writes decrypted files to a temporary folder on the disk before executing!**
```bash ```bash
uv run python-encrypt-code run-insecure <encrypted_file> --script <script_name> uv run python-encrypt-code run-insecure <source> --script <script>
``` ```
**Options:** **Options:**
- `encrypted.pec`: Path to encrypted file - `source`: Path to encrypted file
- `-s, --script`: Python script to execute (default: `main.py`) - `-s, --script`: Python script to execute
## Use Cases ## Use Cases
@@ -129,8 +129,8 @@ export PASSWORD=$(uv run python-encrypt-code generate-password)
uv run python-encrypt-code encrypt ./my_app -o my_app.pec -p ${PASSWORD} uv run python-encrypt-code encrypt ./my_app -o my_app.pec -p ${PASSWORD}
# Setup your own authentication source and subclass the PasswordProvider # Setup your own authentication source and subclass the PasswordProvider
# Distribute the .pec file to customers and let # Distribute the .pec file to customers and
# them run it without seeing the source code # let them run it without seeing the source code
uv run python-encrypt-code run-insecure ./my_app.pec -p ${PASSWORD} --script main.py uv run python-encrypt-code run-insecure ./my_app.pec -p ${PASSWORD} --script main.py
``` ```
@@ -4,7 +4,6 @@ from io import BytesIO
import os import os
import zipfile import zipfile
from pathlib import Path from pathlib import Path
from typing import Dict
from .data_zipper_interface import DataZipperInterface from .data_zipper_interface import DataZipperInterface
@@ -44,7 +43,7 @@ class DataZipper(DataZipperInterface):
@staticmethod @staticmethod
def unzip_data( def unzip_data(
input_data: BytesIO, input_data: BytesIO,
) -> Dict[str, BytesIO]: ) -> dict[str, BytesIO]:
"""Unzips the data of a zip file into memory. """Unzips the data of a zip file into memory.
Args: Args:
@@ -1,7 +1,6 @@
"""Definition of DataZipperInterface.""" """Definition of DataZipperInterface."""
from io import BytesIO from io import BytesIO
from typing import Dict
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from pathlib import Path from pathlib import Path
@@ -26,7 +25,7 @@ class DataZipperInterface(ABC):
@abstractmethod @abstractmethod
def unzip_data( def unzip_data(
input_data: BytesIO, input_data: BytesIO,
) -> Dict[str, BytesIO]: ) -> dict[str, BytesIO]:
"""Unzips data from the input path and saves it in memory. """Unzips data from the input path and saves it in memory.
Args: Args:
@@ -4,7 +4,6 @@ import os
import json import json
import base64 import base64
import secrets import secrets
from typing import Tuple
from .password_provider_interface import PasswordProviderInterface from .password_provider_interface import PasswordProviderInterface
@@ -30,7 +29,7 @@ class PasswordProviderExample(PasswordProviderInterface):
return url_safe_string return url_safe_string
@classmethod @classmethod
def get_decryption_keys(cls) -> Tuple[str, dict[str, str] | None]: def get_decryption_keys(cls) -> tuple[str, dict[str, str] | None]:
"""Placeholder function to get decryption keys. Implement your own logic here. """Placeholder function to get decryption keys. Implement your own logic here.
Returns: Returns:
@@ -1,6 +1,5 @@
"""Definition of PasswordProviderInterface.""" """Definition of PasswordProviderInterface."""
from typing import Tuple
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
@@ -18,7 +17,7 @@ class PasswordProviderInterface(ABC):
@classmethod @classmethod
@abstractmethod @abstractmethod
def get_decryption_keys(cls) -> Tuple[str, dict[str, str] | None]: def get_decryption_keys(cls) -> tuple[str, dict[str, str] | None]:
"""Get decryption keys for decryption. """Get decryption keys for decryption.
Returns: Returns: