Skip to content

chore: pin exchange-calendars and narrow SQLAlchemy and mypy ranges - #64

Closed
kcrmin wants to merge 3 commits into
developfrom
chore/harden-dependency-ranges
Closed

kcrmin wants to merge 3 commits into
developfrom
chore/harden-dependency-ranges

Conversation

@kcrmin

@kcrmin kcrmin commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Superseded by #66.

kcrmin and others added 2 commits October 26, 2026 21:47
market_pipeline_lib.reference.sessions raises CalendarSourceDrift for any
installed pandas-market-calendars other than XNYS_CALENDAR_LIBRARY_VERSION
(5.4.0), but pyproject allowed >=5.4,<6. Since 5.5.0 was published on
2026-10-05, a fresh install (CI and the production image) resolves 5.5.0:
11 reference-catalog unit tests and 6 integration tests fail, and
xnys_sessions() raises inside the built image.

Pin the exact release the XNYS boundaries were verified against, with a
note that the pin and the constant must move together.

Verified on CPython 3.12.13: ruff, mypy, gate3 (1090 passed, coverage
89.10%), gate8 with Testcontainers PostgreSQL 16 + LocalStack (160 passed,
0 skipped), and the production image reports 5.4.0 and classifies
2024-11-27..30 correctly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up hardening to the pandas-market-calendars 5.4.0 pin.

exchange-calendars: pandas-market-calendars 5.4.0 resolves "XNYS" through
calendars/mirror.py, which takes holidays, special closes and session
times from exchange-calendars. That dependency was unconstrained
(pmc only requires >=3.3), so the pmc pin did not freeze the XNYS
boundaries. Pin exchange-calendars==4.13.2 (what CI resolves; the pinned
2024 XNYS facts pass on it) and extend the CalendarSourceDrift refusal
in xnys_sessions to XNYS_EXCHANGE_CALENDARS_VERSION.

The calendar_version label stays XNYS/mcal-5.4.0. The drift refusal
already ties it to one (pmc, xcals) pair, while renaming it would re-key
every trading_sessions row id and leave a database holding two XNYS
versions, which the superproject replay oracle rejects. The next bump of
either release mints a label that names both.

A new test asserts the installed distribution's runtime requirements pin
exactly XNYS_CALENDAR_LIBRARY_VERSION and XNYS_EXCHANGE_CALENDARS_VERSION,
so a range can no longer reach a fresh install unnoticed.

SQLAlchemy: narrow <3 to <2.2. 2.1 retyped Result, enough to fail a type
gate, so the next minor is a deliberate bump. The suites pass on 2.1.6.

mypy: pin ==2.3.0, the release backtest-engine pins (it floated to 2.4.0).
Annotate the two latent scalar_one() sites in legacy_bootstrap.py that
mypy 2.3.0 reports as var-annotated under SQLAlchemy 2.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the pin directly below `pandas-market-calendars==5.4.0` and its
comment, so the two releases the XNYS drift check covers sit together.
No dependency change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kcrmin kcrmin mentioned this pull request Oct 26, 2026
3 tasks done
@kcrmin kcrmin closed this Oct 26, 2026
@kcrmin
kcrmin deleted the chore/harden-dependency-ranges branch October 26, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant