seCore
A high-performance and secure framework for building scalable, reliable applications. seCore provides essential utilities and modules to streamline development, enhance security, and improve code maintainability.
Table of Contents
Features
- 🔒 Security-First: Built-in encryption, secure configuration management, and best-practice defaults
- ⚡ Performance: Optimized for high-load applications with minimal overhead
- 📦 Modular: Pick and use only the modules you need
- 📝 Comprehensive Logging: Structured logging with multiple levels and custom formatting
- 🔧 Configuration Management: Environment-based settings with validation
- 🌐 HTTP Utilities: Simplified REST API interactions with robust error handling
- 🐍 Python Version Info: Easy access to current and historical Python release data
Installation
Install seCore from PyPI:
pip install seCore
For development dependencies (testing, building):
pip install seCore[dev]
Requirements: Python ≥ 3.10
Quick Start
from seCore import logger, settings, encryption, HttpRest, HttpAction, PyVersions
# Logging
logger.info("Application started")
logger.debug("Debug information")
logger.error("An error occurred")
# Configuration
print(settings) # Access environment settings
# Encryption
cipher = encryption()
encrypted = cipher.encrypt("Secret message")
decrypted = cipher.decrypt(encrypted)
# HTTP Requests
api = HttpRest()
result, status = api.http_request(HttpAction.GET, "https://api.example.com/data")
# Python Version Info
py_ver = PyVersions()
print(py_ver.versions) # Current Python versions
print(py_ver.releases) # Recent releases
Core Modules
Logging
Custom structured logging with multiple log levels (DEBUG, INFO, WARNING, ERROR, CRITICAL).
Basic Usage
from seCore import logger
logger.debug("Detailed information for developers")
logger.info("General information about program flow")
logger.warning("Something you should look into")
logger.error("An unexpected problem occurred")
logger.critical("A serious error has occurred")
Output Example
seCore | DEBUG | Detailed information for developers
seCore | INFO | General information about program flow
seCore | WARNING | Something you should look into
seCore | ERROR | An unexpected problem occurred
seCore | CRITICAL | A serious error has occurred
Configuration
Set logging level via environment variable LOG_LEVEL:
DEBUG,INFO,WARNING,ERROR,CRITICAL
Customize log format with LOG_FORMAT environment variable.
Configuration
Manage application settings from environment variables with validation and defaults.
Basic Usage
from seCore import settings, settings_not_set
# Access configured settings
print(settings['ENVIRONMENT'])
print(settings['LOG_LEVEL'])
print(settings['PROJECT_ROOT'])
# Check unset required settings
for setting, details in settings_not_set.items():
print(f"Missing: {setting}")
Common Settings
| Setting | Description | Example |
|---|---|---|
ENVIRONMENT |
Application environment | Local, Development, Production |
LOG_LEVEL |
Logging verbosity | DEBUG, INFO, WARNING |
LOG_APPNAME |
Application name in logs | seCore |
PROJECT_ROOT |
Root directory of project | /path/to/project |
MSSQL_* |
SQL Server configuration | Various |
Custom settings can be added in environment configuration files.
Encryption
Secure encryption and decryption using industry-standard cryptography.
Basic Usage
from seCore import encryption, logger
cipher = encryption()
# Get encryption key
key = cipher.key.decode()
logger.info(f"Key: {key}")
# Encrypt data
message = "Sensitive information"
encrypted = cipher.encrypt(message).decode()
logger.info(f"Encrypted: {encrypted}")
# Decrypt data
decrypted = cipher.decrypt(encrypted)
logger.info(f"Decrypted: {decrypted}")
Key Features
- Fernet encryption: Strong symmetric encryption (AES-128)
- Key management: Automatic key generation and retrieval
- Encoding: Automatic Base64 encoding/decoding
- Security: Cryptographically secure by default
Use Cases
- Protecting sensitive configuration data
- Encrypting user credentials
- Securing API keys and tokens
- Data privacy in transit
HTTP & REST
Simplified HTTP requests with error handling and support for multiple methods.
Basic Usage
from seCore import HttpRest, HttpAction
api = HttpRest()
# GET request
result, status = api.http_request(HttpAction.GET, "https://api.example.com/users")
print(f"Status: {status}, Result: {result}")
# POST request
headers = {"Content-Type": "application/json"}
result, status = api.http_request(HttpAction.POST, "https://api.example.com/users", headers)
# PATCH request
result, status = api.http_request(HttpAction.PATCH, "https://api.example.com/users/1", headers)
Supported Methods
HttpAction.GET- Retrieve dataHttpAction.POST- Submit dataHttpAction.PUT- Replace resourceHttpAction.PATCH- Partial updateHttpAction.DELETE- Remove resource
Error Handling
The API automatically handles common HTTP errors and connection issues. Always check the returned status code:
result, status = api.http_request(HttpAction.GET, url)
if status == 200:
process_data(result)
else:
logger.error(f"HTTP Error {status}: {result}")
Python Versions
Access information about current and historical Python versions and releases.
Basic Usage
from seCore import PyVersions
import json
py_ver = PyVersions()
# Get version information
print(json.dumps(py_ver.versions, indent=2))
# Get release information
print(json.dumps(py_ver.releases, indent=2))
Response Structure
Versions include:
version- Python version numberstatus- Release status (bugfix, security, etc.)released- Release dateeos- End of support date
Releases include:
version- Specific release versiondate- Release date
Use Cases
- Check Python version support status
- Plan version upgrades
- Verify end-of-life dates
- Monitor security releases
Project Root
Get the project root directory programmatically.
Basic Usage
from seCore import projectroot
print(projectroot) # Absolute path to project root
API Reference
Module Exports
from seCore import (
__version__, # Version string
logger, # Logger instance
settings, # Configuration dictionary
settings_not_set, # Unset required settings
encryption, # Encryption class
HttpRest, # HTTP client class
HttpAction, # HTTP method enum
projectroot, # Project root path
PyVersions, # Python version info class
)
logger
Type: loguru.Logger
Structured logging instance with standard log levels.
Methods:
.debug(message).info(message).warning(message).error(message).critical(message)
encryption()
Returns: Encryption instance
Methods:
.encrypt(message: str) -> bytes- Encrypt plaintext.decrypt(ciphertext: str) -> str- Decrypt ciphertext.key -> bytes- Get the encryption key
HttpRest()
Returns: HTTP REST client instance
Methods:
.http_request(action: HttpAction, url: str, headers: dict = None) -> tuple- Make HTTP request
Returns: (response_body, status_code)
HttpAction
Enum with values:
GETPOSTPUTPATCHDELETE
PyVersions()
Returns: Python version information instance
Properties:
.versions -> list[dict]- Python versions.releases -> list[dict]- Recent releases
Advanced Usage
Custom Logging Configuration
Set environment variables to customize logging:
export LOG_LEVEL=DEBUG
export LOG_APPNAME=myapp
export LOG_FORMAT="{extra[app]} | <level>{level: <8}</level> | {message}"
Environment-Based Configuration
Create environment-specific configuration files and load via:
from seCore import settings
print(settings) # Loads from environment variables
Multiple HTTP Requests
from seCore import HttpRest, HttpAction
api = HttpRest()
endpoints = [
(HttpAction.GET, "https://api.example.com/users"),
(HttpAction.GET, "https://api.example.com/posts"),
(HttpAction.GET, "https://api.example.com/comments"),
]
for action, url in endpoints:
result, status = api.http_request(action, url)
print(f"{url}: {status}")
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
pip install -e ".[dev]"
pytest
pytest --cov=seCore
License
This project is licensed under the MIT License - see License.md for details.
Metadata
Release files for seCore 2026.8.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 |
|---|---|---|---|---|
| secore-2026.8.0.tar.gz | 25.2 kB | Without provenance | Details for secore-2026.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| secore-2026.8.0-py3-none-any.whl | Python 3 | none | any | Details for secore-2026.8.0-py3-none-any.whl |
Total release size: 49.3 kB
Release files / secore-2026.8.0.tar.gz
| Download URL | secore-2026.8.0.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f50c70d39d332001842416b819ef6fa17fa2968ed2a00e152844435f35c9854c
|
|
BLAKE2b-256 checksum How to use checksums |
e8974f97c35e3fbb64a6bfcbf9c0a35f29aa213bed461733bc943c438dc6da2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / secore-2026.8.0-py3-none-any.whl
| Download URL | secore-2026.8.0-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2f09bd59374dcc0bc2ab5a52be6639e8e04d3a384667b3d81b599911d7b86b6
|
|
BLAKE2b-256 checksum How to use checksums |
8ab223e91a52b5012b94b87b9da01d1cc2b82f6fbc64c4b3c5988644324045ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for seCore 2026.8.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.