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

Add docs for live HTML preview of documentation and clean up. #679

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ New features:
- Test compatibility with Python 3.12
- Add function ``icalendar.use_pytz()``.
- Add `sphinx-autobuild` for `livehtml` Makefile target.
- Add documentation of live HTML preview of documentation and clean up of ``install.rst``.

Bug fixes:

Expand Down
61 changes: 31 additions & 30 deletions docs/install.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
Installing iCalendar
====================

To install the icalendar package, use::
To install the icalendar package, use:

pip install icalendar
.. code-block:: shell

pip install icalendar

If installation is successful, you will be able to import the iCalendar
package, like this::
package, like this:

.. code-block:: pycon
stevepiercy marked this conversation as resolved.
Show resolved Hide resolved

>>> import icalendar
>>> import icalendar

Development Setup
-----------------
Expand All @@ -19,7 +23,7 @@ using Git.
You can `fork <https://github.com/collective/icalendar/fork>`_
the project first and clone your fork, too.

.. code-block:: bash
.. code-block:: shell

git clone https://github.com/collective/icalendar.git
cd icalendar
Expand All @@ -39,7 +43,7 @@ Install Tox

First, install `tox <https://pypi.org/project/tox/>`_..

.. code-block:: bash
.. code-block:: shell

pip install tox

Expand All @@ -53,7 +57,7 @@ Running Tests

To run all tests in all environments, simply run ``tox``

.. code-block:: bash
.. code-block:: shell

tox

Expand All @@ -63,7 +67,7 @@ Have a look at the `documentation
<https://tox.wiki/en/latest/example/general.html#selecting-one-or-more-environments-to-run-tests-against>`__.
This is how you can run ``tox`` with Python 3.9:

.. code-block:: bash
.. code-block:: shell

tox -e py39

Expand All @@ -73,7 +77,7 @@ Accessing a ``tox`` environment
If you like to enter a specific tox environment,
you can do this:

.. code-block:: bash
.. code-block:: shell

source .tox/py39/bin/activate

Expand All @@ -93,7 +97,7 @@ this section explains how to do it.
You can install the local copy of ``icalendar`` with ``pip``
like this:

.. code-block:: bash
.. code-block:: shell

cd icalendar
python -m pip install -e .
Expand All @@ -106,40 +110,37 @@ manually setup ``icalendar`` like this.

Try it out:

.. code-block:: python
.. code-block:: pycon

Python 3.9.5 (default, Nov 23 2021, 15:27:38)
Type "help", "copyright", "credits" or "license" for more information.
>>> import icalendar
>>> icalendar.__version__
'5.0.13'

Building the documentation
--------------------------
Build the documentation
-----------------------

To build the documentation, follow these steps:

To build the documentation follow these steps:
.. code-block:: shell

.. code-block:: bash
source .tox/py311/bin/activate
pip install -r requirements_docs.txt
cd docs
make html

$ source .tox/py39/bin/activate
$ pip install -r requirements_docs.txt
$ cd docs
$ make html
You can now open the output from ``_build/html/index.html``.

You can now open the output from ``_build/html/index.html``. To build the
presentation-version use ``make presentation`` instead of ``make html``. You
can open the presentation at ``presentation/index.html``.
To build the documentation, view it in a web browser, and automatically reload changes while you edit documentation, use ``make livehtml`` instead of ``make html``.
stevepiercy marked this conversation as resolved.
Show resolved Hide resolved
Then open a web browser at `http://127.0.0.1:8050 <http://127.0.0.1:8050>`_.

To build the presentation-version use ``make presentation`` instead of ``make html``.
You can open the presentation at ``presentation/index.html``.

You can also use ``tox`` to build the documentation:

.. code-block:: bash
.. code-block:: shell

cd icalendar
tox -e docs

If you would like to serve the documentation and access it from your browser,
you can run the HTTP server:

.. code-block:: bash

python3 -m http.server -d docs/_build/html/