Skip to content

Documentation Rewrite #519

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

Merged
merged 70 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
4b72903
reorganize docs
rmorshea Oct 19, 2021
7c43fbe
docs reorganization
rmorshea Oct 20, 2021
668fab8
restructure after seeing new react docs
rmorshea Oct 23, 2021
6315abc
one more round of organization
rmorshea Oct 26, 2021
2f677c3
finally start using MyST
rmorshea Oct 27, 2021
efb646a
minor improvements to landing page
rmorshea Oct 28, 2021
33a2d95
being "getting started" section and add sample app
rmorshea Nov 7, 2021
100c41f
start on installation section
rmorshea Nov 7, 2021
31283c8
start writing install/running sections
rmorshea Nov 9, 2021
d66b93b
mostly finish getting-started
rmorshea Nov 9, 2021
ea224bc
finish getting started section
rmorshea Nov 9, 2021
57cafec
more minor improvements
rmorshea Nov 10, 2021
380f3b1
start writing creating interfaces section
rmorshea Nov 10, 2021
e224463
misc changes
rmorshea Nov 11, 2021
714f820
misc progress on your first component section
rmorshea Nov 11, 2021
9c7b7f6
allow example to be organized into folders
rmorshea Nov 12, 2021
ea5f4ff
misc changes following review
rmorshea Nov 13, 2021
0bed22d
simplify HTML with IDOM section
rmorshea Nov 13, 2021
182d3b1
improve your first component section
rmorshea Nov 14, 2021
766821f
finish off your firt component section
rmorshea Nov 15, 2021
431de63
finish off creating interfaces main content
rmorshea Nov 16, 2021
7402a71
finish off creating-interfaces
rmorshea Nov 16, 2021
229329f
add mountWithLayoutServer client func
rmorshea Nov 16, 2021
aea51cb
add inital work for responding to events
rmorshea Nov 16, 2021
d79962e
finish up responding to events section
rmorshea Nov 17, 2021
50422ef
add index section for responding to events
rmorshea Nov 17, 2021
30067ab
misc improvements + start on component state doc
rmorshea Nov 17, 2021
73d3e17
fix misc refs in docs
rmorshea Nov 17, 2021
f5b6fa8
allow examples to be organized in directory
rmorshea Nov 17, 2021
f65a294
make progress on components with state
rmorshea Nov 18, 2021
bfdf612
work on intro to state section
rmorshea Nov 19, 2021
18d6b3a
finish up the tabs
rmorshea Nov 20, 2021
4aca6db
finish off components with state section
rmorshea Nov 20, 2021
66ade15
add test for new event handler behavior
rmorshea Nov 20, 2021
15f4ed4
try to get tests passing again
rmorshea Nov 20, 2021
36e448b
update selenium find_element_* usages
rmorshea Nov 20, 2021
946a598
do not use SO_REUSEADDR when testing
rmorshea Nov 20, 2021
b5b9ca4
fix title underlines
rmorshea Nov 20, 2021
8c3a95a
fix doctests
rmorshea Nov 20, 2021
91c244d
fix more selenium find_element_by_* usages
rmorshea Nov 20, 2021
0edc111
actually remove deprecated selenium usages
rmorshea Nov 20, 2021
2e59dd2
rename Server proto to ServerType + test_sample
rmorshea Nov 20, 2021
c567ccb
fix docs docker + docs type annotation
rmorshea Nov 20, 2021
cae8ea7
finishing touches
rmorshea Nov 20, 2021
496bcd1
fix up docker image
rmorshea Nov 21, 2021
bff7e1d
fix false possitive key warning
rmorshea Nov 21, 2021
64a38d5
start marking sections as under construction
rmorshea Nov 23, 2021
a0c0ffd
add more construction signs
rmorshea Nov 24, 2021
f8b0b99
fix force update in example loader
rmorshea Nov 24, 2021
1c1e573
add some diagrams for state as snapshot
rmorshea Dec 5, 2021
6335666
try and make examples load relative to current file
rmorshea Dec 5, 2021
9e45531
allow example to live closer to content
rmorshea Dec 5, 2021
632f968
rename files and directive names
rmorshea Dec 5, 2021
6eb9631
add send_message ex
rmorshea Dec 5, 2021
e35c8ad
add more to state as snapshot
rmorshea Dec 5, 2021
f0960ba
finish off state as a snapshot
rmorshea Dec 7, 2021
f12a207
finish multiple state updates
rmorshea Dec 7, 2021
e6bd55e
black updated and rerun
rmorshea Dec 7, 2021
4b523ae
final touches
rmorshea Dec 8, 2021
4c5659d
make misc corrections
rmorshea Dec 13, 2021
fbe5edb
go back to old card grid
rmorshea Dec 13, 2021
7bd0449
make text searchable
rmorshea Dec 13, 2021
a8d308f
simplify CI scripts
rmorshea Dec 14, 2021
31ecfd7
misc docs improvements
rmorshea Dec 14, 2021
b011c3e
log if running in CI
rmorshea Dec 14, 2021
d512a92
run external for npm install latest
rmorshea Dec 14, 2021
26375b3
improve log message
rmorshea Dec 14, 2021
6e7314d
do not test 3.10 yet
rmorshea Dec 14, 2021
6a88c7a
fix prettier label
rmorshea Dec 14, 2021
d02376a
remove requireents from manifest
rmorshea Dec 14, 2021
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
77 changes: 25 additions & 52 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,28 @@ on:
- cron: "0 0 * * *"

