refactor(platform): add uipath.platform.constants as the single source of truth#1781
Merged
Merged
Conversation
be39460 to
8990ca1
Compare
…e of truth Establishes a cheap-to-import home for shared constants and makes the platform package import lazily so the CLI/agent-runtime hot paths don't pay for the full service layer just to read a constant. - Add `uipath.platform.constants` (a `constants/` package sibling to `common/`) as the single source of truth for the shared string constants. - Make `uipath/platform/__init__.py` lazy (PEP 562): `UiPath` and the config types resolve on attribute access, so importing `uipath.platform.constants` no longer pulls in the service layer. Cold `import uipath.platform.constants` drops ~273ms -> ~6ms and imports neither httpx nor pydantic. - Deprecate BOTH re-export paths — `uipath.platform.common.constants` and `uipath._utils.constants` now forward to `uipath.platform.constants` and emit a FutureWarning pointing there. - Migrate every internal importer (source + tests, both packages) to `uipath.platform.constants`, so the SDK/CLI never trips its own deprecation warning (`import uipath._cli` is warning-free). - Tests: parity + deprecation tests and structural invariants for the constants module; cover ConfigurationManager env-var/path properties. - Document `uipath.platform.constants` in the uipath-platform README. External consumers importing `uipath.platform.common.constants` keep working (with a deprecation warning). `uipath.eval.constants` is a separate, unrelated module and is untouched. `uipath-core` is unchanged. Version bumps: uipath-platform 0.1.88 -> 0.1.89, uipath 2.12.2 -> 2.12.3 (uipath's platform pin -> >=0.1.89). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…stants blurb Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a70e452 to
0c1ea75
Compare
|
radu-mocanu
approved these changes
Jul 1, 2026
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.



Summary
Gives shared constants a cheap-to-import home and makes the platform package import lazily, so CLI / agent-runtime hot paths don't pay for the full service layer just to read a constant.
uipath.platform.constants— aconstants/package sibling tocommon/, the single source of truth for the shared string constants.uipath/platform/__init__.py(PEP 562) —UiPathand the config types resolve on attribute access, so importinguipath.platform.constantsno longer drags in the service layer. Coldimport uipath.platform.constantsdrops ~273ms → ~6ms and pulls in neither httpx nor pydantic.uipath.platform.common.constantsanduipath._utils.constantsforward touipath.platform.constantsand emit aFutureWarning.uipath.platform.constants, so the SDK/CLI never trips its own deprecation warning —import uipath._cliis warning-free.ConfigurationManagerenv-var/path properties.Compatibility
uipath.platform.common.constantskeep working (with a deprecation warning).uipath.eval.constantsis a separate, unrelated module — untouched.uipath-coreis unchanged by this PR.Version bumps
uipath-platform0.1.88 → 0.1.89uipath2.12.3 → 2.12.4 (platform pin →>=0.1.89)uipath-coreunchanged (0.5.28)Testing
src+testsfor all three packages.import uipath.platform.constants= ~6ms with no httpx/pydantic;from uipath.platform import UiPathstill works (lazy);import uipath._cliemits no deprecation warning; both deprecated paths warn when imported directly; shim ↔ canonical parity holds.🤖 Generated with Claude Code