Registries API¶
Registries map component names to their source .comp files. mccode-antlr
supports local directories, remote (GitHub-hosted) releases, and in-memory
registries for testing.
registry_from_specification¶
The most convenient entry point — accepts several specification formats:
from mccode_antlr.reader import registry_from_specification
# Local directory
reg = registry_from_specification("/path/to/components")
# Local directory with explicit name
reg = registry_from_specification("mylib /path/to/components")
# GitHub release (short pip-style form)
reg = registry_from_specification("git+https://github.com/mccode-dev/McCode@v3.5.15")
# GitHub release (full form: name url version registry-file)
reg = registry_from_specification(
"mccode https://github.com/mccode-dev/McCode v3.5.15 pooch-registry.txt"
)
mccode_antlr.reader.registry_from_specification(spec)
¶
Construct a Local or Remote Registry instance from a specification string
Expected specifications are:
{resolvable folder path}{name} {resolvable folder path}{name} {resolvable url} {resolvable file path}{name} {resolvable url} {version} {registry file name}git+{url}@{version}orgit+{url}@{version}#{registry-file}{owner}/{repo}@{version}or{owner}/{repo}@{version}#{registry-file}
The first two variants make a LocalRegistry, which searches the provided directory for files.
The third makes a ModuleRemoteRegistry using pooch. The resolvable file path should point at a Pooch registry file.
The fourth makes a GitHubRegistry, which uses the specific folder structure of GitHub.
Formats 5 and 6 are compact git-reference forms that also produce a GitHubRegistry.
Format 6 expands {owner}/{repo} to https://github.com/{owner}/{repo}.
For formats 5 and 6 the registry file defaults to pooch-registry.txt when
the #{registry-file} fragment is omitted.
Source code in src/mccode_antlr/reader/registry.py
Registry (base class)¶
mccode_antlr.reader.registry.Registry
¶
Source code in src/mccode_antlr/reader/registry.py
LocalRegistry¶
mccode_antlr.reader.registry.LocalRegistry
¶
Bases: Registry
Source code in src/mccode_antlr/reader/registry.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | |
GitHubRegistry¶
mccode_antlr.reader.registry.GitHubRegistry
¶
Bases: RemoteRegistry
Source code in src/mccode_antlr/reader/registry.py
InMemoryRegistry¶
mccode_antlr.reader.registry.InMemoryRegistry
¶
Bases: Registry