Shared core utilities for the bio-analyze toolbox.
Project description
bio-analyze-core
Shared core utilities for the toolbox: provides reusable capabilities (configuration, logging, I/O, external command execution, etc.) for various analysis modules and the CLI.
📦 Core Functional Modules
1. Logging Management
Provides a unified logging initialization and management mechanism based on loguru.
Python API
from bio_analyze_core.logging import get_logger, setup_logging
# 1. Unified initialization at the application entry point
# Idempotent design: multiple calls only update the level without breaking existing sinks
setup_logging(level="INFO")
# 2. Get a module-specific logger
# Automatically binds extra["name"] = "my_module"
logger = get_logger("my_module")
logger.info("This is a log message")
# 3. Independent file logging
# Supports setting an independent log file for a specific module
file_logger = get_logger("my_task", log_path="./logs/task.log")
file_logger.info("This goes to file AND console")
get_logger parameters:
name(str): Logger name.log_path(str | Path, optional): If provided, logs will also be written to this file.level(str): Log level for the file (default "INFO").
2. Pipeline Framework
Provides a Node-based stream processing framework supporting context sharing and state persistence.
Python API
from bio_analyze_core.pipeline import Pipeline, Node, Context, Progress
class MyNode(Node):
def run(self, context: Context, progress: Progress, logger):
logger.info(f"Processing {context.data}")
progress.update(message="Working...", percentage=50)
context.result = "done"
# Create a pipeline
pipeline = Pipeline("my_pipeline", state_file="pipeline_state.json")
pipeline.context.data = "input_data"
# Add nodes
pipeline.add_node(MyNode("step1"))
# Run the pipeline
pipeline.run()
3. Subprocess Management
Wraps subprocess.run to provide safer external command execution and output capturing.
Python API
from bio_analyze_core.subprocess import run, CalledProcessError
try:
result = run(
["ls", "-la"],
cwd="./",
check=True, # Raises exception on non-zero exit code
capture_output=True # Captures stdout/stderr
)
print(result.stdout)
except CalledProcessError as e:
print(f"Command failed: {e.stderr}")
4. Configuration Management
Supports loading configurations from JSON/YAML and provides deep merge utilities.
Python API
from bio_analyze_core.utils import load_config
# Automatically recognizes .json or .yaml
config = load_config("config.yaml")
print(config["input_dir"])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bio_analyze_core-0.1.0a4.tar.gz.
File metadata
- Download URL: bio_analyze_core-0.1.0a4.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8a2d338c50c31d83ad71d0ecd364e6a511cb037486a3140bd2ff23512cef2df
|
|
| MD5 |
a740eab69e50e1a00f697a2a10f72d25
|
|
| BLAKE2b-256 |
f1b0d9a81f26145cfaeb1156f25d8faf7a326d3c5adf1f5be6824a4f523d171d
|
File details
Details for the file bio_analyze_core-0.1.0a4-py3-none-any.whl.
File metadata
- Download URL: bio_analyze_core-0.1.0a4-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9238f872541d0add98cfd325bdde0cbf499c568046f7511caaef594becc97bf5
|
|
| MD5 |
9bc57ac79ea80ea01069f341c04b10c5
|
|
| BLAKE2b-256 |
254b4701066d21af28f07bbd55799ef4a657c634b9b7a46294820856f7bcb06b
|