Skip to main content

Backward compatibility shims and deprecation wrappers

Project description

scitex-compat

SciTeX

Backward compatibility shims and deprecation wrappers for the SciTeX ecosystem.

Full Documentation · uv pip install scitex-compat[all]

pypi python docs

tests install-check cov


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 shimsnotify, 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

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. 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


SciTeX

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scitex_compat-0.1.9.tar.gz (8.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_compat-0.1.9-py3-none-any.whl (8.5 MB view details)

Uploaded Python 3

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

Hashes for scitex_compat-0.1.9.tar.gz
Algorithm Hash digest
SHA256 7be4ef6725e3df51e5f3759342f194c996ddff7b4eb89e5f89d6af00417ab798
MD5 d1e6a3165f7e4dab1d81a16e2a071c13
BLAKE2b-256 f8333d7ecc2ab42468dbe598a5bf0842574f389c3dda80c4378bd26e9df2ee6a

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for scitex_compat-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 317cbcae8624545b1aa3fc70ac4a24c7d9e0e9f3a80f0c5950f497bb60a00af3
MD5 0585da2ed8ef2d574f72cac76bfb662d
BLAKE2b-256 175a55ce9a8f0f0a6297023222f098f4e87697b312e3879a3ac9c24ffe7970f7

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page