-
Notifications
You must be signed in to change notification settings - Fork 7
Update/use ProblemConfig #353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |
| yaml, | ||
| ) | ||
| from ..v1.models.model import Model, model_factory | ||
| from ..v1.problem import ListOfFiles, VersionNumber | ||
| from ..v1.yaml import get_path_prefix | ||
| from ..v2.C import * # noqa: F403 | ||
| from ..versions import parse_version | ||
|
|
@@ -995,12 +994,12 @@ class SubProblem(BaseModel): | |
| """A `problems` object in the PEtab problem configuration.""" | ||
|
|
||
| model_files: dict[str, ModelFile] | None = {} | ||
| measurement_files: ListOfFiles = [] | ||
| condition_files: ListOfFiles = [] | ||
| experiment_files: ListOfFiles = [] | ||
| observable_files: ListOfFiles = [] | ||
| visualization_files: ListOfFiles = [] | ||
| mapping_files: ListOfFiles = [] | ||
| measurement_files: list[str | AnyUrl] = [] | ||
| condition_files: list[str | AnyUrl] = [] | ||
| experiment_files: list[str | AnyUrl] = [] | ||
| observable_files: list[str | AnyUrl] = [] | ||
| visualization_files: list[str | AnyUrl] = [] | ||
| mapping_files: list[str | AnyUrl] = [] | ||
|
|
||
|
|
||
| class ExtensionConfig(BaseModel): | ||
|
|
@@ -1024,7 +1023,17 @@ class ProblemConfig(BaseModel): | |
| description="The base path to resolve relative paths.", | ||
| exclude=True, | ||
| ) | ||
| format_version: VersionNumber = "2.0.0" | ||
| format_version: str = "2.0.0" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's how it is in the current schema draft. Although not strictly enforced so far, I think it would make sense to always require major.minor. But that's probably a separate discussion.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there is no benefit to keeping Requiring a full version string is fine for me, but then we need to provide schemas for each minor version. Makes sense to support minor updates to the format, so I'm also in favor of expecting a full
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, but I'll keep that for a future update.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the |
||
| parameter_file: str | AnyUrl | None = None | ||
| problems: list[SubProblem] = [] | ||
| extensions: list[ExtensionConfig] = [] | ||
|
|
||
| def to_yaml(self, filename: str | Path): | ||
| """Write the configuration to a YAML file. | ||
|
|
||
| filename: Destination file name. The parent directory will be created | ||
dweindl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if necessary. | ||
| """ | ||
| from ..v1.yaml import write_yaml | ||
|
|
||
| write_yaml(self.model_dump(), filename) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be
list[Path | AnyUrl], since pydantic has native support forpathlib.PathIIRC. But then you might need to make a custom path object that serializes to string https://github.com/dilpath/mkstd/blob/fb4ebfda629b0fb9eedb1def5ab05438ab85696e/mkstd/types/path.pyFine as is, just noting in case it becomes useful later