Metadata-Version: 2.4
Name: python-devops-logging-decorators
Version: 0.1.5
Summary: Factory-based logging decorators and batch ETL utilities
Author: wilso
Project-URL: Homepage, https://bitbucket.org/ssw1991/python_devops
Project-URL: Repository, https://bitbucket.org/ssw1991/python_devops
Project-URL: Documentation, https://bitbucket.org/ssw1991/python_devops
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Logging
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.6.0; extra == "docs"
Requires-Dist: mkdocs-material>=9.6.0; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.30.0; extra == "docs"

# 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)

```powershell
py -m venv .venv
```
#### To activate 
```powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
```
```
.venv/Scripts.Activate.ps1
```

### 2) Install dependencies from root requirements

- Runtime only:

```powershell
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
```

- Development profile:

```powershell
.\.venv\Scripts\python.exe -m pip install -r requirements-dev.txt
```

- Docs profile:

```powershell
.\.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:

```powershell
.\.venv\Scripts\python.exe -m pytest batch_etl/tests logging_decorators/tests -q -vv
```

2. Confirm package metadata/version in `pyproject.toml` (name/version should match intended release).

3. Ensure PyPI credentials are available as environment variables:

```powershell
$env:PYPI_TOKEN = "<pypi-token>"
$env:TEST_PYPI_TOKEN = "<testpypi-token>"  # optional
```

4. (Optional) clear old build artifacts:

```powershell
Remove-Item -Recurse -Force .\dist -ErrorAction SilentlyContinue
```

- PowerShell:

```powershell
.\deploy.ps1 -Profile dev
```

- Bash:

```bash
./deploy.sh dev
```

Valid profiles are `runtime`, `dev`, and `docs`.

Build artifacts are written to `dist/`.

After build, validate distributions:

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

Optional manual uploads:

- TestPyPI

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

- PyPI

```powershell
.\.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.
```powershell
git tag -a v<version> -m "<some message>"
```
```powershell
git push origin v<version>
```
6. Verify the release from PyPI install:

```bash
pip install python-devops-logging-decorators
```

## Import instructions

Install from PyPI:

```bash
pip install python-devops-logging-decorators
```

Or install locally from this repository root (editable):

```bash
pip install -e .
```

Then import both subprojects as:

```python
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`.
