Skip to content

Support globbing syntax #49

@TheLazzziest

Description

@TheLazzziest

Hi there,

First off, thanks for paracelsus! It's a great tool for keeping database documentation tidy and up-to-date.

Context

I am using paracelsus in a project with a hexagonal (domain-driven) architecture. In this structure, my SQLAlchemy models are not in a single models directory but are distributed across multiple domain packages.

My project structure looks something like this:

src/
├── domains/
│   ├── user/
│   │   └── models.py      # Contains User model
│   ├── order/
│   │   └── models.py      # Contains Order model
│   └── ... (more domains)
└── infra/
    └── orm.py           # Contains the declarative Base

To ensure paracelsus discovers all models, I need to import all models.py modules. The --import-module argument seems to require specifying each module path explicitly. This is cumbersome and not scalable, as I have to manually update my build scripts every time a new domain with models is added.

Problem statement

I tried to use a shell-like glob pattern in my Makefile, but it doesn't work as the argument is treated as a literal string rather than being expanded.

# from my makefile.mk
paracelsus_check:
	$(PYTHON) -m paracelsus.cli inject docs/database.md src.infra.orm:Base --import-module "src.domains.*.models:*" --check

So far I couldn't find any relevant examples. Are there any plans to support glob patterns for --import-module argument ?

This would allow for the automatic discovery of all modules that match the pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions