From b7a2bbd6d6cfcf49cdf317b72335fc40435f9893 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Wed, 14 Sep 2022 09:43:46 -0500 Subject: [PATCH 01/11] Placeholder update in test file --- {{cookiecutter.project_name}}/tests/test_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/tests/test_data.py b/{{cookiecutter.project_name}}/tests/test_data.py index 885046d..7f6fc93 100644 --- a/{{cookiecutter.project_name}}/tests/test_data.py +++ b/{{cookiecutter.project_name}}/tests/test_data.py @@ -4,7 +4,7 @@ import unittest from linkml_runtime.loaders import yaml_loader -from my_awesome_schema.datamodel import {{cookiecutter.main_schema_class}} +from {{cookiecutter.__project_slug}}.datamodel import {{cookiecutter.main_schema_class}} ROOT = os.path.join(os.path.dirname(__file__), '..') DATA_DIR = os.path.join(ROOT, "src", "data", "examples") From b806b0a2c77ff27bdc3c6c83507485cd59ddaa3f Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Wed, 14 Sep 2022 17:21:55 -0500 Subject: [PATCH 02/11] added extras for doc deployment workflow --- {{cookiecutter.project_name}}/pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/{{cookiecutter.project_name}}/pyproject.toml b/{{cookiecutter.project_name}}/pyproject.toml index 13c71d0..cc2d852 100644 --- a/{{cookiecutter.project_name}}/pyproject.toml +++ b/{{cookiecutter.project_name}}/pyproject.toml @@ -20,3 +20,6 @@ schemasheets = "^0.1.14" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.extras] +docs = ["linkml", "mkdocs-material"] \ No newline at end of file From f18c16b778ca84c0dcc33e24bff79608ee0ad579 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 10:17:11 -0500 Subject: [PATCH 03/11] Added description placeholder --- {{cookiecutter.project_name}}/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/pyproject.toml b/{{cookiecutter.project_name}}/pyproject.toml index cc2d852..a6e5283 100644 --- a/{{cookiecutter.project_name}}/pyproject.toml +++ b/{{cookiecutter.project_name}}/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "{{cookiecutter.__project_slug}}" version = "0.1.0" -description = "Enter description of your project here" +description = "{{cookiecutter.description}}" authors = ["{{cookiecutter.__author}}"] license = "{{cookiecutter.license}}" readme = "README.md" From b37433b121164365ca3115c6c861220c9ca2339a Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 10:27:40 -0500 Subject: [PATCH 04/11] creates problems when publishing --- cookiecutter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index ab5bc07..8dd0923 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -18,5 +18,5 @@ "google_sheet_id": "1wVoaiFg47aT9YWNeRfTZ8tYHN8s8PAuDx5i2HUcDpvQ", "google_sheet_tabs": "personinfo enums", "__google_sheet_module": "{{ cookiecutter.google_sheet_tabs|lower()|replace(' ', '_')|replace('-', '_') }}", - "github_token_for_pypi_deployment": "PYPI_PASSWORD (leave blank if not a python project)" + "github_token_for_pypi_deployment": "PYPI_PASSWORD" } From 4068b881d354ae5917fad4b0223ff53d7385ef29 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 10:38:17 -0500 Subject: [PATCH 05/11] updated to 3.9 version --- .../.github/workflows/pypi-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/.github/workflows/pypi-publish.yaml b/{{cookiecutter.project_name}}/.github/workflows/pypi-publish.yaml index 9203cf8..222969c 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/pypi-publish.yaml +++ b/{{cookiecutter.project_name}}/.github/workflows/pypi-publish.yaml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2.2.2 with: - python-version: 3.8 + python-version: 3.9 - name: Install Poetry uses: snok/install-poetry@v1.1.6 From 13c3d937ccfd3d95c83661493aef794440b48c03 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 10:45:18 -0500 Subject: [PATCH 06/11] mkdir docs if not present --- {{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml b/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml index 2022f04..6e242a8 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml +++ b/{{cookiecutter.project_name}}/.github/workflows/deploy-docs.yaml @@ -25,6 +25,7 @@ jobs: - name: Build documentation. run: | + mkdir -p docs touch docs/.nojekyll poetry run gen-doc -d docs src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml poetry run mkdocs gh-deploy \ No newline at end of file From 08bc7c2cf0fcd0b3bf27f9a9d477e7e1cd381a1f Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 11:07:41 -0500 Subject: [PATCH 07/11] convert class_uri from list to scalar --- .../schema/{{cookiecutter.__project_slug}}.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml b/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml index 445e3c6..41c0ef1 100644 --- a/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml +++ b/{{cookiecutter.project_name}}/src/{{cookiecutter.__project_slug}}/schema/{{cookiecutter.__project_slug}}.yaml @@ -32,8 +32,7 @@ classes: - id - name - description - class_uri: - - schema:Thing + class_uri: schema:Thing {{cookiecutter.main_schema_class}}: is_a: NamedThing From 362cfa1a6973aff09b2d5546fcc8e9fac6ab6b29 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 11:32:19 -0500 Subject: [PATCH 08/11] remove (next two questions are ignored) --- cookiecutter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index 8dd0923..bee958d 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -13,7 +13,7 @@ "create_python_classes": ["Yes", "No"], "use_schemasheets": [ "Yes", - "No (next two questions are ignored)" + "No" ], "google_sheet_id": "1wVoaiFg47aT9YWNeRfTZ8tYHN8s8PAuDx5i2HUcDpvQ", "google_sheet_tabs": "personinfo enums", From e0dc01079abb980a406ba79e10c0a93fa63131f8 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 11:40:45 -0500 Subject: [PATCH 09/11] test jinja if condition --- hooks/post_gen_project.py | 5 +++++ {{cookiecutter.project_name}}/Makefile | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 0764fcb..ff3c9ae 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -9,10 +9,15 @@ project_slug = '{{ cookiecutter.__project_slug}}' create_python_classes = '{{ cookiecutter.create_python_classes}}' +use_schemasheets_option = '{{ cookiecutter.use_schemasheets }}' if create_python_classes == "No": print("TODO - cleanup python") +if use_schemasheets_option == "No": + print("TODO - Change MakeFile: remove compile-sheets from gen-project") + + print("** PROJECT CREATION COMPLETE **\n") print("Next steps:") print("cd {{cookiecutter.project_name}}") diff --git a/{{cookiecutter.project_name}}/Makefile b/{{cookiecutter.project_name}}/Makefile index d5820a1..58333a1 100644 --- a/{{cookiecutter.project_name}}/Makefile +++ b/{{cookiecutter.project_name}}/Makefile @@ -89,8 +89,14 @@ gen-examples: cp src/data/examples/* $(EXAMPLEDIR) # generates all project files -gen-project: $(PYMODEL) compile-sheets - $(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) +{% if {{ cookiecutter.use_schemasheets }} == "Yes" %} + gen-project: $(PYMODEL) compile-sheets + $(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) +{% else %} + gen-project: $(PYMODEL) + $(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) +{% endif %} + test: test-schema test-python test-schema: From ca0ea017e0024be8e5f33fd58a1f817780682e9c Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 11:49:12 -0500 Subject: [PATCH 10/11] corrected if condition --- hooks/post_gen_project.py | 7 +------ {{cookiecutter.project_name}}/Makefile | 12 +++--------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index ff3c9ae..0339905 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -8,16 +8,11 @@ shutil.rmtree("licenses") project_slug = '{{ cookiecutter.__project_slug}}' -create_python_classes = '{{ cookiecutter.create_python_classes}}' -use_schemasheets_option = '{{ cookiecutter.use_schemasheets }}' +create_python_classes = '{{ cookiecutter.create_python_classes }}' if create_python_classes == "No": print("TODO - cleanup python") -if use_schemasheets_option == "No": - print("TODO - Change MakeFile: remove compile-sheets from gen-project") - - print("** PROJECT CREATION COMPLETE **\n") print("Next steps:") print("cd {{cookiecutter.project_name}}") diff --git a/{{cookiecutter.project_name}}/Makefile b/{{cookiecutter.project_name}}/Makefile index 58333a1..e263c97 100644 --- a/{{cookiecutter.project_name}}/Makefile +++ b/{{cookiecutter.project_name}}/Makefile @@ -80,7 +80,7 @@ site: gen-project gendoc deploy: all mkd-gh-deploy compile-sheets: -{% if cookiecutter.use_schemasheets %} +{% if {{ cookiecutter.use_schemasheets }} %} $(RUN) sheets2linkml --gsheet-id $(SHEET_ID) $(SHEET_TABS) > $(SHEET_MODULE_PATH).tmp && mv $(SHEET_MODULE_PATH).tmp $(SHEET_MODULE_PATH) {% endif %} @@ -89,14 +89,8 @@ gen-examples: cp src/data/examples/* $(EXAMPLEDIR) # generates all project files -{% if {{ cookiecutter.use_schemasheets }} == "Yes" %} - gen-project: $(PYMODEL) compile-sheets - $(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) -{% else %} - gen-project: $(PYMODEL) - $(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) -{% endif %} - +gen-project: $(PYMODEL) compile-sheets + $(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL) test: test-schema test-python test-schema: From 1e2af551268443aabadadb2947379b43d143cba6 Mon Sep 17 00:00:00 2001 From: Harshad Hegde Date: Thu, 15 Sep 2022 12:06:34 -0500 Subject: [PATCH 11/11] add == "Yes" --- {{cookiecutter.project_name}}/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/Makefile b/{{cookiecutter.project_name}}/Makefile index e263c97..57b7810 100644 --- a/{{cookiecutter.project_name}}/Makefile +++ b/{{cookiecutter.project_name}}/Makefile @@ -80,7 +80,7 @@ site: gen-project gendoc deploy: all mkd-gh-deploy compile-sheets: -{% if {{ cookiecutter.use_schemasheets }} %} +{% if cookiecutter.use_schemasheets == "Yes" %} $(RUN) sheets2linkml --gsheet-id $(SHEET_ID) $(SHEET_TABS) > $(SHEET_MODULE_PATH).tmp && mv $(SHEET_MODULE_PATH).tmp $(SHEET_MODULE_PATH) {% endif %}