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

chore: use a virtualenv for working with the docs site #2545

Merged
merged 1 commit into from
May 20, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ src/pip-delete-this-directory.txt

TEST-*.xml

tcvenv

**/go.work
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,25 @@ test-examples:
tidy-all:
make -C examples tidy-examples
make -C modules tidy-modules

## -------------------------------------

TCENV=tcvenv
PYTHONBIN=./$(TCENV)/bin

tcvenv: tcvenv/touchfile

tcvenv/touchfile:
@echo "Creating docs $(TCENV)..."
test -d $(TCENV) || python3 -m venv $(TCENV)
@echo "Installing requirements..."
. $(PYTHONBIN)/activate; pip install -Ur requirements.txt
touch $(TCENV)/touchfile

clean-docs:
@echo "Destroying docs $(TCENV)..."
rm -rf $(TCENV)

.PHONY: serve-docs
serve-docs: tcvenv
. $(PYTHONBIN)/activate; $(PYTHONBIN)/mkdocs serve
18 changes: 14 additions & 4 deletions docs/contributing_docs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to documentation

The Testcontainers for Go documentation is a static site built with [MkDocs](https://www.mkdocs.org/).
The _Testcontainers for Go_ documentation is a static site built with [MkDocs](https://www.mkdocs.org/).
We use the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme, which offers a number of useful extensions to MkDocs.

In addition we use a [custom plugin](https://github.com/rnorth/mkdocs-codeinclude-plugin) for inclusion of code snippets.
Expand All @@ -11,9 +11,19 @@ We publish our documentation using Netlify.

### Using Python locally

* Ensure that you have Python 3.8.0 or higher.
* Set up a virtualenv and run `pip install -r requirements.txt` in the `testcontainers-go` root directory.
* Once Python dependencies have been installed, run `mkdocs serve` to start a local auto-updating MkDocs server.
From the root directory of the repository, you can use the following command to build and serve the documentation locally:

```shell
make serve-docs
```

It will use a Python's virtual environment to install the required dependencies and start a local server at `http://localhost:8000`.

Once finished, you can destroy the virtual environment with the following command:

```shell
make clean-docs
```

### PR Preview deployments

Expand Down