Skip to content

Commit fc3411f

Browse files
committed
moved jsonschema/pydantic models into subfolder, modified flake8 config to ignore said subfolder for line length, updated README.md
1 parent e51fb4b commit fc3411f

File tree

7 files changed

+8
-5
lines changed

7 files changed

+8
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ for i in range(n_images):
7171
Foundry is an Open Source project and we encourage contributions from the community. To contribute, please fork from the `main` branch and open a Pull Request on the `main` branch. A member of our team will review your PR shortly.
7272

7373
## Developer notes
74-
In order to enforce consistency with external schemas for the metadata and datacite structures ([contained in the MDF data schema repository](https://github.com/materials-data-facility/data-schemas)) the `dc_model.py` and `project_model.py` pydantic data models were generated using the [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator/) tool. In order to ensure compliance with the flake8 linting, the `--use-annoted` flag was passed to ensure regex patterns in `dc_model.py` were specified using pydantic's `Annotated` type vs the soon to be deprecated `constr` type. The command used to run the datamodel-code-generator looks like:
74+
In order to enforce consistency with external schemas for the metadata and datacite structures ([contained in the MDF data schema repository](https://github.com/materials-data-facility/data-schemas)) the `dc_model.py` and `project_model.py` pydantic data models (found in the `foundry/jsonschema_models` folder) were generated using the [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator/) tool. In order to ensure compliance with the flake8 linting, the `--use-annoted` flag was passed to ensure regex patterns in `dc_model.py` were specified using pydantic's `Annotated` type vs the soon to be deprecated `constr` type. The command used to run the datamodel-code-generator looks like:
7575
```
7676
datamodel-codegen --input dc.json --output dc_model.py --use-annotated
7777
```

foundry/foundry_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import List, Any
1212

1313
from .https_download import recursive_ls, download_file
14-
from foundry.project_model import Split as FoundrySplit
14+
from foundry.jsonschema_models.project_model import Split as FoundrySplit
1515
from foundry.models import FoundrySchema
1616
from foundry.utils import _read_csv, _read_json, _read_excel, is_pandas_pytable
1717

File renamed without changes.
File renamed without changes.

foundry/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from pydantic import BaseModel, Extra, ValidationError
88
from typing import Optional, Any
99

10-
from .dc_model import Dc1 as DataciteModel
11-
from .project_model import Foundry as FoundryModel
10+
from .jsonschema_models.dc_model import Dc1 as DataciteModel
11+
from .jsonschema_models.project_model import Foundry as FoundryModel
1212

1313
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.WARNING)
1414
logger = logging.getLogger(__name__)

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[flake8]
22
exclude = .git,*.egg*
33
max-line-length = 150
4+
per-file-ignores =
5+
foundry/jsonschema_models/*:E501
6+

tests/test_foundry_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from unittest.mock import MagicMock
66

77
from . import test_foundry_dataset
8-
from foundry.project_model import Split as FoundrySplit, \
8+
from foundry.jsonschema_models.project_model import Split as FoundrySplit, \
99
Key as FoundryKey
1010
from foundry.foundry_cache import FoundryCache
1111
from foundry.models import FoundrySchema

0 commit comments

Comments
 (0)