Skip to content

[FEATURE] Make AuthEntryReference typed in Python SDK #393

@badmonster0

Description

@badmonster0

AuthEntryReference is currently untyped. So that users may register something in one type, but pass it to a spec accepting another type, without being caught by type validations.

Ideally

  • AuthEntryReference should be typed, e.g. the type should be AuthEntryReference[T].
    class AuthEntryReference:
  • add_auth_entry() should return the type AuthEntryReference[T] where T is the same as the argument value's type
    def add_auth_entry(key: str, value) -> AuthEntryReference:
  • AuthEntryReference in various specs should be changed to AuthEntryReference with type parameter, e.g.
    • For Postgres.database, the type should be AuthEntryReference[.lib.DatabaseConnectionSpec] | None
      class Postgres(op.StorageSpec):
      """Storage powered by Postgres and pgvector."""
      database: AuthEntryReference | None = None
      table_name: str | None = None
    • For Neo4j.connection, the type should be AuthEntryReference[Neo4jConnection]
      class Neo4j(op.StorageSpec):
      """Graph storage powered by Neo4j."""
      connection: AuthEntryReference
      mapping: NodeMapping | RelationshipMapping

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions