Skip to content

Commit

Permalink
Example uploads plugins (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueraft authored Aug 20, 2024
1 parent c40010c commit 9581017
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"include_normalizer": true,
"include_parser": true,
"include_app": true,
"include_example_uploads": true,
"_copy_without_render": [
"*.html"
],
Expand Down
5 changes: 3 additions & 2 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand All @@ -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"
)
Expand Down
1 change: 1 addition & 0 deletions nomad-{{cookiecutter.plugin_name}}/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
recursive-include * nomad_plugin.yaml
graft src/nomad_{{cookiecutter.module_name}}/example_uploads
Original file line number Diff line number Diff line change
@@ -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',
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EXAMPLE DATA
7 changes: 3 additions & 4 deletions nomad-{{cookiecutter.plugin_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9581017

Please sign in to comment.