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

Autogen code #265

Merged
merged 1 commit into from
May 16, 2023
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
14 changes: 8 additions & 6 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# How can I contribute?
# Contributing

## How can I contribute?

GPJax welcomes contributions from interested individuals or groups. There are
many ways to contribute, including:
Expand All @@ -15,13 +17,13 @@ many ways to contribute, including:
- Extending or improving our [codebase](https://github.com/JaxGaussianProcesses/GPJax).


# Code of conduct
## Code of conduct

As a contributor to GPJax, you can help us keep the community open and
inclusive. Please read and follow our [Code of
Conduct](https://github.com/JaxGaussianProcesses/GPJax/blob/master/.github/CODE_OF_CONDUCT.md).

# Opening issues and getting support
## Opening issues and getting support

Please open issues on [Github Issue
Tracker](https://github.com/JaxGaussianProcesses/GPJax/issues/new/choose). Here you can
Expand All @@ -30,7 +32,7 @@ mention
You can ask a question or start a discussion in the [Discussion
section](https://github.com/JaxGaussianProcesses/GPJax/discussions) on Github.

# Contributing to the source code
## Contributing to the source code

Submitting code contributions to GPJax is done via a [GitHub pull
request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests).
Expand All @@ -47,7 +49,7 @@ you through every detail!
Before opening a pull request we recommend you check our [pull request checklist](#pull-request-checklist).


## Step-by-step guide:
### Step-by-step guide:

1. Click [here](https://github.com/JaxGaussianProcesses/GPJax/fork) to Fork GPJax's
codebase (alternatively, click the 'Fork' button towards the top right of
Expand Down Expand Up @@ -114,7 +116,7 @@ you through every detail!
request' button to send your changes to the project's maintainers for
review.

## Pull request checklist
### Pull request checklist

We welcome both complete or "work in progress" pull requests. Before opening
one, we recommended you check the following guidelines to ensure a smooth review
Expand Down
30 changes: 30 additions & 0 deletions docs/scripts/notebook_converter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import jupytext
from glob import glob
import mkdocs_gen_files


notebooks = glob("docs/examples/*.py", recursive=True)

code = {}
for notebook in notebooks:
if "utils" in notebook:
continue
ntbk = jupytext.read(notebook)
code_cells = []
header = ntbk["cells"][0]["source"].split("\n")[0].replace("#", "").strip()
for c in ntbk["cells"]:
if c["cell_type"] == "code":
code_cells.append(c["source"])
code[header] = "\n\n".join(code_cells)


with mkdocs_gen_files.open("give_me_the_code.md", "w") as f:
print("# Give me the code", file=f)
for k, v in code.items():
print(f"## {k}", file=f)
print(file=f)
print("```python", file=f)
print(v, file=f)
print("```", file=f)
print(file=f)
mkdocs_gen_files.set_edit_path("give_me_the_code.md", "notebook_converter.py")
6 changes: 4 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nav:
- Kernels: examples/kernels.py
- UCI regression: examples/yacht.py
- Pathwise Sampling for Spatial Modelling: examples/spatial.py
- 💻 Raw tutorial code: give_me_the_code.md
- 📕 Reference: api/

theme:
Expand Down Expand Up @@ -77,6 +78,7 @@ plugins:
- gen-files:
scripts:
- docs/scripts/gen_pages.py # or any other name or path
- docs/scripts/notebook_converter.py # or any other name or path
- literate-nav:
nav_file: SUMMARY.md
- bibtex:
Expand All @@ -86,8 +88,8 @@ plugins:
- mkdocs-jupyter:
execute: true
allow_errors: false
# binder: true
# binder_service_name: "gh"
# binder: true
# binder_service_name: "gh"
# binder_branch: "main"
- mkdocstrings:
watch:
Expand Down