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

IPC Contribution Request Initial Version #85

Closed
wants to merge 13 commits into from
Closed
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 .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PYTHONPATH=${workspaceFolder}/_extensions

13 changes: 0 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,3 @@ MODULE.bazel.lock

# Ruff
.ruff_cache

# docs:incremental and docs:ide_support build artifacts
/_build

# Python
.venv

# Vale - editorial style guide
.vale.ini
styles/

# direnv - folder-specific bash configuration
.envrc
5 changes: 5 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ regex=^[a-z_-]+: .+$
# First line of the commit message body must be empty. (second line of the commit message)
[body-first-line-empty]

# Body must contain a reference to an issue
# 'see' will act as a form of reference from commits to issues without closing them.
[body-match-regex]
regex=Issue-ref: (see|close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) #(\d+)

#Ignores the title if it starts with Revert or Merge
[ignore-by-title]
regex=(^Revert |^Merge )
58 changes: 17 additions & 41 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,29 @@
"files.trimTrailingWhitespace": true,
"editor.insertSpaces": true,
"editor.tabCompletion": "on",

// Default for any filetype
"editor.wordWrap": "wordWrapColumn",
"editor.wrappingIndent": "same",
"editor.wordWrapColumn": 100,
"editor.rulers": [
100
],
//
//

// Python Settings
"[python]": {
// In python using 80 characters per line is the standard.
"editor.rulers": [
79
],
},

// RST Settings
"[restructuredtext]": {
"editor.tabSize": 3,
"editor.tabSize": 3,
},
//
//
// Esbonio 0.x (Current)
// see https://github.com/swyddfa/esbonio/blob/0.x/docs/lsp/getting-started.rst
// and https://github.com/swyddfa/esbonio/blob/0.x/docs/lsp/editors/vscode/_configuration.rst
"esbonio.server.pythonPath": "${workspaceFolder}/.venv_docs/bin/python",
"esbonio.sphinx.srcDir": "${workspaceFolder}/docs",
"esbonio.sphinx.confDir": "${workspaceFolder}/docs",
"esbonio.sphinx.buildDir": "${workspaceFolder}/_build",
"esbonio.server.logLevel": "info",
// Do not auto-install. We'll use the one in the venv.
"esbonio.server.installBehavior": "nothing",
// Enable port forwarding for preview if working on remote workstation
"remote.autoForwardPorts": true,
"remote.autoForwardPortsSource": "process",
//
//
// Esbonio 1.x (Preview)
"esbonio.sphinx.pythonCommand": [
".venv_docs/bin/python"
],
"esbonio.sphinx.buildCommand": [
"docs",
"_build",
"--jobs",
"auto"

// Python emnvironment
"python.envFile": "${workspaceFolder}/.env",

// Restructured Text
"restructuredtext.linter.doc8.extraArgs": [
"--config",
"${workspaceFolder}/docs/doc8.ini"
],
// default is "error", which doesn't show anything.
"esbonio.logging.level": "warning"

// Sphinx-Needs
"ubcode.srcDir": "${workspaceFolder}/docs",
"ubcode.needsJson": "${workspaceFolder}/docs/needs.json",

}
4 changes: 0 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ pip.parse(
)
use_repo(pip, "pip_sphinx")

# Additional Python rules provided by aspect, e.g. an improved version of
# `py_binary`. But more importantly, it provides `py_venv`.
bazel_dep(name = "aspect_rules_py", version = "1.0.0")

###############################################################################
#
# Packaging dependencies
Expand Down
58 changes: 6 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,14 @@ $ bazel run //:format.fix

## Documentation

Score supports multiple methods for generating documentation, tailored to different workflows:
1. **Bazel-based builds** for clean, sandboxed outputs.
2. **Incremental builds** for quick iterations during development.
3. **IDE integration** for live previews, live warnings and even faster iterations.

### Bazel-based Build

This method ensures clean and isolated documentation builds in a controlled Bazel environment.
It is best suited for CI pipelines or production-ready outputs, although it takes longer compared to
incremental builds.

```sh
bazel build //docs:docs
Use //docs:docs target to build the documentation.
```
The output will be located in bazel-bin/docs/docs/_build/html.


### Incremental build

For local changes and faster feedback, use the incremental build.
This method generates the documentation directly in the _build directory.

```sh
bazel run //docs:incremental
$ bazel build //docs:docs
```
Unlike IDE integration, which renders only the current file, this approach is ideal for quickly
verifying edits across the entire documentation during development.


### IDE integration
The output directory can be found under ```bazel-bin/docs/docs/_build/html```.

For live previews, warnings, and linting during development,
integrate Esbonio with your IDE (e.g., VS Code):

