Skip to content

Commit

Permalink
add script for building docs without docker
Browse files Browse the repository at this point in the history
  • Loading branch information
RLKRo committed Jan 24, 2025
1 parent a32ab51 commit ef11ff9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ Note that you'll need `pandoc` installed on your system in order to build docs.

After that `docs/build` dir will be created and you can open index file `docs/build/index.html` in your browser of choice.

You can also build docs faster without docker by running

```bash
poetry run poe docs_no_docker
```

Without docker some tutorials (that require docker services) will show errors and drawio diagrams will not be built.

#### Documentation links

In your tutorials, you can use special expanding directives in markdown cells.
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
]

suppress_warnings = ["image.nonlocal_uri", "config.cache"]
nbsphinx_allow_errors = os.getenv("NBSPHINX_ALLOW_ERRORS", "false").lower() in ("true", "1")
source_suffix = ".rst"
master_doc = "index"

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ test_no_cov = "scripts.test:test_no_cov"
test_no_deps = "scripts.test:test_no_deps"
test_all = "scripts.test:test_all"
docs = "scripts.doc:docs"
docs_no_docker = "scripts.doc:docs_no_docker"



Expand Down
12 changes: 12 additions & 0 deletions scripts/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,15 @@ def docs(docker: Optional[DockerClient]):
else:
print(f"{Fore.RED}Docs can be built on Linux platform only!{Style.RESET_ALL}")
exit(1)


def docs_no_docker():
init()
clean_docs()
dotenv.load_dotenv(".env_file")
os.environ["DISABLE_INTERACTIVE_MODE"] = "1"
os.environ["NBSPHINX_ALLOW_ERRORS"] = "true"
result = apidoc.main(["-e", "-E", "-f", "-o", "docs/source/apiref", "chatsky"])
result += build.make_main(["-M", "clean", "docs/source", "docs/build"])
result += build.build_main(["-b", "html", "-W", "--keep-going", "docs/source", "docs/build"])
exit(result)
16 changes: 14 additions & 2 deletions scripts/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ def info():
f"{Fore.BLUE}poetry run poe test_all{Style.RESET_ALL}:"
+ " Run ALL tests, prohibit skipping, run Docker (slow, closest to CI)"
)
print(
f"{Fore.BLUE}poetry run poe quick_test{Style.RESET_ALL}:"
+ " Run tests that do not require docker and are not marked with 'slow'"
)
print(
f"{Fore.BLUE}poetry run poe quick_test{Style.RESET_ALL}:"
+ " Run tests that do not require docker and are not marked with 'slow' and collect coverage"
)
print(
f"{Fore.BLUE}poetry run poe docs{Style.RESET_ALL}:"
+ " Build Sphinx docs; activate your virtual environment before execution"
+ " Build Sphinx docs"
)
print(
f"{Fore.BLUE}poetry run poe docs_no_docker{Style.RESET_ALL}:"
+ " Build Sphinx docs; "
)
print(f"{Fore.BLUE}poetry run poe clean_docs{Style.RESET_ALL}: Remove all documentation build roots")
print(f"{Fore.BLUE}poen clean{Style.RESET_ALL}: Clean all build artifacts\n")
print(f"{Fore.BLUE}poetry run poe clean{Style.RESET_ALL}: Clean all build artifacts\n")

0 comments on commit ef11ff9

Please sign in to comment.