-
Notifications
You must be signed in to change notification settings - Fork 0
Add docs #8
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
Add docs #8
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Deploy docs | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: pages | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install project + docs deps | ||
| run: | | ||
| pip install -e .[docs] | ||
|
|
||
| - name: Build docs | ||
| run: make docs | ||
rartino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: docs/_build/html | ||
|
|
||
| deploy: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
|
|
||
| steps: | ||
| - id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import os | ||
| import sys | ||
| from datetime import date | ||
|
|
||
| sys.path.insert(0, os.path.abspath("../src")) | ||
rartino marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| project = "httk-web" | ||
| author = "The httk-web AUTHORS" | ||
| copyright = f"{date.today().year}, {author}" | ||
|
|
||
| extensions = [ | ||
| "sphinx.ext.autodoc", | ||
| "sphinx.ext.autosummary", | ||
| "sphinx.ext.napoleon", | ||
| "sphinx.ext.viewcode", | ||
| "sphinx.ext.intersphinx", | ||
| "sphinx_copybutton", | ||
| ] | ||
|
|
||
| templates_path = ["_templates"] | ||
| exclude_patterns = ["_build"] | ||
|
|
||
| autosummary_generate = True | ||
|
|
||
| autodoc_default_options = { | ||
| "members": True, | ||
| "member-order": "bysource", | ||
| "undoc-members": False, | ||
| "show-inheritance": True, | ||
| } | ||
|
|
||
| html_theme = "furo" | ||
| html_theme_options = { | ||
| "sidebar_hide_name": False, | ||
| "navigation_with_keys": True, | ||
| } | ||
|
|
||
| intersphinx_mapping = { | ||
| "python": ("https://docs.python.org/3", None), | ||
| } | ||
|
|
||
| copybutton_prompt_text = r">>> |\.\.\. |\$ " | ||
| copybutton_prompt_is_regexp = True | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| How It Works | ||
| ============ | ||
|
|
||
| Current | ||
| ------- | ||
|
|
||
| The default mode is the current, modern ``httk-web`` workflow. | ||
|
|
||
| Directory layout | ||
| ^^^^^^^^^^^^^^^^ | ||
|
|
||
| A site source directory is expected to contain: | ||
|
|
||
| - ``content/``: page sources (``.md``, ``.rst``, ``.html``) | ||
| - ``templates/``: Jinja2 templates (for example ``default.html.j2`` and ``base_default.html.j2``) | ||
| - ``static/``: static files copied as-is in publish mode | ||
| - ``functions/``: optional Python modules exposing ``execute(...)`` | ||
|
|
||
| Runtime flow | ||
| ^^^^^^^^^^^^ | ||
|
|
||
| 1. Route resolution maps a URL path to a content page or static file. | ||
| 2. Content rendering extracts metadata and body HTML. | ||
| 3. Function injection evaluates ``*-function`` metadata entries when query/post constraints are satisfied. | ||
| 4. Template rendering produces final HTML through Jinja2. | ||
| 5. ASGI serving returns responses, or static publishing writes ``.html`` output files. | ||
|
|
||
| Public API | ||
| ^^^^^^^^^^ | ||
|
|
||
| The main API surface is: | ||
|
|
||
| - ``httk.web.create_asgi_app(...)`` | ||
| - ``httk.web.serve(...)`` | ||
| - ``httk.web.publish(...)`` | ||
|
|
||
| Example usage | ||
| ^^^^^^^^^^^^^ | ||
|
|
||
| Serve dynamically: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from httk.web import serve | ||
| serve("src", port=8080) | ||
|
|
||
| Publish statically: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from httk.web import publish | ||
| publish("src", "public", "http://127.0.0.1/") | ||
|
|
||
| Examples | ||
| ^^^^^^^^ | ||
|
|
||
| Modern examples live under ``examples/modern``: | ||
|
|
||
| - ``minimal`` | ||
| - ``rst_site`` | ||
| - ``blog`` | ||
| - ``search_app`` | ||
|
|
||
| Legacy | ||
| ------ | ||
|
|
||
| ``httk-web`` also supports a compatibility mode for legacy site structures and templates. | ||
|
|
||
| Enable compatibility mode | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Use ``compatibility_mode=True`` in API calls: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| from httk.web import serve | ||
| serve("src", compatibility_mode=True) | ||
|
|
||
| Compatibility behaviors | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| When compatibility mode is enabled, ``httk-web`` additionally supports: | ||
|
|
||
| - ``.httkweb`` content and ``.httkweb.html`` template resolution | ||
| - legacy formatter constructs used by old templates (for example repeat/call/if forms) | ||
| - loading global metadata from ``config.*`` (or another name via ``config_name``) | ||
| - running ``functions/init.py`` at engine startup | ||
| - ``_functions/`` directory fallback when ``functions/`` is not present | ||
|
|
||
| Examples | ||
| ^^^^^^^^ | ||
|
|
||
| Migrated legacy examples are available under ``examples/legacy``: | ||
|
|
||
| - ``static_simple`` | ||
| - ``hello_world_app`` | ||
| - ``rst_templator`` | ||
| - ``blog`` | ||
| - ``search_app`` | ||
|
|
||
| For legacy examples that use optional old ``httk`` subsystems, availability depends on those dependencies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| httk-web | ||
| ======== | ||
|
|
||
| ``httk-web`` provides web serving and static publishing functionality for ``httk`` v2. | ||
|
|
||
| Quick links | ||
| ----------- | ||
|
|
||
| - :doc:`how_it_works` | ||
| - :doc:`reference` | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 2 | ||
| :caption: Documentation | ||
|
|
||
| how_it_works | ||
| reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| Reference | ||
| ========= | ||
|
|
||
| Public API | ||
| ---------- | ||
|
|
||
| .. automodule:: httk.web.api | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: | ||
|
|
||
| Convenience Exports | ||
| ------------------- | ||
|
|
||
| .. automodule:: httk.web | ||
| :members: | ||
| :undoc-members: | ||
| :show-inheritance: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.