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

Add task definitions for just as alternative command runner #127

Merged
merged 8 commits into from
Feb 10, 2025
Merged
Changes from 1 commit
Commits
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
Next Next commit
Simplify makefile and config
dalito committed Jan 11, 2025
commit 340158e34343b9bec943e08d7a6b5318f35c6e5b
9 changes: 5 additions & 4 deletions {{cookiecutter.project_name}}/Makefile
Original file line number Diff line number Diff line change
@@ -24,14 +24,15 @@ PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel
DOCDIR = docs
DOCTEMPLATES = $(SRC)/docs/templates
EXAMPLEDIR = examples
SHEET_MODULE = {{cookiecutter.__google_sheet_module}}
SHEET_MODULE = $(LINKML_SCHEMA_GOOGLE_SHEET_MODULE)
SHEET_ID = $(LINKML_SCHEMA_GOOGLE_SHEET_ID)
SHEET_TABS = $(LINKML_SCHEMA_GOOGLE_SHEET_TABS)
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml

# Use += to append variables from the variables file
CONFIG_YAML =
ifdef LINKML_GENERATORS_CONFIG_YAML
CONFIG_YAML += "--config-file"
CONFIG_YAML += ${LINKML_GENERATORS_CONFIG_YAML}
endif

@@ -151,7 +152,7 @@ test-schema:
$(RUN) gen-project ${CONFIG_YAML} -d tmp $(SOURCE_SCHEMA_PATH)

test-python:
$(RUN) python -m unittest discover
$(RUN) python -m pytest

lint:
$(RUN) linkml-lint $(SOURCE_SCHEMA_PATH)
@@ -175,7 +176,7 @@ examples/%.ttl: src/data/examples/%.yaml

test-examples: examples/output

examples/output: src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml
examples/output: src/$(SCHEMA_NAME)/schema/$(SCHEMA_NAME).yaml
mkdir -p $@
$(RUN) linkml-run-examples \
--output-formats json \
@@ -224,7 +225,7 @@ git-status:
clean:
rm -rf $(DEST)
rm -rf tmp
rm -fr docs/*
rm -fr $(DOCDIR)/*
rm -fr $(PYMODEL)/*

include project.Makefile
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name}}/config.public.mk
Original file line number Diff line number Diff line change
@@ -11,13 +11,14 @@ LINKML_SCHEMA_NAME={{cookiecutter.__project_slug}}
LINKML_SCHEMA_AUTHOR={{cookiecutter.__author}}
LINKML_SCHEMA_DESCRIPTION={{cookiecutter.project_description}}
LINKML_SCHEMA_SOURCE_PATH={{cookiecutter.__source_path}}
LINKML_SCHEMA_GOOGLE_SHEET_MODULE={{cookiecutter.__google_sheet_module}}
LINKML_SCHEMA_GOOGLE_SHEET_ID={{cookiecutter.google_sheet_id}}
LINKML_SCHEMA_GOOGLE_SHEET_TABS={{cookiecutter.google_sheet_tabs}}

###### linkml generator variables, used by makefile

## gen-project configuration file
LINKML_GENERATORS_CONFIG_YAML= --config-file config.yaml
LINKML_GENERATORS_CONFIG_YAML=config.yaml

## pass args if gendoc ignores config.yaml (i.e. --no-mergeimports)
LINKML_GENERATORS_DOC_ARGS=
@@ -29,4 +30,3 @@ LINKML_GENERATORS_OWL_ARGS=
## pass args to trigger experimental java/typescript generation
LINKML_GENERATORS_JAVA_ARGS=
LINKML_GENERATORS_TYPESCRIPT_ARGS=

2 changes: 2 additions & 0 deletions {{cookiecutter.project_name}}/config.yaml
Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@ generator_args:
mergeimports: true
jsonldcontext:
mergeimports: true
pydantic:
mergeimports: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dalito - can you confirm that this addition does not result in the pydantic version of the python serialization being generated automatically for new projects and overwriting the already generated dataclasses serialization? We definitely want to move to pydantic being the default python serialization eventually.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be OK to generate both standard python and pydantic? I have to try it out to be sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of repos I'm aware of do that, yep (renaming the pydantic file to something different from the dataclasses version e.g.: https://github.com/biolink/biolink-model/blob/fe44b8d56b7a1e77fb1e94f78a143dddb8681565/Makefile#L127 -- the naming is kind of awkward but I bet we could come up with something more reasonable here).

but, it might be that we just want to split this change out from this PR? I will leave that to your judgment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this change.

python:
mergeimports: true
prefixmap: