Skip to content

Commit 77d6ba2

Browse files
committed
add new website styling
1 parent d5a0634 commit 77d6ba2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+553
-133
lines changed

.github/workflows/docs.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: docs_pages_workflow
2+
3+
on: [pull_request]
4+
5+
permissions:
6+
pull-requests: write
7+
8+
jobs:
9+
build_docs_job:
10+
runs-on: ubuntu-latest
11+
env:
12+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v3
19+
with:
20+
python-version: 3.8
21+
22+
- name: Get pip cache dir
23+
id: pip-cache
24+
run: |
25+
python -m pip install --upgrade pip
26+
echo "dir={$(pip cache dir)}" >> $GITHUB_OUTPUT
27+
28+
- name: pip cache
29+
uses: actions/cache@v3
30+
with:
31+
path: ${{ steps.pip-cache.outputs.dir }}
32+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py', '**/requirements.txt', '**/docs/requirements.txt') }}
33+
restore-keys: |
34+
${{ runner.os }}-pip-
35+
36+
- name: Install docs requirements
37+
run: |
38+
python -m pip install -r docs/requirements.txt
39+
40+
- name: make the sphinx docs
41+
run: |
42+
make -C docs clean
43+
make -C docs html
44+
45+
- uses: readthedocs/actions/preview@v1
46+
with:
47+
project-slug: "trlx"
48+
project-language: "en"
49+
# see: https://github.com/readthedocs/actions/tree/main/preview
50+
# message-template (optional): Text message to be injected by the action in the Pull Request description. It supports the following placeholders to be replaced:
51+
# {docs-pr-index-url}: URL to the root of the documentation for the Pull Request preview.
52+
# platform (optional): Read the Docs Community (community) or Read the Docs for Business (business). (default: community)
53+
# single-version (optional): Set this to 'true' if your project is single version, so we can link to the correct URL. (default: 'false')

.pre-commit-config.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
55
rev: v4.4.0
66
hooks:
77
- id: check-case-conflict
@@ -18,17 +18,24 @@ repos:
1818
args: [--fix=lf]
1919
- id: requirements-txt-fixer
2020
- id: trailing-whitespace
21-
- repo: https://github.com/psf/black
21+
- repo: https://github.com/psf/black
2222
rev: 23.1.0
2323
hooks:
24-
- id: black
24+
- id: black
2525
files: ^(trlx|examples|tests|setup.py)/
26-
- repo: https://github.com/pycqa/isort
26+
- repo: https://github.com/pycqa/isort
2727
rev: 5.12.0
2828
hooks:
29-
- id: isort
29+
- id: isort
3030
name: isort (python)
31-
- repo: https://github.com/pycqa/flake8
31+
- repo: https://github.com/pycqa/flake8
3232
rev: 6.0.0
3333
hooks:
34-
- id: flake8
34+
- id: flake8
35+
- repo: https://github.com/codespell-project/codespell
36+
rev: v2.2.2
37+
hooks:
38+
- id: codespell
39+
args: [--ignore-words, dictionary.txt]
40+
additional_dependencies:
41+
- tomli

.readthedocs.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
16
version: 2
27

8+
build:
9+
os: "ubuntu-20.04"
10+
tools:
11+
python: "3.8"
12+
13+
# Build documentation in the docs/ directory with Sphinx
314
sphinx:
4-
configuration: docs/source/conf.py
15+
configuration: docs/conf.py
16+
fail_on_warning: false
17+
18+
# Optionally build your docs in additional formats such as PDF and ePub
19+
formats:
20+
- htmlzip
521

22+
# Optionally set the version of Python and requirements required to build your docs
623
python:
7-
version: 3.9
824
install:
9-
- requirements: docs/requirements.txt
25+
- requirements: docs/requirements.txt

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
gendoc:
2+
docker build -t trlxgendocs -f docker/docs/Dockerfile .
3+
run:
4+
docker run --rm -it \
5+
-p 8000:8000 \
6+
--entrypoint python trlxgendocs -m http.server 8000 --directory build/docs/build/html
7+
8+
sh:
9+
docker run --rm -it \
10+
-p 8000:8000 \
11+
--entrypoint /bin/bash trlxgendocs

dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rouge
2+
sart

docker/docs/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.8-slim
2+
3+
# pip install -r docs/requirements.txt
4+
# sphinx-build -b html docs docs/build/html -j auto
5+
# sphinx-build -b html -D nb_execution_mode=off docs docs/build/html -j auto
6+
7+
RUN python -m pip install --upgrade --no-cache-dir pip
8+
ADD docs/requirements.txt /tmp/requirements.txt
9+
RUN python -m pip install --exists-action=w --no-cache-dir -r /tmp/requirements.txt
10+
RUN apt-get update && apt-get install make imagemagick -y --no-install-recommends \
11+
git \
12+
&& rm -rf /var/lib/apt/lists/*
13+
RUN mkdir /build
14+
WORKDIR /build/
15+
ADD . .
16+
RUN python -m pip install -e .
17+
RUN cd docs && make html
18+
ENTRYPOINT [ "python", "-m", "http.server", "8000" ]

docs/Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# from the environment for the first two.
66
SPHINXOPTS ?=
77
SPHINXBUILD ?= sphinx-build
8-
SOURCEDIR = source
8+
SOURCEDIR = .
99
BUILDDIR = build
1010

1111
# Put it first so that "make" without argument is like "make help".
@@ -14,7 +14,20 @@ help:
1414

1515
.PHONY: help Makefile
1616

17+
logo:
18+
convert trlx_logo_red.png -define icon:auto-resize=64,48,32,16 _static/favicon.ico
19+
convert trlx_logo_red.png -resize 16x16 _static/favicon-16x16.png
20+
convert trlx_logo_red.png -resize 57x57 _static/apple-touch-icon.png
21+
convert trlx_logo_red.png -resize 57x57 _static/apple-touch-icon-57x57.png
22+
convert trlx_logo_red.png -resize 72x72 _static/apple-touch-icon-72x72.png
23+
convert trlx_logo_red.png -resize 76x76 _static/apple-touch-icon-76x76.png
24+
convert trlx_logo_red.png -resize 114x114 _static/apple-touch-icon-114x114.png
25+
convert trlx_logo_red.png -resize 120x120 _static/apple-touch-icon-120x120.png
26+
convert trlx_logo_red.png -resize 144x144 _static/apple-touch-icon-144x144.png
27+
convert trlx_logo_red.png -resize 152x152 _static/apple-touch-icon-152x152.png
28+
convert trlx_logo_red.png -resize 180x180 _static/apple-touch-icon-180x180.png
29+
1730
# Catch-all target: route all unknown targets to Sphinx using the new
1831
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19-
%: Makefile
32+
%: Makefile logo
2033
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# How To build the documentation
2+
3+
```bash
4+
make html
5+
```
6.62 KB
Loading
7.04 KB
Loading
8.74 KB
Loading
9.25 KB
Loading
11.2 KB
Loading
2.92 KB
Loading
3.91 KB
Loading
4.17 KB
Loading

docs/_static/apple-touch-icon.png

2.92 KB
Loading

docs/_static/favicon-16x16.png

767 Bytes
Loading

docs/_static/favicon.ico

31.3 KB
Binary file not shown.

docs/_static/style.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
:root {
2+
--block-bg-opacity: 0.5;
3+
}
4+
5+
.wy-side-nav-search {
6+
background-color: #fff;
7+
}
8+
9+
.getting-started {
10+
background-color: rgba(78, 150, 253, var(--block-bg-opacity));
11+
}
12+
13+
.user-guides {
14+
background-color: rgba(0, 169, 154, var(--block-bg-opacity));
15+
}
16+
17+
.developer-docs {
18+
background-color: rgba(171, 0, 182, var(--block-bg-opacity));
19+
}
20+
21+
.key-ideas {
22+
border: 0px;
23+
}

docs/_templates/layout.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{% extends "!layout.html" %}
2+
{% set css_files = css_files + ["_static/style.css"] %}

docs/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
`which sphinx-build` -T -E -b html -d _build/doctrees-readthedocs -D language=en . _build/html

0 commit comments

Comments
 (0)