sqlalchemy-postgres-point 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,20 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sqlalchemy-postgres-point
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Lightweight SQLAlchemy custom type for PostgreSQL POINT columns with tuple binding and an earth-distance comparator.
5
5
  Keywords: sqlalchemy,postgresql,point,geometry,geospatial,gis,database,types,earthdistance
6
6
  Author: Michael Bianco
7
7
  Author-email: Michael Bianco <mike@mikebian.co>
8
8
  Requires-Dist: sqlalchemy>=2.0
9
- Requires-Python: >=3.10
9
+ Requires-Python: >=3.12
10
10
  Project-URL: Repository, https://github.com/iloveitaly/sqlalchemy-postgres-point
11
11
  Description-Content-Type: text/markdown
12
12
 
13
+ [![Release Notes](https://img.shields.io/github/release/iloveitaly/sqlalchemy-postgres-point)](https://github.com/iloveitaly/sqlalchemy-postgres-point/releases)
14
+ [![Downloads](https://static.pepy.tech/badge/sqlalchemy-postgres-point/month)](https://pepy.tech/project/sqlalchemy-postgres-point)
15
+ ![GitHub CI Status](https://github.com/iloveitaly/sqlalchemy-postgres-point/actions/workflows/build_and_publish.yml/badge.svg)
16
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
17
+
13
18
  sqlalchemy-postgres-point
14
19
  =========================
15
20
 
@@ -72,6 +77,54 @@ stmt = select(Place.id, Place.location.earth_distance(origin).label("dist"))
72
77
 
73
78
  The comparator translates `Place.location.earth_distance(origin)` into SQL using the `<@>` operator (requires PostgreSQL with the `cube` / `earthdistance` extension for meaningful results; without extensions the operator may not exist—adapt as needed for your environment). This library only *emits* the operator; it does not manage PostgreSQL extensions.
74
79
 
80
+ ## PostgreSQL Extensions Setup
81
+
82
+ To use the earth distance functionality (`earth_distance()` comparator), you need to enable the `cube` and `earthdistance` PostgreSQL extensions. These extensions provide spatial operations for calculating distances between geographic points on Earth's surface using a spherical model.
83
+
84
+ ### Alembic Migration Example
85
+
86
+ If you're using Alembic for database migrations, you can create a migration to enable these extensions:
87
+
88
+ ```python
89
+ """Add PostgreSQL extensions for earth distance calculations
90
+
91
+ Revision ID: your_revision_id
92
+ Revises: your_previous_revision
93
+ Create Date: 2025-01-XX XX:XX:XX.XXXXXX
94
+
95
+ """
96
+ from typing import Sequence, Union
97
+
98
+ from alembic import op
99
+ import sqlalchemy as sa
100
+
101
+ # revision identifiers, used by Alembic.
102
+ revision: str = 'your_revision_id'
103
+ down_revision: Union[str, None] = 'your_previous_revision'
104
+ branch_labels: Union[str, Sequence[str], None] = None
105
+ depends_on: Union[str, Sequence[str], None] = None
106
+
107
+
108
+ def upgrade() -> None:
109
+ op.execute("""
110
+ CREATE EXTENSION IF NOT EXISTS cube;
111
+ CREATE EXTENSION IF NOT EXISTS earthdistance;
112
+ """)
113
+
114
+
115
+ def downgrade() -> None:
116
+ op.execute("""
117
+ DROP EXTENSION IF EXISTS earthdistance;
118
+ DROP EXTENSION IF EXISTS cube;
119
+ """)
120
+ ```
121
+
122
+ **Integration Steps:**
123
+
124
+ 1. Generate a new migration: `alembic revision -m "add_postgres_extensions"`
125
+ 2. Copy the `upgrade()` and `downgrade()` functions above into your new migration file
126
+ 3. Run the migration: `alembic upgrade head`
127
+
75
128
  Returned Python Values
76
129
  ----------------------
77
130
 
@@ -114,3 +167,6 @@ License
114
167
 
115
168
  MIT (see your project's LICENSE file if added later). Contributions welcome.
116
169
 
170
+ ---
171
+
172
+ *This project was created from [iloveitaly/python-package-template](https://github.com/iloveitaly/python-package-template)*
@@ -1,3 +1,8 @@
1
+ [![Release Notes](https://img.shields.io/github/release/iloveitaly/sqlalchemy-postgres-point)](https://github.com/iloveitaly/sqlalchemy-postgres-point/releases)
2
+ [![Downloads](https://static.pepy.tech/badge/sqlalchemy-postgres-point/month)](https://pepy.tech/project/sqlalchemy-postgres-point)
3
+ ![GitHub CI Status](https://github.com/iloveitaly/sqlalchemy-postgres-point/actions/workflows/build_and_publish.yml/badge.svg)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
1
6
  sqlalchemy-postgres-point
2
7
  =========================
3
8
 
@@ -60,6 +65,54 @@ stmt = select(Place.id, Place.location.earth_distance(origin).label("dist"))
60
65
 
61
66
  The comparator translates `Place.location.earth_distance(origin)` into SQL using the `<@>` operator (requires PostgreSQL with the `cube` / `earthdistance` extension for meaningful results; without extensions the operator may not exist—adapt as needed for your environment). This library only *emits* the operator; it does not manage PostgreSQL extensions.
62
67
 
68
+ ## PostgreSQL Extensions Setup
69
+
70
+ To use the earth distance functionality (`earth_distance()` comparator), you need to enable the `cube` and `earthdistance` PostgreSQL extensions. These extensions provide spatial operations for calculating distances between geographic points on Earth's surface using a spherical model.
71
+
72
+ ### Alembic Migration Example
73
+
74
+ If you're using Alembic for database migrations, you can create a migration to enable these extensions:
75
+
76
+ ```python
77
+ """Add PostgreSQL extensions for earth distance calculations
78
+
79
+ Revision ID: your_revision_id
80
+ Revises: your_previous_revision
81
+ Create Date: 2025-01-XX XX:XX:XX.XXXXXX
82
+
83
+ """
84
+ from typing import Sequence, Union
85
+
86
+ from alembic import op
87
+ import sqlalchemy as sa
88
+
89
+ # revision identifiers, used by Alembic.
90
+ revision: str = 'your_revision_id'
91
+ down_revision: Union[str, None] = 'your_previous_revision'
92
+ branch_labels: Union[str, Sequence[str], None] = None
93
+ depends_on: Union[str, Sequence[str], None] = None
94
+
95
+
96
+ def upgrade() -> None:
97
+ op.execute("""
98
+ CREATE EXTENSION IF NOT EXISTS cube;
99
+ CREATE EXTENSION IF NOT EXISTS earthdistance;
100
+ """)
101
+
102
+
103
+ def downgrade() -> None:
104
+ op.execute("""
105
+ DROP EXTENSION IF EXISTS earthdistance;
106
+ DROP EXTENSION IF EXISTS cube;
107
+ """)
108
+ ```
109
+
110
+ **Integration Steps:**
111
+
112
+ 1. Generate a new migration: `alembic revision -m "add_postgres_extensions"`
113
+ 2. Copy the `upgrade()` and `downgrade()` functions above into your new migration file
114
+ 3. Run the migration: `alembic upgrade head`
115
+
63
116
  Returned Python Values
64
117
  ----------------------
65
118
 
@@ -102,3 +155,6 @@ License
102
155
 
103
156
  MIT (see your project's LICENSE file if added later). Contributions welcome.
104
157
 
158
+ ---
159
+
160
+ *This project was created from [iloveitaly/python-package-template](https://github.com/iloveitaly/python-package-template)*
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sqlalchemy-postgres-point"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Lightweight SQLAlchemy custom type for PostgreSQL POINT columns with tuple binding and an earth-distance comparator."
5
5
  keywords = [
6
6
  "sqlalchemy",
@@ -14,14 +14,14 @@ keywords = [
14
14
  "earthdistance",
15
15
  ]
16
16
  readme = "README.md"
17
- requires-python = ">=3.10"
17
+ requires-python = ">=3.12"
18
18
  dependencies = ["sqlalchemy>=2.0"]
19
19
  authors = [{ name = "Michael Bianco", email = "mike@mikebian.co" }]
20
20
  urls = { "Repository" = "https://github.com/iloveitaly/sqlalchemy-postgres-point" }
21
21
 
22
22
 
23
23
  [build-system]
24
- requires = ["uv_build>=0.8.11,<0.9.0"]
24
+ requires = ["uv_build>=0.10.0"]
25
25
  build-backend = "uv_build"
26
26
 
27
27
  [tool.uv.build-backend]
@@ -30,8 +30,29 @@ module-root = ""
30
30
 
31
31
  [dependency-groups]
32
32
  dev = [
33
- "pytest>=8.3.3",
34
- "sqlmodel>=0.0.21",
33
+ "pytest>=8.3.4",
34
+ "sqlmodel>=0.0.32",
35
35
  "psycopg[binary]>=3.2.0",
36
- "activemodel",
36
+ "activemodel>=0.15.0",
37
+ "pyright[nodejs]>=1.1.408",
38
+ "ruff>=0.15.0",
39
+ "coverage>=7.13.4",
40
+ "pytest-cov>=7.0.0",
41
+ "covdefaults>=2.3.0",
37
42
  ]
43
+
44
+ [tool.pyright]
45
+ exclude = ["examples/", "playground/", "tmp/", ".venv/", "tests/"]
46
+
47
+ [tool.pytest.ini_options]
48
+ addopts = "--cov --cov-report=term-missing --cov-report=html:tmp/htmlcov"
49
+
50
+ [tool.coverage.run]
51
+ plugins = ["covdefaults"]
52
+ source = ["sqlalchemy_postgres_point"]
53
+
54
+ [tool.coverage.report]
55
+ fail_under = 50
56
+
57
+ [tool.ruff]
58
+ extend-exclude = ["playground.py", "playground/"]