Skip to main content

Factory-based logging decorators and batch ETL utilities

Project description

python_devops

This repository is intended to be a DevOps toolkit workspace.

It contains practical, reusable projects and utilities that support common engineering and operations workflows, such as automation, observability, reliability, and deployment-related tasks.

Root-level deployment workflow

You can now deploy/build python-devops-logging-decorators directly from the python_devops root.

1) Create virtual environment (once)

py -m venv .venv

To activate

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.venv/Scripts.Activate.ps1

2) Install dependencies from root requirements

  • Runtime only:
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
  • Development profile:
.\.venv\Scripts\python.exe -m pip install -r requirements-dev.txt
  • Docs profile:
.\.venv\Scripts\python.exe -m pip install -r requirements-docs.txt

3) Run deployment/build from root

Before running deployment, do this preflight checklist:

  1. Run tests:
.\.venv\Scripts\python.exe -m pytest batch_etl/tests logging_decorators/tests -q -vv
  1. Confirm package metadata/version in pyproject.toml (name/version should match intended release).

  2. Ensure PyPI credentials are available as environment variables:

$env:PYPI_TOKEN = "<pypi-token>"
$env:TEST_PYPI_TOKEN = "<testpypi-token>"  # optional
  1. (Optional) clear old build artifacts:
Remove-Item -Recurse -Force .\dist -ErrorAction SilentlyContinue
  • PowerShell:
.\deploy.ps1 -Profile dev
  • Bash:
./deploy.sh dev

Valid profiles are runtime, dev, and docs.

Build artifacts are written to dist/.

After build, validate distributions:

.\.venv\Scripts\python.exe -m twine check .\dist\*

Optional manual uploads:

  • TestPyPI
.\.venv\Scripts\python.exe -m twine upload --repository-url https://test.pypi.org/legacy/ -u __token__ -p $env:TEST_PYPI_TOKEN .\dist\*
  • PyPI
.\.venv\Scripts\python.exe -m twine upload --repository-url https://upload.pypi.org/legacy/ -u __token__ -p $env:PYPI_TOKEN .\dist\*

Tag note: tag releases as v<version> (example: v0.1.4) so the tag-based pipeline path can publish to PyPI.

PyPI deployment config (Bitbucket)

Use this release checklist for Bitbucket-driven publishing.

  1. Confirm release metadata in pyproject.toml:

    • distribution name: python-devops-logging-decorators
    • version: project.version
    • deploy commands: [tool.python_devops.pypi.commands]
  2. Ensure repository variables are set:

    • PYPI_TOKEN
    • TEST_PYPI_TOKEN (optional; falls back to PYPI_TOKEN for TestPyPI)
  3. Validate locally before pushing:

    • run tests
    • build package from root
    • run twine check dist/*
  4. Push to main to trigger TestPyPI publishing.

  5. Create/push a version tag (v<version>, for example v0.1.4) to trigger PyPI publishing.

git tag -a v<version> -m "<some message>"
git push origin v<version>
  1. Verify the release from PyPI install:
pip install python-devops-logging-decorators

Import instructions

Install from PyPI:

pip install python-devops-logging-decorators

Or install locally from this repository root (editable):

pip install -e .

Then import both subprojects as:

import logging_decorators
import batch_etl

Bitbucket pipeline file

Top-level pipeline config: bitbucket-pipelines.yml

  • pushes to main run publish to TestPyPI
  • tags matching v* run publish to PyPI

The pipeline reads [tool.python_devops.pypi.commands] from the root pyproject.toml, so deployment commands stay centralized in one file.

Component projects

logging_decorators

logging_decorators is a component library that provides Python decorators for standardized function logging.

It uses a factory pattern to create decorators by:

  • log level (debug, info, warning, error, critical)
  • handler type (stream, file, rotating_file, timed_rotating_file)
  • level + handler combinations (for example error_file, info_rotating_file)

It also supports optional formatter overrides and includes examples/tests so it can be adopted quickly in application or automation code.

batch_etl

batch_etl is a DAG-oriented ETL component library included in the same published distribution.

It provides:

  • abstract ETL primitives (BaseExtractor, BaseTransformer, BaseLoader)
  • a pipeline orchestrator (Pipeline) with dependency traversal and cycle detection
  • concrete CSV implementations (CsvFileExtractor, PassthroughRowsTransformer, CsvFileLoader)
  • demo utilities for OHLC CSV workflows (batch_etl.demo)

For detailed usage examples, see batch_etl/README.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_devops_logging_decorators-0.1.5.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file python_devops_logging_decorators-0.1.5.tar.gz.

File metadata

File hashes

Hashes for python_devops_logging_decorators-0.1.5.tar.gz
Algorithm Hash digest
SHA256 98ddd3d8fd2f3ed1049b34e1fcf44d5ebe9efa235e366345c0aae7277cacf357
MD5 ff440e851684290f4eea682c25d2f6bc
BLAKE2b-256 c187f66cbf47eb95e6e4226b23c5754f173c91ff3bbdb43b2851d87023d822f3

See more details on using hashes here.

File details

Details for the file python_devops_logging_decorators-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for python_devops_logging_decorators-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 29d6b8aeb40c94d6400fd14f07932978d2658e883f0860df12b824cb23b38598
MD5 8585cd6d6ae2e43c21c0f51eb09d5a29
BLAKE2b-256 b7e8e20f97c29f0c643864e3f7838481aef88f78455007b7e1f2636d72a268c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page