diff --git a/cookiecutter.json b/cookiecutter.json index 145ff39..ef869e9 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -16,6 +16,7 @@ "include_normalizer": true, "include_parser": true, "include_app": true, + "include_example_uploads": true, "_copy_without_render": [ "*.html" ], diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 3b98bdf..7a9b7cc 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -47,6 +47,7 @@ def remove_temp_folders(temp_folders): ("normalizers", "{{cookiecutter.include_normalizer}}"), ("parsers", "{{cookiecutter.include_parser}}"), ("apps", "{{cookiecutter.include_app}}"), + ("example_uploads", "{{cookiecutter.include_example_uploads}}"), ] if condition != "False" ] @@ -64,8 +65,8 @@ def remove_temp_folders(temp_folders): test_save_path = os.path.join(test_path, variant) os.makedirs(test_save_path, exist_ok=True) move_py_files(variant=variant, save_path=test_save_path, save_type="tests") - if variant != "apps": - # apps don't have tests data + if variant != "apps" and variant != "example_uploads": + # apps and example upoads don't have tests data move_py_files( variant=variant, save_path=test_data_path, save_type="tests_data" ) diff --git a/nomad-{{cookiecutter.plugin_name}}/MANIFEST.in b/nomad-{{cookiecutter.plugin_name}}/MANIFEST.in index b5ccc2d..50c91d8 100644 --- a/nomad-{{cookiecutter.plugin_name}}/MANIFEST.in +++ b/nomad-{{cookiecutter.plugin_name}}/MANIFEST.in @@ -1 +1,2 @@ recursive-include * nomad_plugin.yaml +graft src/nomad_{{cookiecutter.module_name}}/example_uploads diff --git a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/example_uploads/__init__.py b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/example_uploads/__init__.py new file mode 100644 index 0000000..eed5845 --- /dev/null +++ b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/example_uploads/__init__.py @@ -0,0 +1,8 @@ +from nomad.config.models.plugins import ExampleUploadEntryPoint + +myexampleupload = ExampleUploadEntryPoint( + title='My Example Upload', + category='Examples', + description='Description of this example upload.', + path='example_uploads/getting_started', +) diff --git a/nomad-{{cookiecutter.plugin_name}}/py_sources/src/example_uploads/getting_started/README.md b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/example_uploads/getting_started/README.md new file mode 100644 index 0000000..6d2118f --- /dev/null +++ b/nomad-{{cookiecutter.plugin_name}}/py_sources/src/example_uploads/getting_started/README.md @@ -0,0 +1 @@ +EXAMPLE DATA diff --git a/nomad-{{cookiecutter.plugin_name}}/pyproject.toml b/nomad-{{cookiecutter.plugin_name}}/pyproject.toml index ed0f235..965ee29 100644 --- a/nomad-{{cookiecutter.plugin_name}}/pyproject.toml +++ b/nomad-{{cookiecutter.plugin_name}}/pyproject.toml @@ -120,19 +120,18 @@ where = ["src"] [project.entry-points.'nomad.plugin'] {% if cookiecutter.include_parser -%} myparser = "nomad_{{cookiecutter.module_name}}.parsers:myparser" - {%- endif %} {% if cookiecutter.include_schema_package -%} mypackage = "nomad_{{cookiecutter.module_name}}.schema_packages:mypackage" - {%- endif %} {% if cookiecutter.include_normalizer -%} mynormalizer = "nomad_{{cookiecutter.module_name}}.normalizers:mynormalizer" - {%- endif %} {% if cookiecutter.include_app -%} myapp = "nomad_{{cookiecutter.module_name}}.apps:myapp" - +{%- endif %} +{% if cookiecutter.include_example_uploads -%} +myexampleupload = "nomad_{{cookiecutter.module_name}}.example_uploads:myexampleupload" {%- endif %} [tool.cruft] # Avoid updating workflow files, this leads to permissions issues