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

Generate CONTRIBUTING.md and add note informing that files are auto generated #577

Merged
merged 2 commits into from
Sep 8, 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
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> **_NOTE:_** This is an auto-generated file. Please edit docs/docs/en/CONTRIBUTING.md instead.

## Developing

If you already cloned the repository and you know that you need to deep dive in the code, here are some guidelines to set up your environment.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> **_NOTE:_** This is an auto-generated file. Please edit docs/docs/en/index.md instead.

FastStream
================

Expand Down
25 changes: 24 additions & 1 deletion docs/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
EN_DOCS_DIR = DOCS_DIR / "en"
EN_INDEX_PATH = EN_DOCS_DIR / "index.md"
README_PATH = BASE_DIR.parent / "README.md"
EN_CONTRIBUTING_PATH = EN_DOCS_DIR / "CONTRIBUTING.md"
CONTRIBUTING_PATH = BASE_DIR.parent / "CONTRIBUTING.md"
FASTSTREAM_GEN_DOCS_PATH = BASE_DIR.parent / ".faststream_gen"


Expand Down Expand Up @@ -163,11 +165,31 @@ def mv(path: str = typer.Argument(...), new_path: str = typer.Argument(...)):

@app.command()
def update_readme():
"""Update README.md by expanding embeddings in docs/en/docs/index.md
"""Update README.md by expanding embeddings in docs/docs/en/index.md
"""
typer.echo(f"Updating README.md")
expand_markdown(input_markdown_path=EN_INDEX_PATH, output_markdown_path=README_PATH)

relative_path = os.path.relpath(EN_INDEX_PATH, BASE_DIR.parent)
auto_generated = f"> **_NOTE:_** This is an auto-generated file. Please edit {relative_path} instead.\n\n"

existing_content = open(README_PATH).read()
open(README_PATH, "w").write(auto_generated + existing_content)


@app.command()
def update_contributing():
"""Update CONTRIBUTING.md by expanding embeddings in docs/docs/en/CONTRIBUTING.md
"""
typer.echo(f"Updating CONTRIBUTING.md")
expand_markdown(input_markdown_path=EN_CONTRIBUTING_PATH, output_markdown_path=CONTRIBUTING_PATH)

relative_path = os.path.relpath(EN_CONTRIBUTING_PATH, BASE_DIR.parent)
auto_generated = f"> **_NOTE:_** This is an auto-generated file. Please edit {relative_path} instead.\n\n"

existing_content = open(CONTRIBUTING_PATH).read()
open(CONTRIBUTING_PATH, "w").write(auto_generated + existing_content)


@app.command()
def update_faststream_gen_docs():
Expand Down Expand Up @@ -199,6 +221,7 @@ def _build():
subprocess.run(["mkdocs", "build", "--site-dir", BUILD_DIR], check=True)
build_api_docs()
update_readme()
update_contributing()
update_faststream_gen_docs()


Expand Down