Skip to content

Commit 863ab62

Browse files
fixed docs
1 parent ed275fd commit 863ab62

File tree

3 files changed

+33
-30
lines changed

3 files changed

+33
-30
lines changed

docs/docs_github.rst

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
Documentation (GitHub Actions)
22
==============================
33

4-
This page explains how the repository builds the Sphinx documentation and publishes
5-
the generated HTML to GitHub Pages using GitHub Actions.
4+
This page explains how the repository builds the Sphinx documentation and publishes the generated HTML to GitHub Pages using GitHub Actions.
65

76
The workflow does the following:
87

9-
- Whenever a commit is pushed to `main`, the workflow checks out the repository (manual dispatch is also supported).
10-
- Sets up Python and installs the ``docs`` dependencies from :file:`pyproject.toml`.
11-
- Builds HTML with ``sphinx-build`` into ``docs/_build/html``.
12-
- Uploads the built HTML as a Pages artifact and deploys it to GitHub Pages.
8+
1. Whenever a commit is pushed to `main`, the workflow checks out the repository (manual dispatch is also supported).
9+
2. Sets up Python and installs the ``docs`` dependencies from :file:`pyproject.toml`.
10+
3. Builds HTML with ``sphinx-build`` into ``docs/_build/html``.
11+
4. Uploads the built HTML as a Pages artifact and deploys it to GitHub Pages.
12+
13+
.. note::
14+
15+
First ensure the documentation is built correctly locally. See the previous page :doc:`Documentation (local) <docs_local>`.
16+
17+
18+
.. note::
19+
Best practice: do NOT commit generated files (``docs/_build``, ``docs/_autosummary``) to the repository.
20+
Keep them in ``.gitignore`` and let CI produce the HTML.
21+
If you plan to serve source HTML directly from the ``docs/`` folder (without a build step), then you'd need to commit generated files — but the current workflow builds on CI and deploys the result, so committing generated files is unnecessary.
1322

1423
Repository setup (one-time)
1524
---------------------------
1625
1. Ensure the repository has GitHub Pages enabled for the ``gh-pages`` site (no manual branch required when using the Pages actions). In repository Settings → Pages you should see the site status after the first successful run.
1726
2. No secret is required. The workflow uses the repository's built-in ``GITHUB_TOKEN`` permissions to publish pages.
1827

19-
Local testing
20-
-------------
21-
See the previous page :doc:`Local documentation <docs_local>` for additional local setup and testing instructions.
22-
23-
Autosummary and generated files
24-
-------------------------------
25-
- ``autosummary_generate = True`` is enabled in ``docs/conf.py``, so Sphinx will generate the ``_autosummary`` pages during the build.
26-
- Best practice: do NOT commit generated files (``docs/_build``, ``docs/_autosummary``) to the repository. Keep them in ``.gitignore`` and let CI produce the HTML. If you plan to serve source HTML directly from the ``docs/`` folder (without a build step), then you'd need to commit generated files — but the current workflow builds on CI and deploys the result, so committing generated files is unnecessary.
27-
2828
Troubleshooting
2929
---------------
3030
- If builds fail due to missing packages, ensure :file:`pyproject.toml` contains the correct ``docs`` extras and that ``pip install -e ".[docs]"`` succeeds.
3131
- If the site does not appear after the workflow succeeds, check Settings → Pages to ensure the site is not blocked by organization policy.
32-
33-
The workflow will attempt to publish your Sphinx docs automatically when you push to ``main``.

docs/tests.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
Tests
22
=====
33

4-
It is a good idea to run the tests after installation to make sure the library works.
4+
It is a good idea to run the tests right after installation to make sure the library works (see “Running the tests manually” below).
55

6-
Testing during development is essential for identifying issues early and ensuring that new features do not break existing functionality.
6+
Running tests frequently during development catches issues early, provide fast feedback during development, and make refactoring safer. They also serve as executable documentation of expected behavior, reducing the risk of shipping bugs.
77

8-
Automated tests provide confidence in code changes and help maintain a stable and reliable code base as the project evolves. In the next section we'll see how to automatically run tests whenever the repository is pushed to the remote using GitHub-Actions.
9-
10-
Test-driven development is a software development approach where tests are written before the actual code. This process helps clarify requirements, ensures code correctness, and encourages modular design. By writing tests first, developers can catch bugs early and maintain a high level of code quality.
8+
Test-driven development (TDD) means writing a failing test before implementing functionality. This practice clarifies requirements, encourages small, focused changes and modular design, and helps prevent regressions as the codebase evolves.
119

10+
For information on running tests automatically in CI, see the “GitHub Actions workflow for testing” section below for details on the included workflow that runs on pushes and pull requests.
1211

1312
Running the tests manually
1413
--------------------------
@@ -20,3 +19,9 @@ Run the full PyTest test suite with coverage:
2019
pytest -q --cov=python_project_template_AS --cov-report=term --cov-report=html
2120
2221
Open ``htmlcov/index.html`` to view the coverage report.
22+
23+
24+
GitHub Actions workflow for testing
25+
-----------------------------------
26+
27+
This project includes a CI workflow at ``.github/workflows/tests.yml`` that runs on pushes and pull requests. The workflow sets up one or more Python versions, installs the package and test dependencies, runs exact configuration used in this project.

docs/usage.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ The following is a quick example for the Calculator API. It shows how to:
99

1010
.. code-block:: python
1111
12-
from python_project_template_AS import default_calculator, Operation
12+
from python_project_template_AS import default_calculator, Operation # import API
1313
14-
calc = default_calculator()
14+
calc = default_calculator() # create a calculator instance
1515
16-
print(calc.apply('add', 2, 3)) # -> 5
16+
print(calc.apply('add', 2, 3)) # use built-in addition -> 5
1717
18-
f = calc.compose(['neg', 'sqr'])
19-
print(f(-3)) # -> 9
18+
f = calc.compose(['neg', 'sqr']) # compose negation and squaring
19+
print(f(-3)) # composed function applied -> 9
2020
21-
def inc(x):
21+
def inc(x): # define increment operation
2222
return x + 1
2323
24-
calc.register(Operation('inc', inc, arity=1), replace=True)
25-
print(calc.apply('inc', 4))
24+
calc.register(Operation('inc', inc, arity=1), replace=True) # register new operation
25+
print(calc.apply('inc', 4)) # apply new operation -> 5
2626
2727
Find additional examples in ``examples/``.

0 commit comments

Comments
 (0)