Stdlib-only config helpers for the Juniper ML platform (env-var alias-with-deprecation resolver)
Project description
juniper-config-tools
Stdlib-only config helpers for the Juniper ML platform.
This package is the single source of truth for the env-var alias-with-deprecation helper that has been independently re-implemented across:
juniper-cascor(CFG-03, CFG-05) — as pydantic@field_validatorsjuniper-canopy(CFG-04, CFG-16) — as pydantic@field_validatorsjuniper-cascor-worker(CFG-06, in flight) — as a standalone helper
The fourth repo's CFG-06 design surfaced the pattern as worth lifting.
Cascor-worker's strict "no Pydantic at runtime" invariant (pinned by
tests/test_no_pydantic_at_runtime.py, juniper-ml#168) ruled out
juniper-observability (which requires pydantic>=2.0), so this
package exists with a stdlib-only dependency policy.
This work mirrors the
juniper-doc-tools PyPI migration plan
(2026-05-18 doc-link validator incident) and the
juniper-ci-tools PyPI migration plan
(2026-05-20 dep-docs generator divergence).
The full design and rollout plan lives at
notes/JUNIPER_CONFIG_TOOLS_PYPI_MIGRATION_PLAN_2026-05-22.md
in the juniper-ml repo.
Installation
pip install juniper-config-tools
Runtime dependencies: none (stdlib only — os, warnings).
Quick start
from juniper_config_tools import env_with_legacy_alias
# Canonical name first; legacy alias triggers a DeprecationWarning when
# used.
server_url = env_with_legacy_alias(
"JUNIPER_CASCOR_WORKER_SERVER_URL", # new canonical name
"CASCOR_SERVER_URL", # legacy alias (deprecated)
default="", # returned if neither is set
)
Behaviour:
| env state | returns | warning? |
|---|---|---|
JUNIPER_CASCOR_WORKER_SERVER_URL set |
its value | none |
only CASCOR_SERVER_URL set |
its value | one DepW |
| both set | JUNIPER_CASCOR_WORKER_SERVER_URL val |
none |
| neither set | "" (the default) |
none |
The DeprecationWarning text names both env-var names so operators can
mechanically fix configuration. The warning is emitted with
stacklevel=2 so the warning's reported location is the caller's,
not this package's internals.
API
env_with_legacy_alias(new_name, legacy_name=None, default=None)
| Parameter | Type | Default | Meaning |
|---|---|---|---|
new_name |
str |
required | Canonical env-var name. Always checked first. |
legacy_name |
str | None |
None |
Optional legacy alias. Pass None to disable. |
default |
str | None |
None |
Value when neither env var is set. |
Returns str | None.
Why a separate package?
This package exists because juniper-cascor-worker cannot adopt
juniper-observability (which requires pydantic) without breaking its
load-bearing no-Pydantic-at-runtime invariant.
For consumers that already use pydantic-settings (juniper-cascor,
juniper-canopy, juniper-data), this package is not a replacement —
the pydantic field-validator pattern in their Settings classes is the
right shape there. This package serves the constrained-runtime case.
Versioning
juniper-config-tools follows Semantic Versioning.
Public API surface in 0.1.0 is a single function: env_with_legacy_alias.
Consumers pin with juniper-config-tools>=0.1.0,<0.2.0 to opt out of
future API growth that may add new functions without breaking changes.
License
MIT — see LICENSE.
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 juniper_config_tools-0.1.0.tar.gz.
File metadata
- Download URL: juniper_config_tools-0.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a634a6990f164cbcecfa815535b43a0d3bc5e3794f2c05630c1f788c469b2db
|
|
| MD5 |
ceb7b644cd8dc487fb77f55956be0af5
|
|
| BLAKE2b-256 |
4e334d2be620499b316f3a0768afa986489d3a34bf558eb3cf2dfaaaa3297470
|
Provenance
The following attestation bundles were made for juniper_config_tools-0.1.0.tar.gz:
Publisher:
publish-config-tools.yml on pcalnon/juniper-ml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
juniper_config_tools-0.1.0.tar.gz -
Subject digest:
1a634a6990f164cbcecfa815535b43a0d3bc5e3794f2c05630c1f788c469b2db - Sigstore transparency entry: 1610318699
- Sigstore integration time:
-
Permalink:
pcalnon/juniper-ml@faa25a10adf76b61172d97801b34a66e111d1b28 -
Branch / Tag:
refs/tags/juniper-config-tools-v0.1.0 - Owner: https://github.com/pcalnon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-config-tools.yml@faa25a10adf76b61172d97801b34a66e111d1b28 -
Trigger Event:
push
-
Statement type:
File details
Details for the file juniper_config_tools-0.1.0-py3-none-any.whl.
File metadata
- Download URL: juniper_config_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca26aafca5ed59390347a26ca2705b93d30e73260f5a5e01cab033787793c4c8
|
|
| MD5 |
871613dbb2cd5e444592e1146551becd
|
|
| BLAKE2b-256 |
617937ee6129959f7106eebe84dd09f5c778e05715d97a9c8acd4ff6c095ac04
|
Provenance
The following attestation bundles were made for juniper_config_tools-0.1.0-py3-none-any.whl:
Publisher:
publish-config-tools.yml on pcalnon/juniper-ml
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
juniper_config_tools-0.1.0-py3-none-any.whl -
Subject digest:
ca26aafca5ed59390347a26ca2705b93d30e73260f5a5e01cab033787793c4c8 - Sigstore transparency entry: 1610318981
- Sigstore integration time:
-
Permalink:
pcalnon/juniper-ml@faa25a10adf76b61172d97801b34a66e111d1b28 -
Branch / Tag:
refs/tags/juniper-config-tools-v0.1.0 - Owner: https://github.com/pcalnon
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-config-tools.yml@faa25a10adf76b61172d97801b34a66e111d1b28 -
Trigger Event:
push
-
Statement type: