Repository navigation
perf(core): add lazy imports, __slots__, TLS context caching, and lazy sessions - #175
Draft
skupriienko wants to merge 1 commit into
Draft
skupriienko wants to merge 1 commit into
skupriienko wants to merge 1 commit into
Conversation
This was referenced Nov 15, 2026
skupriienko
marked this pull request as draft
November 15, 2026 16:01
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack (v1.9.2 Hardening Rollout)
master<-wave-1-tooling-hygieneCRIT-03,CRIT-04,CRIT-05,HIGH-06wave-1-tooling-hygiene<-wave-2-transport-redactionCRIT-01,CRIT-02,HIGH-01(lock),HIGH-02,HIGH-03,HIGH-04(path),OPT-09wave-2-transport-redaction<-wave-3-boot-slots-poolingOPT-01..OPT-07,OPT-10,OPT-11,HIGH-01(warn_unclosed)wave-3-boot-slots-pooling<-wave-4-builders-semverHIGH-04(bool/stream),HIGH-05,HIGH-07,OPT-08wave-4-builders-semver<-wave-5-typing-stateful-testsMOD-02,MOD-04Merge in order: #173 -> #174 -> #175 -> #176 -> #177.
Note
Stacked PR workflow note:
ClusterFuzzLite PR fuzzingruns immediately on all PRs. Workflows scoped tobranches: [master](CI,PR Validation,Continuous Security Verification,CodeQL) trigger automatically as parent PRs merge intomasterand GitHub retargets this PR's base branch tomaster.Summary
Wave 3 of 5 for
v1.9.2(stacked on #174 /wave-2-transport-redaction). Reduces cold-boot import overhead via PEP 562 lazy top-level exports and isolatedutils/transport_security.py, applies__slots__acrossClient,Config,Endpoint, and builders (slotscheck-clean across 30 classes), makesrequests.Sessionlazy onClient, cachesTLSv1_2+SSLContextinstances keyed by(ca_bundle, st_mtime_ns, st_size), and adds opt-inConfig.warn_unclosed=Falselifecycle warnings.Actions
mailjet_rest/__init__.py,mailjet_rest/utils/transport_security.py,mailjet_rest/utils/guardrails.py,OPT-01..OPT-05,OPT-10):mailjet_rest/__init__.pywith PEP 562__getattr__lazy resolution andTYPE_CHECKINGstubs.SecretAuth,SecureHTTPAdapter, andJitterRetryintomailjet_rest/utils/transport_security.pyand cachedTLSv1_2+SSLContextinstances keyed by(ca_bundle, st_mtime_ns, st_size)so CA file updates invalidate cleanly.__slots__, Lazy Session Allocation & Opt-In Close Warnings (mailjet_rest/client.py,mailjet_rest/config.py,mailjet_rest/endpoint.py,mailjet_rest/builders.py,OPT-06,OPT-07,OPT-11,HIGH-01):__slots__across SDK configuration, endpoint, client, and builder classes (keepingSecretAuthunslotted perrequests.auth.AuthBaseforslotscheckcompliance).requests.Sessioncreation until the first request and addedConfig.warn_unclosed: bool = FalseinClient.__del__for opt-inResourceWarningdiagnostics without breaking existing1.xtest suites.tests/unit/test_boot_and_slots.py,tests/property/test_client_properties.py):slotscheckguarantees,SSLContextcache invalidation on CA changes, lazy session creation, andConfig.warn_unclosed.Verification & Testing
v1.9.2stack:ruff check .,ruff format --check .,mypy --strict mailjet_rest,pyright mailjet_rest,slotscheck -m mailjet_rest(13modules,30classes,0errors),python tests/test_boot.py(0.544scProfile /0.8364swall),pytest -q tests/test_perf.py(6 passed), andpytest -n auto -W error tests/unit tests/property tests/regression.pytest -m network,samples/smoke_readme_runner.py) were skipped locally due to absentMJ_APIKEY_PUBLIC/MJ_APIKEY_PRIVATEcredentials.