Core¶
tangram_core
¶
InjectBackendState
module-attribute
¶
InjectBackendState: TypeAlias = Annotated[
BackendState, Depends(get_state)
]
BackendState
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/backend.py
44 45 46 47 48 | |
Config
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
server
class-attribute
instance-attribute
¶
server: ServerConfig = field(default_factory=ServerConfig)
channel
class-attribute
instance-attribute
¶
channel: ChannelConfig = field(
default_factory=ChannelConfig
)
from_file
classmethod
¶
Source code in packages/tangram_core/src/tangram_core/config.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
Plugin
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/plugin.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
services
class-attribute
instance-attribute
¶
register_service
¶
register_service(
priority: Priority = 0,
) -> Callable[[ServiceFunc], ServiceFunc]
Source code in packages/tangram_core/src/tangram_core/plugin.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
backend
¶
InjectBackendState
module-attribute
¶
InjectBackendState: TypeAlias = Annotated[
BackendState, Depends(get_state)
]
LOG_LEVEL_MAP
module-attribute
¶
BackendState
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/backend.py
44 45 46 47 48 | |
get_state
async
¶
get_state(request: Request) -> BackendState
Source code in packages/tangram_core/src/tangram_core/backend.py
51 52 | |
resolve_frontend
¶
resolve_frontend(
*, path: str, dist_name: str
) -> Path | Traversable | None
Source code in packages/tangram_core/src/tangram_core/backend.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
load_enabled_plugins
¶
Source code in packages/tangram_core/src/tangram_core/backend.py
78 79 80 81 82 83 84 85 86 87 88 89 90 | |
lifespan
async
¶
lifespan(
app: FastAPI, backend_state: BackendState
) -> AsyncGenerator[None, None]
Source code in packages/tangram_core/src/tangram_core/backend.py
93 94 95 96 97 98 99 100 | |
make_cache_route_handler
¶
make_cache_route_handler(
entry: CacheEntry, state: BackendState
) -> Callable[..., Awaitable[FileResponse]]
Factory function that creates a route handler for caching and serving files. Dynamically handles URL parameters found in both serve_route and origin.
Args: entry: Cache entry configuration state: Backend state with http_client for fetching remote resources
Returns: Async function that handles the route with dynamic parameters
Source code in packages/tangram_core/src/tangram_core/backend.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
create_app
¶
create_app(
backend_state: BackendState,
loaded_plugins: Iterable[tuple[DistName, Plugin]],
) -> FastAPI
Source code in packages/tangram_core/src/tangram_core/backend.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
run_channel_service
async
¶
run_channel_service(config: Config) -> None
Source code in packages/tangram_core/src/tangram_core/backend.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
run_services
async
¶
run_services(
backend_state: BackendState,
loaded_plugins: Iterable[tuple[DistName, Plugin]],
) -> AsyncGenerator[Task[None], None]
Source code in packages/tangram_core/src/tangram_core/backend.py
274 275 276 277 278 279 280 281 282 283 284 285 | |
run_server
async
¶
run_server(
backend_state: BackendState,
loaded_plugins: list[tuple[DistName, Plugin]],
) -> None
Source code in packages/tangram_core/src/tangram_core/backend.py
288 289 290 291 292 293 294 295 296 297 298 299 | |
start_tasks
async
¶
start_tasks(config: Config) -> None
Source code in packages/tangram_core/src/tangram_core/backend.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
get_log_config_dict
¶
Source code in packages/tangram_core/src/tangram_core/backend.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
config
¶
ServerConfig
dataclass
¶
ChannelConfig
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
15 16 17 18 19 20 21 22 23 24 | |
UrlConfig
dataclass
¶
SourceSpecification
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
33 34 35 36 | |
StyleSpecification
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
39 40 41 42 43 44 | |
MapConfig
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
style
class-attribute
instance-attribute
¶
style: str | StyleSpecification = (
"https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json"
)
CoreConfig
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
65 66 67 68 69 | |
CacheEntry
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
72 73 74 75 76 77 78 79 80 81 | |
CacheConfig
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
84 85 86 | |
entries
class-attribute
instance-attribute
¶
entries: list[CacheEntry] = field(default_factory=list)
Config
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
server
class-attribute
instance-attribute
¶
server: ServerConfig = field(default_factory=ServerConfig)
channel
class-attribute
instance-attribute
¶
channel: ChannelConfig = field(
default_factory=ChannelConfig
)
from_file
classmethod
¶
Source code in packages/tangram_core/src/tangram_core/config.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
FrontendChannelConfig
dataclass
¶
FrontendConfig
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/config.py
119 120 121 122 | |
plugin
¶
ServiceAsyncFunc
module-attribute
¶
ServiceAsyncFunc: TypeAlias = Callable[
[BackendState], Awaitable[None]
]
ServiceFunc
module-attribute
¶
ServiceFunc: TypeAlias = (
ServiceAsyncFunc | Callable[[BackendState], None]
)
Plugin
dataclass
¶
Source code in packages/tangram_core/src/tangram_core/plugin.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
services
class-attribute
instance-attribute
¶
register_service
¶
register_service(
priority: Priority = 0,
) -> Callable[[ServiceFunc], ServiceFunc]
Source code in packages/tangram_core/src/tangram_core/plugin.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
scan_plugins
¶
scan_plugins() -> EntryPoints
Source code in packages/tangram_core/src/tangram_core/plugin.py
51 52 | |
load_plugin
¶
load_plugin(
entry_point: EntryPoint,
) -> tuple[DistName, Plugin] | None
Source code in packages/tangram_core/src/tangram_core/plugin.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
redis
¶
Subscriber
¶
Source code in packages/tangram_core/src/tangram_core/redis.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
subscribe
async
¶
subscribe() -> None
Source code in packages/tangram_core/src/tangram_core/redis.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
cleanup
async
¶
cleanup() -> None
Source code in packages/tangram_core/src/tangram_core/redis.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
is_active
¶
is_active() -> bool
Return True if the subscriber is actively listening.
Source code in packages/tangram_core/src/tangram_core/redis.py
81 82 83 | |
message_handler
abstractmethod
async
¶
Source code in packages/tangram_core/src/tangram_core/redis.py
85 86 87 88 89 | |
tangram_core._core
¶
ChannelConfig
¶
__new__
¶
__new__(
host: str,
port: int,
redis_url: str,
jwt_secret: str,
jwt_expiration_secs: int,
id_length: int,
) -> ChannelConfig