msgspec-geojson 0.2.0__tar.gz → 0.2.2__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: msgspec-geojson
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: GeoJSON types for msgspec
5
5
  Author: Stanis Trendelenburg
6
6
  Author-email: Stanis Trendelenburg <st@trendels.name>
@@ -19,10 +19,10 @@ Inspired by the [msgspec GeoJSON example code][geojson_example] and [geojson-pyd
19
19
 
20
20
  [GeoJSON]: https://geojson.org
21
21
  [msgspec]: https://msgspec.dev/
22
- [geojson_example]: https://jcristharif.com/msgspec/examples/geojson.html
22
+ [geojson_example]: https://msgspec.dev/examples/geojson
23
23
  [geojson-pydantic]: https://pypi.org/project/geojson-pydantic/
24
24
 
25
- This lets you parse GeoJSON into type-safe objects, including propeties, and
25
+ This lets you parse GeoJSON into type-safe objects, including properties, and
26
26
  serialize those objects back to GeoJSON:
27
27
 
28
28
  ~~~python
@@ -34,13 +34,11 @@ serialize those objects back to GeoJSON:
34
34
  ... name: str
35
35
  ... kind: str
36
36
 
37
- >>> type PoiFeature = Feature[Point, PoiProperties]
38
-
39
37
  >>> obj = msgspec.json.decode("""
40
38
  ... {"type": "Feature", "id": 1,
41
39
  ... "properties": {"name": "Zoo Zürich", "kind": "tourism/zoo"},
42
40
  ... "geometry": {"type": "Point", "coordinates": [8.574695, 47.384510]}}
43
- ... """, type=PoiFeature)
41
+ ... """, type=Feature[Point, PoiProperties])
44
42
 
45
43
  >>> obj.id
46
44
  1
@@ -6,10 +6,10 @@ Inspired by the [msgspec GeoJSON example code][geojson_example] and [geojson-pyd
6
6
 
7
7
  [GeoJSON]: https://geojson.org
8
8
  [msgspec]: https://msgspec.dev/
9
- [geojson_example]: https://jcristharif.com/msgspec/examples/geojson.html
9
+ [geojson_example]: https://msgspec.dev/examples/geojson
10
10
  [geojson-pydantic]: https://pypi.org/project/geojson-pydantic/
11
11
 
12
- This lets you parse GeoJSON into type-safe objects, including propeties, and
12
+ This lets you parse GeoJSON into type-safe objects, including properties, and
13
13
  serialize those objects back to GeoJSON:
14
14
 
15
15
  ~~~python
@@ -21,13 +21,11 @@ serialize those objects back to GeoJSON:
21
21
  ... name: str
22
22
  ... kind: str
23
23
 
24
- >>> type PoiFeature = Feature[Point, PoiProperties]
25
-
26
24
  >>> obj = msgspec.json.decode("""
27
25
  ... {"type": "Feature", "id": 1,
28
26
  ... "properties": {"name": "Zoo Zürich", "kind": "tourism/zoo"},
29
27
  ... "geometry": {"type": "Point", "coordinates": [8.574695, 47.384510]}}
30
- ... """, type=PoiFeature)
28
+ ... """, type=Feature[Point, PoiProperties])
31
29
 
32
30
  >>> obj.id
33
31
  1
@@ -0,0 +1,71 @@
1
+ [project]
2
+ name = "msgspec-geojson"
3
+ version = "0.2.2"
4
+ description = "GeoJSON types for msgspec"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = ["msgspec>=0.20.1"]
8
+ license = "MIT"
9
+ license-files = ["LICENSE"]
10
+
11
+ [[project.authors]]
12
+ name = "Stanis Trendelenburg"
13
+ email = "st@trendels.name"
14
+
15
+ [project.urls]
16
+ Source = "https://github.com/trendels/msgspec-geojson"
17
+
18
+ [build-system]
19
+ requires = ["uv_build>=0.12.7,<0.13.0"]
20
+ build-backend = "uv_build"
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "coverage>=7.15.3",
25
+ "pyright>=1.1.411",
26
+ "pytest>=9.0.0",
27
+ "ruff>=0.16.0",
28
+ ]
29
+
30
+ [tool.ruff]
31
+ include = [
32
+ "pyproject.toml",
33
+ "src/**/*.py",
34
+ "tests/**/*.py",
35
+ "examples/**/*.py",
36
+ ]
37
+
38
+ [tool.ruff.format]
39
+ preview = true
40
+
41
+ [tool.ruff.lint]
42
+
43
+ [tool.pyright]
44
+ venvPath = "."
45
+ venv = ".venv"
46
+ include = [
47
+ "src",
48
+ "tests",
49
+ "examples",
50
+ ]
51
+ strict = [
52
+ "src",
53
+ "tests",
54
+ "examples",
55
+ ]
56
+ reportUnnecessaryTypeIgnoreComment = true
57
+
58
+ [tool.coverage.run]
59
+ branch = true
60
+ source = ["src"]
61
+
62
+ [tool.coverage.report]
63
+ exclude_also = [
64
+ "@overload$",
65
+ "raise NotImplementedError",
66
+ ]
67
+
68
+ [tool.pytest]
69
+ testpaths = ["tests"]
70
+ verbosity_assertions = "2"
71
+ addopts = ["--import-mode=importlib"]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "msgspec-geojson"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "GeoJSON types for msgspec"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -17,7 +17,7 @@ license-files = ["LICENSE"]
17
17
  Source = "https://github.com/trendels/msgspec-geojson"
18
18
 
19
19
  [build-system]
20
- requires = ["uv_build>=0.11.32,<0.12.0"]
20
+ requires = ["uv_build>=0.12.7,<0.13.0"]
21
21
  build-backend = "uv_build"
22
22
 
23
23
  [dependency-groups]
@@ -58,20 +58,22 @@ type Geometry = (
58
58
  )
59
59
 
60
60
 
61
- class Feature[G: Geometry | None, T](Struct, tag=True):
61
+ class Feature[G: Geometry | None, P](Struct, tag=True):
62
62
  """A GeoJSON Feature"""
63
63
 
64
- geometry: G | None = None
65
- properties: T | None = None
64
+ geometry: G
65
+ properties: P
66
66
  id: str | int | UnsetType = UNSET
67
67
  bbox: tuple[float, float, float, float] | UnsetType = UNSET
68
68
 
69
69
 
70
- class FeatureCollection[G: Geometry | None, T](Struct, tag=True):
70
+ class FeatureCollection[F: Feature[Any, Any]](Struct, tag=True):
71
71
  """A GeoJSON FeatureCollection"""
72
72
 
73
- features: list[Feature[G, T]]
73
+ features: list[F]
74
74
  bbox: tuple[float, float, float, float] | UnsetType = UNSET
75
75
 
76
76
 
77
- type GeoJSON = Geometry | Feature[Geometry, Any] | FeatureCollection[Geometry, Any]
77
+ type GeoJSON = (
78
+ Geometry | Feature[Geometry, Any] | FeatureCollection[Feature[Geometry, Any]]
79
+ )
File without changes