Skip to content

Fix support of multiple settings #19

Closed
@jag-k

Description

@jag-k

Here is an example of settings:

# settings.py

from pydantic import Field
from pydantic_settings import BaseSettings


class Settings1(BaseSettings):
    name: str = Field(description="App Name", examples=["API"])


class Settings2(BaseSettings):
    name: str = Field("Default", description="App Name")
    port: int = Field(8000, description="App port")
# pyproject.toml
# ...

[tool.pydantic_settings_export]
project_dir = "."
default_settings = ["settings:Settings1", "settings:Settings2"]

Then running pydantic-settings-export raises this error:

Traceback (most recent call last):
  File "/.../bin/pydantic-settings-export", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/.../lib/python3.12/site-packages/pydantic_settings_export/cli.py", line 112, in main
    result = Exporter(s).run_all(*settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../lib/python3.12/site-packages/pydantic_settings_export/exporter.py", line 37, in run_all
    for path in generator.run(self.settings, *settings_infos)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AbstractGenerator.run() takes 3 positional arguments but 4 were given

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions