Skip to content
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

Re-structuring, clean-up, fixes for first 0.2.x release #31

Merged
merged 27 commits into from
Feb 12, 2025
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
679db38
Remove make
dalito Feb 8, 2025
1ad8be5
Remove content in project that can be generated.
dalito Feb 8, 2025
99c2047
Adjust justfile & README for generating project dir contents
dalito Feb 8, 2025
25ac8ab
Make pypi & docs-preview optional via copier config
dalito Feb 9, 2025
29278ea
Remove create_python_classes template variable
dalito Feb 9, 2025
500af6c
Remove github_token_for_pypi_deployment template variable
dalito Feb 9, 2025
09056b6
Add yamllint config to template
dalito Feb 9, 2025
4ba4e83
Make example optional and always using Person class
dalito Feb 9, 2025
7a70ee2
Make docs handling more best-practice conform
dalito Feb 9, 2025
a81de7c
Change directory locations for docs
dalito Feb 9, 2025
d6c15f7
Manage docs in docs-directory the standard mkdocs-way
dalito Feb 10, 2025
16f1170
Add pydantic-generator
dalito Feb 10, 2025
e231abf
Fix slug-generation in copier questions
dalito Feb 10, 2025
0e5c3eb
Don't use just for docs build but only mkdocs
dalito Feb 10, 2025
e06ef9f
Directory rename docs/schema->docs/elements
dalito Feb 11, 2025
cfaf0cc
Fix comments in actions
dalito Feb 11, 2025
c2d9436
Reorganize example/test data locations
dalito Feb 11, 2025
d9e86ad
Add Unlicense as another license option
dalito Feb 11, 2025
e57c72d
Add __init__.py to package root
dalito Feb 11, 2025
653dd07
Improve just command help
dalito Feb 11, 2025
1cec890
Add .py.jinja to .editorconfig
dalito Feb 11, 2025
88fea25
Change to pytest & add test of invalid data
dalito Feb 11, 2025
3eb82d1
Remove example-dir handling from justfile
dalito Feb 11, 2025
70bb258
Improve example project & fix test data
dalito Feb 11, 2025
05c1e45
Prepare watch/rebuild schema docs; add root index.md
dalito Feb 11, 2025
c4e92c8
Add 0.2.0 migration to copier with just recipe
dalito Feb 12, 2025
93b009f
Update README after releasing v0.1.7
dalito Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change to pytest & add test of invalid data
dalito committed Feb 11, 2025
commit 88fea251b94b009edc1102ccd5335db69fe6d795
4 changes: 2 additions & 2 deletions template/justfile
Original file line number Diff line number Diff line change
@@ -136,8 +136,8 @@ _test-examples: _ensure_examples_output
poetry run linkml-run-examples \
--output-formats json \
--output-formats yaml \
--counter-example-input-directory src/data/examples/invalid \
--input-directory src/data/examples/valid \
--counter-example-input-directory tests/data/invalid \
--input-directory tests/data/valid \
--output-directory examples/output \
--schema {{source_schema_path}} > examples/output/README.md

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example data object
---
entries:
- id: example:Person002
name: foo bara
primary_email: [email protected]
age_in_years: -2
24 changes: 11 additions & 13 deletions template/tests/{% if add_example %}test_data.py{% endif %}.jinja
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
"""Data test."""
import os
import glob
import unittest

import pytest
from pathlib import Path
from linkml_runtime.loaders import yaml_loader
from {{project_slug}}.datamodel.{{project_slug}} import PersonCollection

ROOT = os.path.join(os.path.dirname(__file__), '..')
DATA_DIR = os.path.join(ROOT, "src", "data", "examples")

EXAMPLE_FILES = glob.glob(os.path.join(DATA_DIR, '*.yaml'))
DATA_DIR_VALID = Path(__file__).parent / "data" / "valid"
DATA_DIR_INVALID = Path(__file__).parent / "data" / "invalid"

VALID_EXAMPLE_FILES = glob.glob(os.path.join(DATA_DIR_VALID, '*.yaml'))
INVALID_EXAMPLE_FILES = glob.glob(os.path.join(DATA_DIR_INVALID, '*.yaml'))

class TestData(unittest.TestCase):
"""Test data and datamodel."""

def test_data(self):
"""Data test."""
for path in EXAMPLE_FILES:
obj = yaml_loader.load(path, target_class=PersonCollection)
assert obj
@pytest.mark.parametrize("filepath", VALID_EXAMPLE_FILES)
def test_valid_data_files(filepath):
"""Test loading of all valid data files."""
obj = yaml_loader.load(filepath, target_class=PersonCollection)
assert obj