jobs:
test-python:
test-python-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nanasess/setup-chromedriver@master
- uses: actions/setup-node@v2-beta
with:
node-version: "14.x"
node-version: "14"
- name: Use Latest Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install latest NPM
run: |
npm install -g [email protected]
npm --version
python-version: "3.9"
- name: Install Python Dependencies
run: pip install -r requirements/test-run.txt
- name: Run Tests
run: nox -s test -- --headless
test-python-versions:
env: { "CI": "true" }
run: nox -s test_python_suite -- --headless
test-python-environments:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9"]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
Expand All @@ -47,60 +44,36 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install latest NPM
run: |
npm install -g [email protected]
npm --version
- name: Install Python Dependencies
run: pip install -r requirements/test-run.txt
- name: Run Tests
run: nox -s test -- --headless --no-cov
test-javascript:
env: { "CI": "true" }
run: nox -s test_python -- --headless --no-cov
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- name: Install latest NPM
run: |
npm install -g [email protected]
npm --version
- name: Test Javascript
working-directory: ./src/client
run: |
npm install
npm test
npm run build
test-documentation-image:
runs-on: ubuntu-latest
steps:
- name: Check out src from Git
uses: actions/checkout@v2
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Build Docker Image
run: docker build . --file docs/Dockerfile
test-build-package:
- name: Use Latest Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install Python Dependencies
run: pip install -r requirements/test-run.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s test_docs
test-javascript:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- name: Use Latest Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install latest NPM
run: |
npm install -g [email protected]
npm --version
- name: Install Python Dependencies
run: |
pip install --upgrade pip
pip install -r requirements/build-pkg.txt
- name: Test Build Creation
run: python setup.py bdist_wheel sdist
run: pip install -r requirements/test-run.txt
- name: Run Tests
env: { "CI": "true" }
run: nox -s test_javascript
6 changes: 5 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: 20.8b1
rev: 21.12b0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -12,3 +12,7 @@ repos:
hooks:
- id: isort
name: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.5.1"
hooks:
- id: prettier
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
recursive-include src/idom/client *
recursive-include src/idom/web/templates *
include requirements/prod.txt
include requirements/extras.txt
16 changes: 11 additions & 5 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.9

WORKDIR /app/

Expand All @@ -18,7 +18,6 @@ RUN pip install --upgrade pip
# Install IDOM
# ------------
ADD requirements ./requirements
ADD .git ./.git
ADD src ./src
ADD scripts ./scripts
ADD setup.py ./
Expand All @@ -28,16 +27,23 @@ ADD README.md ./

RUN pip install -e .[all]

# Add License
# -----------
Add LICENSE /app/

# Build the Docs
# --------------
ADD docs/main.py ./docs/
ADD docs/__init__.py ./docs/
ADD docs/app.py ./docs/
ADD docs/examples.py ./docs/
ADD docs/source ./docs/source

RUN pip install -r requirements/build-docs.txt
RUN sphinx-build -b html docs/source docs/build
RUN sphinx-build -W -b html docs/source docs/build

# Define Entrypoint
# -----------------
ENV PORT 5000
ENV IDOM_DEBUG_MODE=1
CMD python docs/main.py
ENV IDOM_CHECK_VDOM_SPEC=0
CMD python scripts/run_docs.py
18 changes: 18 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# IDOM's Documentation

We provide two main ways to run the docs. Both use `nox` which has a `noxfile.py` at the
root of the repository. Running the docs with `nox -s docs` will start up an iteractive
session which will rebuild the docs any time a file is modified. Using `nox -s
docs_in_docker` on the other hand, will build a docker image and run the docs from
there. The latter command mimics how the docs will behave in production. As such, if any
changes to the core of the documentation are made (i.e. to non-`*.rst` files), then you
should run a manual test of the documentation using the `docs_in_docker` session.

If you with to build and run the docs by hand you need to perform two commands, each
being run from the root of the repository:

- `sphinx-build -b html docs/source docs/build`
- `python scripts/run_docs.py`

The first command constructs the static HTML and any Javascript. The latter actually
runs the web server that serves the content.
4 changes: 4 additions & 0 deletions docs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .app import run


__all__ = ["run"]
60 changes: 60 additions & 0 deletions docs/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import os
from logging import getLogger
from pathlib import Path

from sanic import Sanic, response

from idom.server.sanic import PerClientStateServer
from idom.widgets import multiview

from .examples import load_examples


HERE = Path(__file__).parent
IDOM_MODEL_SERVER_URL_PREFIX = "/_idom"

logger = getLogger(__name__)


IDOM_MODEL_SERVER_URL_PREFIX = "/_idom"


def run():
app = make_app()

PerClientStateServer(
make_examples_component(),
{
"redirect_root_to_index": False,
"url_prefix": IDOM_MODEL_SERVER_URL_PREFIX,
},
app,
)

app.run(
host="0.0.0.0",
port=int(os.environ.get("PORT", 5000)),
workers=int(os.environ.get("WEB_CONCURRENCY", 1)),
debug=bool(int(os.environ.get("DEBUG", "0"))),
)


def make_app():
app = Sanic(__name__)

app.static("/docs", str(HERE / "build"))

@app.route("/")
async def forward_to_index(request):
return response.redirect("/docs/index.html")

return app


def make_examples_component():
mount, component = multiview()

for example_name, example_component in load_examples():
mount.add(example_name, example_component)

return component
Loading