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

Add auto-generated docs for custom math examples #508

Closed
wants to merge 33 commits into from

Conversation

sjpfenninger
Copy link
Member

Summary of changes in this pull request:

  • Changed comment strings into commented-out YAML with a "title" and "description" for each example (the # --- comment marks the end of the "docs comment")
  • Added code to auto-generate custom math documentation

Reviewer checklist:

  • Test(s) added to cover contribution
  • Documentation updated
  • Changelog updated
  • Coverage maintained or improved

doc/index.rst Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently put generated files into user/includes. Don't mind either way, but should be consistent.



def process_file(path):
with open(path, "r") as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.read_text() handles this without the need for the context manager.

# Licensed under the Apache 2.0 License (see LICENSE file).

"""
generate_custom_constraints.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generate_custom_math_examples?

generate_custom_constraints.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Generates an `.rst` file listing all custom constraints.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Generates an `.rst` file listing all custom constraints.
Generates an `.rst` file listing all custom math examples.

# capacity_factor_max
# downtime_periods (from CSV as a timeseries)
# uptime_limit
# description: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pipe leave the result with the line breaks when loaded in, > ignores the line breaks. Do we have a preference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pipe is needed to keep formatting like paragraphs intact, so I think we should always go with the pipe.

Base automatically changed from feature-custom-math-examples to main October 30, 2023 09:28
@sjpfenninger
Copy link
Member Author

Closing this because it is superseded by #526 (which addresses all of the issues pointed out in the review, with the possible exception of the question on | vs >)

@sjpfenninger sjpfenninger deleted the feature-custom-math-autodocs branch January 10, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants