Skip to content

Use module-qualified imports for storage.memory.propindex - #302

Merged
Bernhard Merkle (bmerkle) merged 1 commit into
microsoft:mainfrom
bmerkle:fix-import-style-propindex
Sep 28, 2026
Merged

Bernhard Merkle (bmerkle) merged 1 commit into
microsoft:mainfrom
bmerkle:fix-import-style-propindex

Conversation

@bmerkle

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • make (format, check on 3.12/3.14, test, build) — 0 pyright errors, 737 passed / 12 skipped, wheel builds

Copilot AI review requested due to automatic review settings August 1, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Aligns storage.memory.propindex usage with the repository’s module-qualified import style by switching low-frequency function/class imports to propindex.<symbol> while keeping PropertyNames as a direct import where it’s used heavily.

Changes:

  • Switched call sites to from ...storage.memory import propindex and updated calls to be module-qualified (propindex.*).
  • Updated in-memory provider to construct and type-annotate the property index via propindex.PropertyIndex.
  • Updated sqlite property index to call make_property_term_text / split_property_term_text via the module import.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/typeagent/storage/sqlite/propindex.py Replaces direct function imports from memory propindex with a module import and qualified calls.
src/typeagent/storage/memory/provider.py Uses module-qualified propindex.PropertyIndex for instantiation and type annotation.
src/typeagent/knowpro/secindex.py Uses propindex.build_property_index(...) instead of importing the function directly.
src/typeagent/knowpro/query.py Uses propindex.lookup_property_in_property_index(...) while keeping PropertyNames as a direct import.

@bmerkle

Copy link
Copy Markdown
Collaborator Author

robgruen would you mind taking a look at this one when you get a chance? Thanks!

propindex (memory variant) exports a mix of an enum, several
functions, and a class. Per AGENTS.md's import style guidelines,
low-frequency symbols default to module-qualified:

- query.py: lookup_property_in_property_index
- secindex.py: build_property_index
- storage/memory/provider.py: PropertyIndex
- storage/sqlite/propindex.py: make_property_term_text,
  split_property_term_text (cross-imported from the memory variant)

PropertyNames is left as a direct-symbol import everywhere (query.py,
searchlang.py, searchlib.py): it's used 20+ times across those files,
squarely matching the "avoiding severe repetitive visual clutter"
exception in AGENTS.md.

The sqlite variant's own class (SqlitePropertyIndex) exports a single
class and is left as direct-symbol import, already compliant.

Scope: src/typeagent only, per microsoft#298.

Phase 2 (2/3) of the import-consistency cleanup tracked in microsoft#298.
@bmerkle

Copy link
Copy Markdown
Collaborator Author

robgruen for rewiew/approval: refactorings

@bmerkle
Bernhard Merkle (bmerkle) merged commit 3b186c8 into microsoft:main Sep 28, 2026
21 checks passed
Bernhard Merkle (bmerkle) added a commit that referenced this pull request Sep 28, 2026
## Summary
- `semrefindex` (memory variant) is overwhelmingly function-oriented (18
functions + 1 class), so per the import style guidelines in
#299/AGENTS.md it defaults to module-qualified.
- Converts the remaining low-frequency direct-symbol call sites:
- `knowpro/add_messages.py`: `collect_action_terms`,
`collect_entity_terms`
  - `mcp/server.py`: `TermToSemanticRefIndex`
  - `storage/memory/provider.py`: `TermToSemanticRefIndex`
- `conversation_base.py` already used `from ..storage.memory import
semrefindex` + qualified calls for its 4 function usages, so no change
was needed there — this PR brings the rest of `src/typeagent` in line
with that existing convention.
- The sqlite variant's own class (`SqliteTermToSemanticRefIndex`)
exports a single class and is left as direct-symbol import — already
compliant, no change.
- Scope: `src/typeagent` only, per #298.
- Phase 2 (3/3, final) of the import-consistency cleanup tracked in
#298. Companion PRs: #301 (reltermsindex), #302 (propindex).

## Test plan
- [x] `make` (format, check on 3.12/3.14, test, build) — 0 pyright
errors, 737 passed / 12 skipped, wheel builds

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

3 participants