Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scripts/package-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def level(package: str) -> int:
"""
if package == "overture-schema-system":
return 0
elif package in ["overture-schema-core"]:
elif package in ["overture-schema-common", "overture-schema-core"]:
return 1
elif re.fullmatch(r'overture-schema-.*-theme', package) or package in ["overture-schema", "overture-schema-cli", "overture-schema-codegen", "overture-schema-annex"]:
return 2
Expand Down
38 changes: 19 additions & 19 deletions PYDANTIC_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This guide helps you work with Overture Maps Pydantic schemas - Python models th
## Table of Contents

- [Quick Start](#quick-start)
- [Core Concepts](#core-concepts)
- [Basic Concepts](#basic-concepts)
- [Models and Inheritance](#models-and-inheritance)
- [Field Types](#field-types)
- [Field Enhancement](#field-enhancement)
Expand Down Expand Up @@ -40,8 +40,8 @@ from enum import Enum
# Pydantic essentials
from pydantic import BaseModel, Field

# Overture core models
from overture.schema.core import OvertureFeature
# Overture common models
from overture.schema.common import OvertureFeature
from overture.schema.system.primitive import Geometry, GeometryType, GeometryTypeConstraint

# Validation system
Expand All @@ -54,7 +54,7 @@ from overture.schema.system.string import (
NoWhitespaceString,
StrippedString,
)
from overture.schema.core.types import ConfidenceScore
from overture.schema.common.types import ConfidenceScore
from overture.schema.system.string import LanguageTag

# Numeric primitives (use these instead of int/float)
Expand Down Expand Up @@ -100,7 +100,7 @@ class MyCustomType(BaseModel):
```python
from typing import Annotated, Literal
from pydantic import Field
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.primitive import Geometry, GeometryType, GeometryTypeConstraint

class MyFeature(OvertureFeature[Literal["my_theme"], Literal["my_type"]]):
Expand All @@ -119,7 +119,7 @@ class MyFeature(OvertureFeature[Literal["my_theme"], Literal["my_type"]]):

---

## Core Concepts
## Basic Concepts

### Models and Inheritance

Expand Down Expand Up @@ -151,7 +151,7 @@ class Address(BaseModel):

```python
from typing import Literal
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.primitive import float64

class Building(OvertureFeature[Literal["buildings"], Literal["building"]]):
Expand All @@ -177,9 +177,9 @@ By specifying `OvertureFeature[Literal["buildings"], Literal["building"]]`, you'

```python
from typing import Literal
from overture.schema.core import OvertureFeature
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common import OvertureFeature
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import float64

class Building(OvertureFeature[Literal["buildings"], Literal["building"]], Named, Stacked):
Expand Down Expand Up @@ -647,7 +647,7 @@ The fundamental pattern is a direct reference where one feature "points to" anot
```python
from typing import Annotated, Literal
from pydantic import Field
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.ref import Id, Reference, Relationship

# COMPOSITION — part points to its whole
Expand Down Expand Up @@ -772,7 +772,7 @@ division_id: Id
```python
from typing import Annotated, Literal
from pydantic import Field
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature

# Base class with common fields
class TransportationSegment(OvertureFeature[Literal["transportation"], Literal["segment"]]):
Expand Down Expand Up @@ -999,7 +999,7 @@ class Contact(BaseModel):

Organize code by scope and avoid circular imports:

**Cross-theme shared**: `overture-schema-core` package
**Cross-theme shared**: `overture-schema-common` package

- Used by multiple themes (e.g., `OvertureFeature`, `Names`, `Sources`, `Scope`)

Expand Down Expand Up @@ -1028,7 +1028,7 @@ from enum import Enum
from pydantic import BaseModel, ConfigDict, Field

# Cross-theme imports
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.field_constraint import UniqueItemsConstraint
from overture.schema.system.model_constraint import no_extra_fields

Expand Down Expand Up @@ -1088,7 +1088,7 @@ properties:
**Pydantic approach:**

```python
# In overture-schema-core/src/overture/schema/core/models.py
# In overture-schema-common/src/overture/schema/common/models.py
@no_extra_fields
class Address(BaseModel):
"""A postal address."""
Expand Down Expand Up @@ -1131,7 +1131,7 @@ allOf:
**Pydantic equivalent** uses **mixin classes**:

```python
# In core/models.py
# In common/models.py
class Named(BaseModel):
"""Properties defining the names of a feature."""
names: Names | None = None
Expand Down Expand Up @@ -1203,7 +1203,7 @@ class MyCustomType(BaseModel):
```python models.py
from typing import Annotated, Literal
from pydantic import Field
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.primitive import Geometry, GeometryType, GeometryTypeConstraint

class MyFeature(OvertureFeature[Literal["my_theme"], Literal["my_type"]]):
Expand Down Expand Up @@ -1262,7 +1262,7 @@ class Contact(BaseModel):
```python models.py
from typing import Annotated, Literal
from pydantic import Field
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.primitive import float64
from overture.schema.system.ref import Id, Reference, Relationship

Expand Down Expand Up @@ -1346,7 +1346,7 @@ class Status(str, Enum):
from typing import Annotated, Literal
from enum import Enum
from pydantic import Field
from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.field_constraint import UniqueItemsConstraint
from overture.schema.system.model_constraint import no_extra_fields
from overture.schema.system.primitive import int32, float64
Expand Down
4 changes: 2 additions & 2 deletions README.pydantic.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ This workspace contains the following packages:

- **`overture-schema`** - Main entrypoint package that aggregates all types for
convenient usage
- **`overture-schema-core`** - Overture-specific models shared across themes: base
- **`overture-schema-common`** - Overture-specific models shared across themes: base
feature class, scoping framework, names, sources, and cartographic hints
- **`overture-schema-system`** - Portable primitive types, constraints, and a
GeoJSON-aware base model for building Pydantic schemas that serialize to
Expand Down Expand Up @@ -200,7 +200,7 @@ buildings = filter_models(
```

Tags are produced by *tag providers* registered on the `overture.tag_providers`
entry-point group. The `system` and `core` packages ship the built-in providers
entry-point group. The `system` and `common` packages ship the built-in providers
(`feature`, `overture`, `overture:theme=*`); third parties can register their own
to attach custom tags during discovery. See the [`overture-schema-system`
README](packages/overture-schema-system/README.md#tagging) for tag format,
Expand Down
4 changes: 2 additions & 2 deletions packages/overture-schema-addresses-theme/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ maintainers = [
{name = "Overture Maps Schema Working Group"},
]
dependencies = [
"overture-schema-core",
"overture-schema-common",
"overture-schema-system",
"pydantic>=2.12.0",
]
Expand All @@ -20,7 +20,7 @@ Source = "https://github.com/OvertureMaps/schema"
Issues = "https://github.com/OvertureMaps/schema/issues"

[tool.uv.sources]
overture-schema-core = { workspace = true }
overture-schema-common = { workspace = true }
overture-schema-system = { workspace = true }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pydantic import BaseModel, ConfigDict, Field

from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.system.model_constraint import no_extra_fields
Expand Down
4 changes: 2 additions & 2 deletions packages/overture-schema-annex/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
maintainers = [
{name = "Overture Maps Schema Working Group"},
]
dependencies = ["overture-schema-core", "overture-schema-system", "pydantic>=2.12.0"]
dependencies = ["overture-schema-common", "overture-schema-system", "pydantic>=2.12.0"]
description = "Add your description here"
dynamic = ["version"]
license = "MIT"
Expand All @@ -11,7 +11,7 @@ readme = "README.md"
requires-python = ">=3.10"

[tool.uv.sources]
overture-schema-core = { workspace = true }
overture-schema-common = { workspace = true }
overture-schema-system = { workspace = true }

[project.urls]
Expand Down
4 changes: 2 additions & 2 deletions packages/overture-schema-base-theme/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ maintainers = [
{name = "Overture Maps Schema Working Group"},
]
dependencies = [
"overture-schema-core",
"overture-schema-common",
"overture-schema-system",
"pydantic>=2.12.0",
]
Expand All @@ -20,7 +20,7 @@ Source = "https://github.com/OvertureMaps/schema"
Issues = "https://github.com/OvertureMaps/schema/issues"

[tool.uv.sources]
overture-schema-core = { workspace = true }
overture-schema-common = { workspace = true }
overture-schema-system = { workspace = true }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

from pydantic import ConfigDict, Field

from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.core.cartography import CartographicallyHinted
from overture.schema.common.cartography import CartographicallyHinted
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from pydantic import ConfigDict, Field

from overture.schema.base._common import Height, SourcedFromOpenStreetMap
from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from pydantic import ConfigDict, Field

from overture.schema.base._common import Elevation, SourcedFromOpenStreetMap
from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

from pydantic import ConfigDict, Field

from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.core.cartography import CartographicallyHinted
from overture.schema.common.cartography import CartographicallyHinted
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from pydantic import ConfigDict, Field

from overture.schema.base._common import Elevation, SourcedFromOpenStreetMap
from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from pydantic import ConfigDict, Field

from overture.schema.base._common import SourcedFromOpenStreetMap
from overture.schema.core import (
from overture.schema.common import (
OvertureFeature,
)
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
4 changes: 2 additions & 2 deletions packages/overture-schema-buildings-theme/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ maintainers = [
{name = "Overture Maps Schema Working Group"},
]
dependencies = [
"overture-schema-core",
"overture-schema-common",
"overture-schema-system",
"pydantic>=2.12.0",
]
Expand All @@ -20,7 +20,7 @@ Source = "https://github.com/OvertureMaps/schema"
Issues = "https://github.com/OvertureMaps/schema/issues"

[tool.uv.sources]
overture-schema-core = { workspace = true }
overture-schema-common = { workspace = true }
overture-schema-system = { workspace = true }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from pydantic import ConfigDict, Field

from overture.schema.buildings._common import Appearance
from overture.schema.core import OvertureFeature
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common import OvertureFeature
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from overture.schema.buildings._common import Appearance
from overture.schema.buildings.building import Building
from overture.schema.core import OvertureFeature
from overture.schema.core.models import Stacked
from overture.schema.core.names import Named
from overture.schema.common import OvertureFeature
from overture.schema.common.models import Stacked
from overture.schema.common.names import Named
from overture.schema.system.primitive import (
Geometry,
GeometryType,
Expand Down
4 changes: 2 additions & 2 deletions packages/overture-schema-cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ maintainers = [
{name = "Overture Maps Schema Working Group"},
]
dependencies = [
"overture-schema-core",
"overture-schema-common",
"overture-schema-system",
"pydantic>=2.12.0",
"pyyaml>=6.0.2",
Expand All @@ -24,7 +24,7 @@ Source = "https://github.com/OvertureMaps/schema"
Issues = "https://github.com/OvertureMaps/schema/issues"

[tool.uv.sources]
overture-schema-core = { workspace = true }
overture-schema-common = { workspace = true }
overture-schema-system = { workspace = true }

[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from rich.text import Text
from yamlcore import CoreLoader # type: ignore

from overture.schema.core import OvertureFeature
from overture.schema.common import OvertureFeature
from overture.schema.system.discovery import (
ModelDict,
ModelKey,
Expand Down
Loading
Loading