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

Example uploads plugins #29

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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