Skip to content

chore(release): v2.10.0 - #291

Merged
MarTrepodi merged 67 commits into
mainfrom
release/v2.10.0
Dec 5, 2026
Merged

MarTrepodi merged 67 commits into
mainfrom
release/v2.10.0

Conversation

@MarTrepodi

Copy link
Copy Markdown
Collaborator

Automated release prep for v2.10.0. CHANGELOG.md regenerated via git-changelog.

Merging promotes develop -> main with the changelog already in place.
Afterwards, run the release workflow on main to build, publish, and tag v2.10.0.

No open issues are referenced by the 13 pull requests merged since v2.9.0.


v2.10.0 (2026-12-05)

Features

  • core: warn on spellings removed in v3 and teach swgoh-migrate to find them (0f4a94b)
  • core: make network failures identifiable and controllable (b99e574)
  • typing: expose real client constructor and aliased method signatures (7596499)
  • client: add health checks and deprecate get_name_spaces (cd25bd4)
  • core: publish the enums cache as one CachedEnums record (f507275)
  • flag httpx usage in swgoh-migrate (d3df234)
  • deps: switch to httpx2 with a deprecated httpx fallback (af0e5ba)

Bug Fixes

  • helpers: return the playable unit from get_unit_from_skill and name all 18 omicron modes (b0dece9)
  • statcalc: handle raw crew, unknown roster units and missing async game data (6644189)
  • core: stop an unrecognised items name silently fetching all game data (06faf6e)
  • statcalc: replace game data atomically and keep one data set per calculation (a141de7)

Code Refactoring

  • core: import httpx through a single backend module (56fc26a)

Performance Improvements

  • statcalc: run async calculations on a per-calculator executor (f2d174e)
  • helpers: cut the GAC bracket scan's requests (3845fcd)
  • helpers: make get_function_name cheap and stop eager debug formatting (12261cf)
  • statcalc: memoize skill GP and update base stats in place (5d4c542)

Docs

  • give each class one heading on the StatCalc and Exceptions API pages (0bd4ad6)
  • helpers: give each helper one heading on the API page (003e6ec)
  • state free-threaded Python support (beta) in the README and docs home (b59718b)
  • helpers: use plain wording for payload values and rate limits (4edbdb1)
  • helpers: describe missing fields in terms of the service response (78ec652)
  • add configuration, retries, errors and game data guides for 2.10 (42daeb6)
  • examples: pass the Comlink port as an integer (1448864)
  • say which httpx the http_mock table means (a6cef60)
  • document what can be shared between threads (3c27829)
  • document the httpx2 migration (2f35b6f)

MarTrepodi and others added 30 commits November 23, 2026 09:39
…193045502

