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

feat: ✨ make build_readme_text() and write_file() public #1119

Merged
merged 1 commit into from
Mar 10, 2025
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
2 changes: 2 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ quartodoc:
contents:
- create_package_properties
- edit_package_properties
- build_readme_text

- subtitle: "Data resource functions"
desc: "Functions to work with and manage data resources found within a data package."
Expand Down Expand Up @@ -131,6 +132,7 @@ quartodoc:
package: "seedcase_sprout.core"
contents:
- example_package_properties
- write_file

metadata-files:
- docs/reference/_sidebar.yml
Expand Down
12 changes: 8 additions & 4 deletions src/seedcase_sprout/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
# Packages -----
# from .delete_package import *
# Resources -----
# from .delete_resource_raw_file import *
# from .delete_resource_data import *
# from .delete_resource_properties import *

from .build_readme_text import build_readme_text
from .create_package_properties import create_package_properties
from .create_resource_properties import create_resource_properties
from .create_resource_structure import create_resource_structure
from .edit_package_properties import edit_package_properties
from .example_package_properties import example_package_properties

# from .delete_resource_raw_file import *
# from .delete_resource_data import *
# from .delete_resource_properties import *
# Path -----
# TODO: Consider having all these in one module.
from .path_package_functions import (
path_package,
Expand Down Expand Up @@ -46,6 +47,7 @@
from .sprout_checks.check_package_properties import check_package_properties
from .sprout_checks.check_properties import check_properties
from .sprout_checks.check_resource_properties import check_resource_properties
from .write_file import write_file
from .write_package_properties import write_package_properties

# from .extract_resource_properties import *
Expand Down Expand Up @@ -76,6 +78,7 @@
"create_package_properties",
"edit_package_properties",
"write_package_properties",
"build_readme_text",
# "delete_package",
# Resources -----
"create_resource_structure",
Expand All @@ -101,6 +104,7 @@
"path_sprout_global",
# Helpers -----
# "pretty_json",
"write_file",
# Checks -----
"check_package_properties",
"check_properties",
Expand Down
8 changes: 6 additions & 2 deletions src/seedcase_sprout/core/build_readme_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
def build_readme_text(properties: PackageProperties) -> str:
"""Creates a string containing the README text.

Using a template, this will build a README file with the contents of the
properties object in a human-readable format. Use `write_file()` to save
the text to the `README.md` file.

Args:
properties: An object containing the package and resource properties.
properties: An object containing the package and resource properties.

Returns:
A string with the README text based on the properties.
A string with the README text based on the properties.
"""
env = Environment(loader=FileSystemLoader(TEMPLATES_PATH))
env.filters["join_names"] = join_names
Expand Down