DiamondLightSource / DiamondLightSource/observability-utils

Split functionality into modules by dependencies

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

As a user I would like to use this library in a `FastAPI` project without also having a transient dependency on `stomp-py` (and vice versa)

## Possible Solution

Split project into modules by import dependency e.g.:
- `src`
- `fastapi`
- `tracing.py`
- `stomp`
- `tracing.py`

And then add dependency groups to `pyproject.toml` e.g.
```toml
dependencies = [
"typing_extensions<4.6",
"opentelemetry-distro",
"opentelemetry-exporter-otlp",
"stomp.py",
] # Add project dependencies here, e.g. ["click", "numpy"]
dynamic = ["version"]
license.file = "LICENSE"
readme = "README.md"
requires-python = ">=3.10"

[project.optional-dependencies]
dev = [
"copier",
"pipdeptree",
"pre-commit",
"pyright",
"pytest",
"pytest-cov",
"ruff",
"tox-direct",
"types-mock",
]

fastapi = ["fastapi[all]<0.99", "opentelemetry-instrumentation-fastapi"]
stomp = ["stomp-py"]
```

## Acceptance Criteria
- Importing from `observability_utils.fastapi` only works if I have run `pip install observability_utils[fastapi]`
- Importing from `observability_utils.stomp` only works if I have run `pip install observability_utils[stomp]`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.