chore: back-merge main into develop
Bumps the astral-tools group with 1 update: [ty](https://github.com/astral-sh/ty).


Updates `ty` from 0.0.107 to 0.0.112
- [Release notes](https://github.com/astral-sh/ty/releases)
- [Changelog](https://github.com/astral-sh/ty/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ty@0.0.107...0.0.112)

---
updated-dependencies:
- dependency-name: ty
  dependency-version: 0.0.112
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: astral-tools
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps the python group with 1 update: [certifi](https://github.com/certifi/python-certifi).


Updates `certifi` from 2026.10.23 to 2026.11.20
- [Commits](certifi/python-certifi@2026.10.23...2026.11.20)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.11.20
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python
...

Signed-off-by: dependabot[bot] <support@github.com>
…-tools-6ed2090e70

chore(deps): Bump ty from 0.0.107 to 0.0.112 in the astral-tools group
…-fabf1a45b2

chore(deps): Bump certifi from 2026.10.23 to 2026.11.20 in the python group
Every module now imports httpx from `swgoh_comlink._http` instead of
importing it directly. The HTTP package is chosen in one place, and
tests can take the same module object the clients use, so their mocks
and exception types always match. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an `http_mock` fixture backed by `tests/http_mock.py` and drop the
pytest-httpx dependency. The fixture patches `HTTPTransport.handle_request`
and `AsyncHTTPTransport.handle_async_request` on the HTTP package the
clients use (`swgoh_comlink._http`). Base URLs, headers, redirects,
decoding and streaming therefore still run for real.

It implements only what the suite uses: `add_response`, `add_callback`,
`add_exception`, `get_requests`/`get_request`, `IteratorStream` and the
`http_mock(assert_all_responses_were_requested=...)` marker. Any other
matcher raises `TypeError`. The rules match the plugin it replaces:
responses are single-use unless reusable, unmatched requests fail, and
unrequested responses fail at teardown.

It also differs from the plugin in two ways:
- Matching is guarded by a lock, so clients driven from several threads
  never claim the same single-use response twice.
- A prebuilt response is made re-readable through the public `Response`
  API rather than by deleting private attributes.

`tests/unit/test_http_mock.py` checks that the harness fails where it
should. The rest of the suite changes only mechanically: the fixture is
renamed to `http_mock`, the type to `HTTPMock`, and httpx is imported
from `swgoh_comlink._http`. `tests` is now first-party for import
sorting, and CONTRIBUTING documents the fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test: replace pytest-httpx with an in-repo HTTP mock
The clients and StatCalc now run on httpx2, Pydantic's maintained fork
of httpx, which becomes the only core dependency (`httpx2>=2.16.2,<3`).
httpx and certifi are no longer installed by default.

`swgoh_comlink._http` picks the package once, at import:
- httpx2 by default;
- the legacy httpx package when `SWGOH_COMLINK_HTTP_BACKEND=httpx` is
  set, or when httpx2 cannot be imported;
- httpx2 when an application has called `httpx2.alias_httpx()`.
An unknown value for the variable raises `ImportError`.

Running on legacy httpx is deprecated and is removed in v3. Building a
client or downloading StatCalc game data on it emits the new
`SwgohComlinkDeprecationWarning` (a `FutureWarning`, so it shows by
default) at the caller's line. The `swgoh_comlink[httpx]` extra
installs httpx with the certifi floor; installing it alone does not
switch packages.

`limits=` takes an `httpx2.Limits`. A legacy `httpx.Limits` is converted
with the same warning, and an `httpx2.Limits` on the legacy package is
converted silently. Docstrings and doctests now name httpx2.

The test group installs the legacy extra so the fallback is tested in
every run. CI adds a unit job on legacy httpx, an integration job per
package, a check that the built wheel installs and imports neither
httpx nor certifi, and a StatCalc download on Linux, macOS and Windows,
because httpx2 verifies TLS against each OS's own trust store.

Refs #277

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three rules help code move to httpx2:
- DEP040 (INFO): `import httpx` / `from httpx import ...`;
- DEP041 (WARNING): `httpx.Limits`, `httpx.Response`, `httpx.HTTPStatusError`,
  `httpx.RequestError`, the clients and the transports, whose isinstance
  checks and except clauses never match httpx2 objects;
- DEP042 (INFO): `getLogger("httpx")` / `getLogger("httpcore...")`, whose
  settings no longer reach the library's requests.

DEP040 and DEP041 apply only to files that also import swgoh_comlink, so
a project's unrelated httpx code is not flagged. A rule's new optional
`requires` pattern expresses that file-level condition.

DEP002 and DEP003 no longer suggest httpx. DEP003 now points at
SwgohComlinkException: the clients wrap network errors in it, so the
HTTP library's own exception never reaches user code, as the migration
guide already says.

Refs #277

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add "v2.10: httpx2 replaces httpx" to the migration guide: who needs to
act, `limits=`, the HTTP objects that are now httpx2 types, the logger
rename, the OS trust store (and the SSL_CERT_FILE fix for images without
CA certificates), staying on httpx until v3, and alias_httpx().

Earlier sections that v2.10 makes wrong now say which package each
version used. The README gains an upgrade note and a `limits` row in the
parameter table. The logging guide shows how to quiet the httpx2 and
httpcore2 loggers. The exceptions and StatCalc API pages, SECURITY and
CONTRIBUTING name httpx2, and CONTRIBUTING shows how to run the suite on
the legacy package.

Refs #277

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feat(deps): switch to httpx2 with a deprecated httpx fallback
… calculation

set_game_data() assigned eight tables one at a time, with a full scan of the
payload between assignments. A calculation running in another thread could read
unit data from the previous game data and gear, relic, CR or GP tables from the
new one, and return a result matching neither, without raising.

The tables now live in one immutable _GameData object published by a single
assignment. Each public calc_* call keeps the game data it started with for its
whole duration, including the calc_* calls it makes on the same calculator.

The private table attributes (_unit_data, _gp_tables, ...) remain as read-only
views of the loaded data. Assigning one now raises AttributeError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the "Programming Language :: Python :: Free Threading :: 2 - Beta"
trove classifier. The package is pure Python and its runtime dependencies
do not re-enable the GIL on free-threaded CPython builds. Stay at Beta
until a free-threaded CI job has been running for a while.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add 3.14t to the test matrix and pin uv to the matrix interpreter through
UV_PYTHON, so the job runs on the free-threaded build rather than whichever
3.14 uv finds first. On free-threaded jobs, assert that importing the package
leaves the GIL disabled, which catches a dependency that ships a C extension
not marked free-threading safe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Threads and Event Loops guide covering the sync client, the async
client, the cached get_enums() dict and StatCalc, and link it from the
client and StatCalc pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With seven reader threads and the swapping thread, more threads than a CI
runner has cores, builds with the GIL spent nearly all their time handing
the GIL over at the test's 0.1 ms switch interval. Under coverage tracing on
Python 3.11 and 3.12 each set_game_data call ran 80 to 100 times slower and
the test ran past its 30 second timeout.

Three readers keep the swap overlapping calculations on every build: run
against the code before the fix, the test still reports mixed results in
every run on 3.11, 3.14 and 3.14t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The swap test made the swapping thread finish six set_game_data calls while
the reader threads calculated until it was done. On builds with the GIL under
coverage tracing, the scheduler could starve the swapping thread, so the test
ran for minutes and hit its timeout on the CI runners for 3.11 and 3.12 even
with three readers.

The readers now calculate for half a second and the swapping thread swaps
until they stop, so the test's length no longer depends on which thread the
scheduler favours: under coverage on 3.11 it takes under a second, even with
seven readers. Run against the code before the fix, it still reports mixed
results in every run on 3.11, 3.12, 3.14 and 3.14t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(statcalc): replace game data atomically and keep one data set per calculation
docs: document what can be shared between threads
ci: run the test suite on free-threaded Python 3.14t
build: declare free-threaded Python support (beta)
A full roster now calculates about 6 to 7% faster on 3.11, 3.14 and 3.14t,
with identical output.

- Each loaded game data keeps a memo of skill GP by (unit, skill, int tier).
  An entry depends only on the game data tables, so a reload starts with an
  empty memo and threads that fill the same entry store the same value.
  Only int tiers are memoized, since 8 and 8.0 share a dict key but are
  looked up in the tables as different keys.
- _calculate_base_stats and _get_char_raw_stats update the stat dicts
  directly instead of calling _add_stat per stat. Game data tables are
  str-keyed throughout, so their stat ids are used as keys as they are.
- Drop a repeated identical gear and relic table lookup, and precompute the
  powers of ten _floor divides by.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
perf(statcalc): memoize skill GP and update base stats in place
Tests import the HTTP package as httpx from swgoh_comlink._http, which
is httpx2 by default, so the table keeps that name and now says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_enums() stored its response and the game data version it was fetched
under as two attributes, written one after the other. A thread reading
enums and enums_version while another thread refreshed them could get the
new enums with the old version.

The response and version now live in one frozen CachedEnums record that
get_enums() replaces with a single assignment, and the new read-only
enums_cache property returns that record in one read. CachedEnums is
exported from swgoh_comlink.

enums and enums_version keep working as before: they read from the record,
and assigning one keeps the other's value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: document the httpx2 migration and flag httpx usage in swgoh-migrate
feat(core): publish the enums cache as one CachedEnums record
… data

get_game_data(items="units"), or a typo such as "Unitz", resolved to None in
Constants.get(), which _build_game_data_payload turned into "-1". Comlink then
returned every collection (hundreds of MB) instead of the one that was asked for.

- Constants.get() now matches names case-insensitively. The exact spelling is
  tried first, so every name that resolved before gives the same value; the
  case-insensitive match is used only when all matching names agree on one value.
- Constants.get() raises SwgohComlinkTypeError for a non-string argument instead
  of a raw TypeError. It subclasses TypeError, so existing handlers keep working.
- _build_game_data_payload still sends "-1" for a name that does not resolve, so
  the request is unchanged in 2.10, but it now emits a
  SwgohComlinkDeprecationWarning that names the input, says that all collections
  are being fetched, says this will raise in v3 and suggests close matches. The
  warning is attributed to the caller's code.
- Constants.get_names() lists only the names get() resolves, once each. It no
  longer lists the 13 lookup tables (LEAGUES, STATS, ...) that get() never
  resolved, nor the duplicate ALL.

A wrong-case name that used to fetch everything now fetches the named
collection.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
MarTrepodi and others added 27 commits December 1, 2026 22:04
The example read COMLINK_PORT from the environment and passed the string
straight to the client, whose port parameter is an int.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Six comments and docstrings in the helpers and their tests explained why a field
can be absent, or why a number can arrive quoted, by naming an encoding. Say
what the library sees instead: the service leaves the field out, or sends the
number quoted in some responses and bare in others.

Comments and docstrings only; no code changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Describe payload values by what the library receives: a large integer that may
arrive as a string, a list that may arrive as a single element, an enum name
prefixed with its type. Describe the game's rate limit per endpoint. Rename four
test ids to match the new term.

Comments, docstrings, one docs table and test ids only; no code changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Add four guide pages for behaviour that had no documentation: every constructor
argument and environment variable; RetryPolicy as a guide; the exception tree,
including the transport errors, and how to tell a request that was never sent
from one that may have been; and how to fetch game data economically, with the
measured cost of a full fetch and a table of the collections each helper needs.

Add an "Upgrading to 2.10" section to the migration guide that lists each
behaviour change with before, after and what to do. Update the README parameter
and method tables, and the exceptions, StatCalc, helpers and thread-safety pages,
for the transport errors, the StatCalcAsync worker threads, the health checks
and the helper fixes. Use example.com hosts in the documentation examples.

Correct the limits example in the client docstring and the migration guide: a
Limits field that is left out means no limit, not the default, so
Limits(keepalive_expiry=30) on its own also removed the connection caps.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ame all 18 omicron modes

- get_omicron_skill_tier, get_omicron_skills and is_omicron_skill raised KeyError
  when a field was missing from the response, and get_omicron_skills never
  matched a mode sent as a name (enums=True). They now read fields leniently,
  and a mode name selects the same skills as its number, whether it is the
  stored mode or the requested one.
- get_unit_from_skill matched any field value and returned the first row, so it
  could return a non-playable variant (a PVE_ mirror or an event copy). It now
  matches skillReference[].skillId only and prefers the playable unit.
- parse_swgoh_string emitted closing markup for tags that were never opened
  (</b>, </sub>, ** and so on). A closer with nothing open now emits nothing.
- calc_current_stamina raised a plain ValueError on unreadable numbers where
  its docstring promises SwgohComlinkValueError.
- get_current_gac_event raised KeyError on an event without a type and found no
  event when the type arrived as a name. It now reads the number, a numeric
  string or TERRITORY_TOURNAMENT_EVENT.
- OMICRON_MODE named 10 of the 18 omicron modes, so the documented
  OMICRON_MODE[mode] lookup raised KeyError for the rest. The eight missing
  modes are added; existing labels are unchanged.
- Relic and upgrade costs accepted an item type only as a number or a bare name.
  They now accept every spelling the item helpers accept, and a quantity that is
  not a number raises SwgohComlinkValueError.

get_unit_from_skill can return a different unit than before when a non-playable
variant precedes the playable unit in the list. get_omicron_breakdown labels the
eight newly named modes instead of "Mode <n>".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
get_gac_brackets spent 12 to 17 requests on a boundary search even with
limit=1, then downloaded every probed bracket a second time. The async fetch ran
in batches of 50 that each waited for their slowest request. A misspelt league
looked the same as an idle one.

- With limit set, skip the boundary search: fetch brackets from 0 and stop at the
  first empty one or at limit. The async version fetches bracket 0 alone, then
  slow-starts through phases of 1, 2, 4, ... brackets with at most 12 requests
  in flight, so a small league does not waste a full window past its last
  bracket.
- With no limit, keep every response the boundary search receives and fetch only
  the brackets it did not, so no bracket is requested twice. The async fetch is a
  sliding window of 50 that cancels the rest and re-raises the original error if
  one request fails.
- Log one warning for a league name that is not in Constants.LEAGUES. The name is
  still sent unchanged.

For a 2,000-bracket league the requests drop from 14, 23 and 513 to 1, 10 and
500 for a limit of 1, 10 and 500, and from 2013 to 2003 with no limit. A limited
async scan of a large league takes longer than before, because it runs 12 wide
instead of 50. With limit set the scan stops at the first empty bracket, where it
used to return every bracket up to the limit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s home

The package has declared free-threaded support in its metadata and run its
test suite on Python 3.14t since the thread-safety work, but neither the
README nor the docs home page said so. Both now state it next to the Python
version requirement and link the Threads and Event Loops guide.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every entry on the Helpers page had a hand-written heading followed by a
generated one for the same object, so each name appeared twice in the page
and in its table of contents, with the generated heading ranked above the
section it belonged to. DataItems also showed its description, examples and
notes twice, once from the page and once from the class docstring.

The hand-written headings stay, so existing links to them keep working. The
generated heading is hidden where a hand-written one names the same object,
and result types listed under a helper now sit one level below it. The
DataItems section keeps its guide and lists only members() from the class.

get_enum_key_by_value and get_playable_units documented no parameters, so
the generated heading was the only place their arguments appeared. Both
docstrings now describe their arguments and return value.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…pages

The API Reference sections of both pages had a hand-written heading for
each class followed by a generated one with the same name, ranked above the
section it belonged to. The generated heading is now hidden and each class's
methods sit one level below its hand-written heading.

On the Helpers page, the methods of ItemNames were left at the top heading
level by the previous change; they now sit under ItemNames.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@MarTrepodi
MarTrepodi merged commit 99c131b into main Dec 5, 2026
22 checks passed
@MarTrepodi
MarTrepodi deleted the release/v2.10.0 branch December 5, 2026 00:29
@MarTrepodi MarTrepodi mentioned this pull request Dec 5, 2026
6 of 18 tasks
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