```sh
bazel run //docs:ide_support
If you need to update pip dependencies, after modifying the requirements file, regenerate the lock file:
```
bazel run //docs:requirements.update
```

VS Code: Install the Esbonio extension in VS Code. After installation, restart your IDE.
You should now have live preview available when you open a `.rst` file.
Note: if the extension was already installed when you ran the `ide_support` command,
you will need to restart your IDE.

For features like type detection in conf.py or extensions,
point your IDE to the .venv_docs virtual environment.

Re-run //docs:ide_support if you update Sphinx extensions or other dependencies.

### Notes
#### Output Locations
* Bazel builds output to bazel-bin/docs/docs/_build/html.
* Incremental builds output to _build.

#### Troubleshooting
* Restart your IDE if live previews or warnings are not working after running ide_support.
* Ensure your virtual environment is up-to-date by re-running //docs:ide_support when dependencies
change.
54 changes: 1 addition & 53 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,13 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

# Multiple approaches are available to build the same documentation output:
#
# 1. **Esbonio via IDE support (`ide_support` target)**:
# - Listed first as it offers the least flexibility in implementation.
# - Designed for live previews and quick iterations when editing documentation.
# - Integrates with IDEs like VS Code but requires the Esbonio extension.
# - Requires a virtual environment with consistent dependencies (see 2).
#
# 2. **Directly running Sphinx in the virtual environment**:
# - As mentioned above, a virtual environment is required for running esbonio.
# - Therefore, the same environment can be used to run Sphinx directly.
# - Option 1: Run Sphinx manually via `.venv_docs/bin/python -m sphinx docs _build --jobs auto`.
# - Option 2: Use the `incremental` target, which simplifies this process.
# - Usable in CI pipelines to validate the virtual environment used by Esbonio.
# - Ideal for quickly generating documentation during development.
#
# 3. **Bazel-based build (`docs` target)**:
# - Runs the documentation build in a Bazel sandbox, ensuring clean, isolated builds.
# - Less convenient for frequent local edits but ensures build reproducibility.
#
# **Consistency**:
# When modifying Sphinx extensions or configuration, ensure all three methods
# (Esbonio, incremental, and Bazel) work as expected to avoid discrepancies.
#
# For user-facing documentation, refer to `/README.md`.

load("@aspect_rules_py//py:defs.bzl", "py_venv")
load("@pip_sphinx//:requirements.bzl", "all_requirements", "requirement")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_python//python:defs.bzl", "py_library")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")

# all_requirements include esbonio which we don't need most of the time.
# Hint: the names are e.g. "@@rules_python~~pip~pip_sphinx//esbonio:pkg"
sphinx_requirements = [name for name in all_requirements if not "esbonio" in name] + [":extensions"]

sphinx_docs(
name = "docs",
srcs = glob([
Expand All @@ -74,7 +43,7 @@ sphinx_docs(

sphinx_build_binary(
name = "sphinx_build",
deps = sphinx_requirements,
deps = [":extensions"] + all_requirements,
)

py_library(
Expand All @@ -86,11 +55,6 @@ py_library(
imports = ["."],
)

# In order to update the requirements, change the `requirements.txt` file and run:
# `bazel run //docs:requirements`.
# This will update the `requirements_lock.txt` file.
# To upgrade all dependencies to their latest versions, run:
# `bazel run //docs:requirements -- --upgrade`.
compile_pip_requirements(
name = "requirements",
src = "requirements.txt",
Expand All @@ -116,19 +80,3 @@ pkg_tar(
name = "github-pages",
srcs = [":html_files"],
)

# Run-time build of documentation, incl. incremental build support.
py_binary(
name = "incremental",
srcs = ["incremental.py"],
deps = sphinx_requirements,
)

# Virtual python environment for working on the documentation (esbonio).
# incl. python support when working on conf.py and sphinx extensions.
py_venv(
name = "ide_support",
venv_name = ".venv_docs",
# Until release of esbonio 1.x, we need to install it ourselves so the VS Code extension can find it.
deps = sphinx_requirements + [requirement("esbonio")],
)
3 changes: 1 addition & 2 deletions docs/_assets/css/score.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ div.score_banner {
#videowrapper{
position: relative;
overflow: hidden;
margin-bottom: 50px;
}

#fullScreenDiv{
Expand Down Expand Up @@ -210,7 +209,7 @@ div.score_banner {
/* font-size: 4.5em; */
font-size: 8.0cqw;
font-weight: 900;
margin-bottom: 20px;

/* Is somehow cool with image/video title background */
/*animation: fadeIn 3s; */
}
Expand Down
20 changes: 0 additions & 20 deletions docs/_assets/css/score_design.css

This file was deleted.

5 changes: 0 additions & 5 deletions docs/_assets/css/score_needs.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,3 @@ html[data-theme="dark"] {
background-color: var(--pst-color-table-row-zebra-high-bg);
}

html[data-theme="dark"] {
--sn-color-need-bg-head: #20242b;
--sn-color-datatable-label: var(--pst-color-text-base)
}

Loading