Backward compatibility shims and deprecation wrappers
Project description
scitex-compat
Backward compatibility shims and deprecation wrappers for the SciTeX ecosystem.
Full Documentation · uv pip install scitex-compat[all]
Problem and Solution
| # | Problem | Solution |
|---|---|---|
| 1 | Renaming a public API silently breaks users — there's no stdlib way to say "this still works but is deprecated" | @deprecated decorator — emits DeprecationWarning with a reason= hint; optional forward_to= redirects the call to the replacement so old code-paths keep working transparently |
| 2 | Migrating legacy notify() calls — old scripts reference functions whose home moved |
Compat shims — notify, notify_async still callable, forward to the new home, warn once |
| 3 | Layer-0 leaves can't pull numpy just to mark an API deprecated |
scitex-compat has zero runtime deps (pure stdlib). It is the canonical home for @deprecated in the SciTeX ecosystem — see ADR-0001 |
Installation
pip install scitex-compat
Architecture
scitex-compat is the SSOT (single source of truth) for the
@deprecated decorator across the SciTeX ecosystem. Other packages
(notably scitex-decorators) re-export from here, so there is exactly
one implementation to fix bugs in or extend.
scitex-compat/
├── src/scitex_compat/
│ ├── __init__.py # deprecated, notify, notify_async
│ └── _compat.py # @deprecated impl + notify/notify_async shims
├── docs/adr/
│ └── 0001-canonical-deprecated-decorator.md # SSOT decision
└── tests/
See also: scitex-decorators ADR-0001
documenting the re-export contract from the other side.
Quick Start
from scitex_compat import deprecated
# 1. Warn-only form
@deprecated(reason="use new_function instead; removed in 3.0")
def old_function():
pass
# 2. Forwarding form — redirects calls to the new location
@deprecated(reason="moved to scitex.session.start", forward_to="..session.start")
def start():
pass
1 Interfaces
Python API
from scitex_compat import deprecated, notify, notify_async
# Warn-only: emits DeprecationWarning, still calls the wrapped body.
@deprecated(reason="use new_func instead")
def old_func(*args, **kwargs):
...
# Forwarding: warning + transparent redirect via importlib.
# forward_to may be absolute ("pkg.mod.func") or relative ("..mod.func")
# resolved against the decorated function's __module__.
@deprecated(reason="moved", forward_to="scitex_other.mod.replacement")
def renamed_func(*args, **kwargs):
...
# Compat shims (forward to scitex.notify if installed)
notify("hello")
await notify_async("hello")
Demo
sequenceDiagram
participant U as user code
participant O as old_func (deprecated)
participant N as new_func
participant W as warnings
U->>O: old_func(x=1)
O->>W: DeprecationWarning("old_func is deprecated: <reason>")
O->>N: importlib resolves forward_to → new_func(x=1)
N-->>U: result
Note over U,N: One release later, old_func can be removed.
Part of SciTeX
scitex-compat is part of SciTeX. Install via
the umbrella with pip install scitex[compat] to use as
scitex.compat (Python) or scitex compat ... (CLI).
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
License
AGPL-3.0
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 scitex_compat-0.1.9.tar.gz.
File metadata
- Download URL: scitex_compat-0.1.9.tar.gz
- Upload date:
- Size: 8.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7be4ef6725e3df51e5f3759342f194c996ddff7b4eb89e5f89d6af00417ab798
|
|
| MD5 |
d1e6a3165f7e4dab1d81a16e2a071c13
|
|
| BLAKE2b-256 |
f8333d7ecc2ab42468dbe598a5bf0842574f389c3dda80c4378bd26e9df2ee6a
|
Provenance
The following attestation bundles were made for scitex_compat-0.1.9.tar.gz:
Publisher:
pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-compat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_compat-0.1.9.tar.gz -
Subject digest:
7be4ef6725e3df51e5f3759342f194c996ddff7b4eb89e5f89d6af00417ab798 - Sigstore transparency entry: 1864742524
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-compat@9f4e9830a6f024ab0e1d54c7b3be6111a744b16a -
Branch / Tag:
refs/tags/v0.1.9 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-and-github-release-on-tag.yml@9f4e9830a6f024ab0e1d54c7b3be6111a744b16a -
Trigger Event:
push
-
Statement type:
File details
Details for the file scitex_compat-0.1.9-py3-none-any.whl.
File metadata
- Download URL: scitex_compat-0.1.9-py3-none-any.whl
- Upload date:
- Size: 8.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
317cbcae8624545b1aa3fc70ac4a24c7d9e0e9f3a80f0c5950f497bb60a00af3
|
|
| MD5 |
0585da2ed8ef2d574f72cac76bfb662d
|
|
| BLAKE2b-256 |
175a55ce9a8f0f0a6297023222f098f4e87697b312e3879a3ac9c24ffe7970f7
|
Provenance
The following attestation bundles were made for scitex_compat-0.1.9-py3-none-any.whl:
Publisher:
pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-compat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_compat-0.1.9-py3-none-any.whl -
Subject digest:
317cbcae8624545b1aa3fc70ac4a24c7d9e0e9f3a80f0c5950f497bb60a00af3 - Sigstore transparency entry: 1864742567
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-compat@9f4e9830a6f024ab0e1d54c7b3be6111a744b16a -
Branch / Tag:
refs/tags/v0.1.9 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-and-github-release-on-tag.yml@9f4e9830a6f024ab0e1d54c7b3be6111a744b16a -
Trigger Event:
push
-
Statement type: