Skip to main content

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 data
  • HttpAction.POST - Submit data
  • HttpAction.PUT - Replace resource
  • HttpAction.PATCH - Partial update
  • HttpAction.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 number
  • status - Release status (bugfix, security, etc.)
  • released - Release date
  • eos - End of support date

Releases include:

  • version - Specific release version
  • date - 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:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE

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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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.


Version: 2025.6.0+

For more information, visit the GitHub repository

Metadata

Release files for seCore 2026.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seCore 2026.7.1
File Size Uploaded Provenance Actions
secore-2026.7.1.tar.gz 25.3 kB Without provenance Details for secore-2026.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seCore 2026.7.1
File Interpreter ABI Platform Actions
secore-2026.7.1-py3-none-any.whl Python 3 none any Details for secore-2026.7.1-py3-none-any.whl

Total release size: 49.6 kB

Release files / secore-2026.7.1.tar.gz

Download URL secore-2026.7.1.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
13816e9909c0c229caeb6d469210488dc93537e643ee6eead77deba9fc19c762
BLAKE2b-256 checksum
How to use checksums
d1a71e9cd3adf13a08220c09f664e3b780b471d0e8331e6e9baa56af49239413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / secore-2026.7.1-py3-none-any.whl

Download URL secore-2026.7.1-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1767ea9815b67562f59260945b01fdeba31b494abab8c1aa50a1700196bd47ab
BLAKE2b-256 checksum
How to use checksums
fc2147e216ea8c3d3d998f3f45659e4a1f4a1970a2c3a62d34f4e852fae4f811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for seCore 2026.7.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page