Skip to content

Commit

Permalink
chore: move packages around, add sqlalchemy as optional extra
Browse files Browse the repository at this point in the history
  • Loading branch information
Askir committed Nov 22, 2024
1 parent f4f7da3 commit b5e8d64
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 21 deletions.
9 changes: 5 additions & 4 deletions docs/python-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,18 @@ Configure your env.py to support vectorizer autogeneration:

```python
from alembic import context
from pgai.extensions.alembic.autogenerate import compare_vectorizers
from pgai.extensions.alembic.operations import CreateVectorizerOp, DropVectorizerOp
from pgai.alembic import compare_vectorizers
from pgai.alembic import CreateVectorizerOp, DropVectorizerOp


# Make sure your env.py includes:
def run_migrations_online():
with connectable.connect() as connection:
context.configure(
connection=connection,
target_metadata=target_metadata,
include_object=lambda obj, name, type_, reflected, compare_to:
not obj.info.get("pgai_managed", False)
include_object=lambda obj, name, type_, reflected, compare_to:
not obj.info.get("pgai_managed", False)
)
```

Expand Down
1 change: 1 addition & 0 deletions projects/pgai/pgai/alembic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__all__ = ["CreateVectorizerOp", "DropVectorizerOp"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from alembic.operations.ops import UpgradeOps
from sqlalchemy import text

from pgai.extensions.alembic.operations import (
from pgai.alembic import (
ChunkingConfig,
CreateVectorizerOp,
DiskANNIndexingConfig,
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions projects/pgai/pgai/extensions/alembic/__init__.py

This file was deleted.

File renamed without changes.
10 changes: 7 additions & 3 deletions projects/pgai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ dependencies = [
"typing_extensions>=4.0,<5.0",
"datadog_lambda>=6.9,<7.0",
"pytimeparse>=1.1,<2.0",
"sqlalchemy>=2.0.36",
"psycopg2>=2.9.10",
"alembic>=1.14.0",
]
classifiers = [
"License :: OSI Approved :: PostgreSQL License",
Expand All @@ -44,6 +41,13 @@ classifiers = [
"Operating System :: POSIX :: Linux",
]

[project.optional-dependencies]
sqlalchemy=[
"sqlalchemy>=2.0.36",
"psycopg2>=2.9.10",
"alembic>=1.14.0",
]

[project.urls]
Homepage = "https://github.com/timescale/pgai"
Repository = "https://github.com/timescale/pgai"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.extensions.alembic.operations import (
from pgai.alembic import (
ChunkingConfig,
EmbeddingConfig,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.extensions.alembic.operations import (
from pgai.alembic import (
EmbeddingConfig,
)
from pgai.extensions.sqlalchemy import VectorizerField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.extensions.alembic.operations import (
from pgai.alembic import (
ChunkingConfig,
EmbeddingConfig,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from testcontainers.postgres import PostgresContainer # type: ignore

from pgai.cli import vectorizer_worker
from pgai.extensions.alembic.operations import (
from pgai.alembic import (
ChunkingConfig,
EmbeddingConfig,
)
Expand Down
16 changes: 10 additions & 6 deletions projects/pgai/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b5e8d64

Please sign in to comment.