Repository navigation
Remove deprecated aliases, after a 1.x release that warns about them #314
Description
AGENTS.md's rule "A public rename ships a silent alias" (AGENTS.md:51-53) means none of the old names warns today, so deleting them in 2.0 would break importers with no notice. A last 1.x minor that emits DeprecationWarning on each of them gives that notice; 2.0 then deletes them.
| Name | Where | Since | Use instead |
|---|---|---|---|
OpentelemetryConfig |
lite_bootstrap/instruments/opentelemetry_instrument.py:372-373 |
1.0.0 (#103) | OpenTelemetryConfig |
FreeBootstrapperConfig |
lite_bootstrap/bootstrappers/free_bootstrapper.py:37-38, re-exported at lite_bootstrap/__init__.py:4,27 |
1.0.0 (#103) | FreeConfig |
IGNORED_STRUCTLOG_ATTRIBUTES |
lite_bootstrap/instruments/sentry_instrument.py:28-30 |
1.2.0 (#129) | logging_factory.STRUCTLOG_META_KEYS |
_RENAMED_ATTRIBUTES forwarding of not_ready_message and check_dependencies on instruments |
lite_bootstrap/instruments/base.py:38-56 |
1.6.0 (#196) | not_configured_reason, dependencies_installed |
AddressProtocol, RequestProtocol, ScopeType |
defined at lite_bootstrap/instruments/logging_factory.py:15-27, re-exported at logging_instrument.py:9-15,56-64 |
1.0.0 (#99) | none; nothing in lite_bootstrap, tests or docs uses them |
MemoryLoggerFactory stays exported from logging_instrument, because the module uses it itself and tests/instruments/test_logging_instrument.py:13 imports it from there. InstrumentSkippedWarning also stays: tests/conftest.py:22-30 filters on it.
Work
1.x release first:
- Test first: one test per name that accessing it raises a
DeprecationWarningnaming the replacement (pytest.warns), and that a subclass definingnot_ready_messageorcheck_dependencieswarns at class creation. All fail today. - Replace each alias assignment with a module
__getattr__that warns and returns the new object. ForFreeBootstrapperConfig, do it in bothfree_bootstrapper.pyandlite_bootstrap/__init__.py, and drop it from__all__sofrom lite_bootstrap import *does not warn. If Import bootstrappers lazily from lite_bootstrap/__init__.py #308 lands first, the package-level__getattr__already exists. - In
BaseInstrument.__init_subclass__, warn when a legacy name is forwarded. Usewarn_at_callerwithcategory=DeprecationWarning. - The alias rule in
AGENTS.md:51-53(a rename ships an alias that warns for one minor and goes in the next major) is rewritten by Write the versioning policy into AGENTS.md #323, which owns that text.
2.0:
- Delete the five items above,
_RENAMED_ATTRIBUTESand the__init_subclass__override with it, and the protocol definitions inlogging_factory.py. - Delete
tests/instruments/test_base_instrument.py:13-42and the CONTEXT.md sentence atCONTEXT.md:39-40("An instrument written against the oldnot_ready_messagestill works"). AGENTS.md:53usesOpentelemetryConfigas the worked example of the alias rule; pick another example or describe the pattern without one.
Verify: the 1.x tests pass with no other warnings, and after the 2.0 removal grep finds none of the names outside the changelog.
Breaking in 2.0 for code importing any of these names, and for out-of-tree instruments that still define not_ready_message or check_dependencies: their skip reason goes empty and their dependency check silently returns True.
Activity