Skip to content

feat: deprecate analytics environment routing - #16

Merged
francoischalifour merged 2 commits into
mainfrom
feat/environment-routing-pr
Nov 9, 2026
Merged

francoischalifour merged 2 commits into
mainfrom
feat/environment-routing-pr

Conversation

@francoischalifour

@francoischalifour francoischalifour commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

What

Ignore the environment constructor argument. It is now Optional[str] and still accepted positionally or by name so existing calls keep working, but it is ignored, not stored on the client, and emits no warning. A single helper strips top-level environment from track, identify, and alias requests, including raw batches, without mutating caller dictionaries or removing nested business properties. README gains a short note on the deprecation.

Why

An environment-bound Product Analytics API key now selects the destination. Callers using unbound legacy keys must replace them before upgrading.

Stacked on #15 (audience collection); this PR contains only the environment slice.

Checklist

  • Public client tests cover that the argument is accepted silently, omission of environment from track/identify/alias and batch requests, preserved nested properties, and caller input ownership.
  • Changelog and README updated; the compatibility impact (unbound keys require migration) is documented.

@francoischalifour

Copy link
Copy Markdown
Member Author

Rebased on the updated audience PR. environment is now an Optional[str] emitting a DeprecationWarning, stripped in one place before serialization. The README migration guide is reduced to a short paragraph; full migration docs will live on the official docs site.

Comment thread src/altertable/client.py Outdated
if environment is not None:
warnings.warn("The environment is determined by your API key. Remove the `environment` argument.", DeprecationWarning, stacklevel=2)
# Kept for existing callers; it no longer controls routing or appears in requests.
self.environment = "production" if environment is None else environment

@leonkenneth leonkenneth Nov 9, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this TBH I think it's confusing and rather return a magic string or just remove, it's not a real breaking change I think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, just remove everything (both the value and the warning)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: removed both the environment attribute and the DeprecationWarning. The constructor still accepts the argument (positionally too) so existing calls keep working, but it is ignored and never sent. I also removed the one-time RuntimeWarning for ignored identify/alias calls in #15, since we do not log on the backend.

@francoischalifour
francoischalifour force-pushed the feat/environment-routing-pr branch from 6c955aa to d87da45 Compare November 9, 2026 14:41
@francoischalifour
francoischalifour changed the base branch from feat/audience-collection-pr to main November 9, 2026 14:43
@francoischalifour
francoischalifour force-pushed the feat/environment-routing-pr branch from d87da45 to d7589fe Compare November 9, 2026 14:44
@francoischalifour
francoischalifour merged commit 0bac9a6 into main Nov 9, 2026
9 checks passed
@francoischalifour
francoischalifour deleted the feat/environment-routing-pr branch November 9, 2026 14:48
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.

4 participants