Skip to content

core: griffe-based bounded context introspection#107

Merged
absoludity merged 4 commits into
masterfrom
doctrine-test-2
Mar 19, 2026
Merged

core: griffe-based bounded context introspection#107
absoludity merged 4 commits into
masterfrom
doctrine-test-2

Conversation

@absoludity

@absoludity absoludity commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

Follows #106 . Main difference from #56 is using griffe rather than our own code for most of the AST parser. I've left comments/questions for things from #56 that are unclear to me.

Doctrine tests need to scan a codebase and discover its bounded contexts,
use cases, entities, and protocols — without importing any of the code being
scanned. Importing would require all dependencies to be installed and would
conflate scanning with execution.

This PR introduces static analysis via griffe,
a production-grade library used by mkdocstrings. It replaces what would
otherwise be a custom AST parser (the big PR #56 carries one at ~750 lines).
Griffe handles the full surface area of Python syntax edge cases we'd
eventually hit; we get that for free.

The `FilesystemBoundedContextRepository` is the primary output: given a
project root and search path, it discovers all bounded contexts and returns
the typed models from PR 1. The `FileSolutionConfigRepository` reads the
`[tool.julee]` section from `pyproject.toml` so the scanner knows where
to look.

Part of a stack

  1. Domain models and constants
  2. This PR — griffe-based bounded context scanner
  3. Introspection use cases
  4. Use case doctrine test

Comment on lines +3 to +4
Repository implementations that discover entities by inspecting the filesystem
and code structure, rather than persisting entities.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this file be in .../repositories/**file/**introspection/init.py like the solution_config.py above? As in, the directory specifies that it's afile implementation, whereas currently it's sitting on its own?

It's been placed here because that's where it is in 56 but it looks (to me) like the whole of repositories/introspection should be under repositories/file/introspection

@@ -0,0 +1,4 @@
"""Repository implementations for Shared.

Contains memory, file, and introspection repository implementations.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm - looks like introspection is explicitly not in file, even though it's a Filesystem repository?

from pathlib import Path
from typing import TYPE_CHECKING

import griffe

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main difference from the ast of #56 - using griffe to do most of the heavy lifting.

@absoludity absoludity self-assigned this Mar 16, 2026
@absoludity absoludity marked this pull request as ready for review March 16, 2026 04:31
@absoludity absoludity requested a review from monkeypants March 16, 2026 04:32
@absoludity absoludity changed the base branch from doctrine-test-1 to master March 19, 2026 22:17
@absoludity absoludity merged commit 5e2fbb0 into master Mar 19, 2026
5 checks passed
@absoludity absoludity deleted the doctrine-test-2 branch March 19, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant