Skip to content

Commit

Permalink
📚 docs: Upadting documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
digsim committed Oct 8, 2024
1 parent 4932643 commit 1832f6a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 193 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
1.3.1 (unreleased)
------------------

- Nothing changed yet.
- doc: Update documentation

- ci: better ci/cd pipelines


1.3.0 (2024-02-26)
Expand Down
7 changes: 1 addition & 6 deletions docs/about.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
About
=====

Copying meetings from the calendar to the ITC system is a tedious task.
Furthermore, it would be nice if an event could already specify on which contract
it should be booked.

``adnitc`` adresses these problems. It allows to parse the information contained in
the comment field of an event and creates the corersponding ITC entries.
``seriesManagementSystem`` is a tool to administrate a pool of individual exercisese out of which weekly exercice lessons - a series - can be created. Each exercise come with the task and its solution. The idea is to create weekly collections of exercises - series - which are then distributed to the students. After a week they have to hand in their solutions. During the next lesson the solution sheet is distributed. The ``seriesManagementSystem`` allows to dynamically create these series out of the bucket of available individual exercises.
3 changes: 1 addition & 2 deletions docs/downloads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ Downloads

Download files directly from here:

* :download:`seriesmgmt27.pex <../dist/seriesmgmt27.pex>`
* :download:`seriesmgmt35.pex <../dist/seriesmgmt35.pex>`
* :download:`seriesmgmt_.pex <../dist/seriesmgmt_.pex>`
169 changes: 40 additions & 129 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,55 @@ Installation

From Download
--------------
The simplest way to use *adnitc* is to download the packaged *pex* file from `adnitc`_ and put it somewhere on the path like ``/usr/local/bin/``or ``/usr/local/share/bin``or ``~/.local/bin/``

From this point on, the binary can be executed by calling the *pex* file directly. There exist 3 variants of the *pex* file, depending on the availalbe python version. Choose either *adnitc26.pex*, *adnitc27.pex* or *adnitc35.pex* depending on what is availalbe on your system.
The simplest way to use *seriesManagementSystem* is to download the packaged *pex* file from `sms`_ and put it somewhere on the path like ``/usr/local/bin/``or ``/usr/local/share/bin``or ``~/.local/bin/`` and make it executable,

From this point on, the binary can be executed by calling the *pex* file directly.

.. only:: builder_html

Download files directly from here:

* :download:`seriesmgmt27.pex <../dist/seriesmgmt27.pex>`
* :download:`seriesmgmt35.pex <../dist/seriesmgmt35.pex>`
* :download:`seriesManagementSystem_.pex <../dist/seriesManagementSystem_.pex>` For Python > 3.10

From pip
---------

Simply run::

sudo -H pip install adnitc
pipx install seriesManagementSystem


From Sources
-------------

Create a Virtual Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To not tamper the system wide Python installation first create a new virtual environment and activate it

python3 -m venv venv-312
source venv-312/bin/activate.bash


Final installation
^^^^^^^^^^^^^^^^^^

From a terminal launch::

python setup.py install --record files.txt
pip install .

This will compile and install the project to the pyhton libraries (eg. ``/usr/local/lib/python3.5/site-packages/adnitc-0.9-py3.5.egg``). Furthermore it will install a script in ``/usr/local/bin/``:
* adnitc
This will compile and install the project to the pyhton libraries (eg. ``/usr/local/lib/python3.12/site-packages/seriesManagementSystem-1.3.1.dev13.dist-info``). Furthermore it will install a script in ``/usr/local/bin/``:
* missingtvshows

Upon the first start a copy of a pristine application and logging configuration are created in the user's home directory ``~/.AdNITC/``. From this point on configuration files are read from this location. It is however possible to overwrite them either by placing a file with the same name (but prefixed with a dot eg. ``.logging.conf``) in the current working directory.
Upon the first start a copy of a pristine application and logging configuration are created in the user's home directory ``~/.SeriesManagementSystem/``. From this point on configuration files are read from this location. It is however possible to overwrite them either by placing a file with the same name (but prefixed with a dot eg. ``.logging.conf``) in the current working directory.

Development installation
^^^^^^^^^^^^^^^^^^^^^^^^

from a terminal launch::

python setup.py develop --record files.txt
pip install -e .

does the same as before but, uses links instead of copying files.

Expand All @@ -52,137 +61,39 @@ Clean Working directory
To clean the working directory::

python setup.py clean --all
rm -rf build/ dist/ adnitc.egg-info/ files.txt




Known Problems
--------------

SSL Problems
^^^^^^^^^^^^^

Upon running the adnitc binary you might get the following exception::

ITC Password:
DEBUG - Using Python 2
DEBUG - Saving calendar to file /var/folders/j4/8bm7_nb54kl2m_9kl6k5gk880000gn/T/tmp6krkW7
INFO - Starting new HTTPS connection (1): example.com
INFO - Starting new HTTPS connection (1): example.com
Traceback (most recent call last):
File "/usr/local/bin/adnitc", line 9, in <module>
load_entry_point('adnitc==1.0.0', 'console_scripts', 'adnitc')()
File "/Volumes/Data/ruppena/Documents/Programming/Python/AdNITC/main/__init__.py", line 8, in main
main.getArguments(sys.argv[1:])
File "/Volumes/Data/ruppena/Documents/Programming/Python/AdNITC/main/mainImpl.py", line 58, in getArguments
self.main()
File "/Volumes/Data/ruppena/Documents/Programming/Python/AdNITC/main/main.py", line 48, in main
self.doWork()
File "/Volumes/Data/ruppena/Documents/Programming/Python/AdNITC/main/mainImpl.py", line 76, in doWork
events = c.fetchCalendarEvents()
File "/Volumes/Data/ruppena/Documents/Programming/Python/AdNITC/ITC/calendar2itc.py", line 33, in fetchCalendarEvents
response = requests.get(self.__calendarurl, auth=(self.__username, self.__password), stream=True, verify=False, proxies=self.__proxies)
File "/Library/Python/2.7/site-packages/requests/api.py", line 70, in get
return request('get', url, params=params, **kwargs)
File "/Library/Python/2.7/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/Library/Python/2.7/site-packages/requests/adapters.py", line 497, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590)

rm -rf build/ dist/

This simply means that some OpenSSL libraries are too old. Start by upgrading::

sudo -H pip install --upgrade pyOpenSSL
sudo -H pip install --upgrade ndg-httpsclient
Release Software
-----------------

if that is not enough also update the following::
Version numbers are derived from the git history with `setuptools_scm <https://github.com/pypa/setuptools-scm>`_: Likely `python -m setuptools_scm` prints the current version. It's a mix from the version of the last git tag plus the `dev` suffix with a number indicating the distance to the last git tag. If the command is called on a commit with a git tag then it just takes that tag.

sudo -H pip install --upgrade pyasn1
The releasing itself is done with `twine <https://twine.readthedocs.io/en/latest/index.html>`_

Proxy Problems
^^^^^^^^^^^^^^^
* Build the software: `python -m build` (if not using `tox`) for creating the packages
* Check if everything is ready for deplyoment: `python -m twine check dist/*`
* Upload artifacts: `python -m twine upload --repository pypitest --verbose dist/*`

Installation from sources may fail behind a proxy. Thus install the requirements by hand and specify the proxy::

sudo -H pip install --proxy=http://my.proxy.com:1234 -r requirements.txt


Uninstall
----------

Method 1 (pip)
Method 1 (pipx)
^^^^^^^^^^^^^^

If the package was installed with ``pip`` simply run::

pip uninstall adnitc

Method 2 (from sources)
^^^^^^^^^^^^^^^^^^^^^^^

If the packages was installed from sources::

cat files.txt |sudo xargs rm -rf

Method 3 (from sources)
^^^^^^^^^^^^^^^^^^^^^^^^^
If the package was installed with ``pipx`` simply run::

First find the installed package with pip and the uninstall it::
pipx uninstall seriesManagementSystem

✔ ~/Documents/Programming/Python/AdNITC [master|✚ 1]
19:02 $ pip3 freeze |grep adnitc
adnitc==1.1

✔ ~/Documents/Programming/Python/AdNITC [master|✚ 1]
19:02 $ pip3 uninstall adnitc
Uninstalling adnitc-1.1:
/usr/local/bin/adnitc
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/DESCRIPTION.rst
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/INSTALLER
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/METADATA
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/RECORD
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/WHEEL
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/entry_points.txt
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/metadata.json
/usr/local/lib/python3.5/site-packages/adnitc-1.1.dist-info/top_level.txt
/usr/local/lib/python3.5/site-packages/adnitc/__init__.py
/usr/local/lib/python3.5/site-packages/adnitc/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/etc/adnitc-completion.bash
/usr/local/lib/python3.5/site-packages/adnitc/etc/adnitc.conf
/usr/local/lib/python3.5/site-packages/adnitc/etc/logging.conf
/usr/local/lib/python3.5/site-packages/adnitc/itc/__init__.py
/usr/local/lib/python3.5/site-packages/adnitc/itc/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/itc/__pycache__/calendar2itc.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/itc/__pycache__/calendarEvent.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/itc/__pycache__/itcClient.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/itc/calendar2itc.py
/usr/local/lib/python3.5/site-packages/adnitc/itc/calendarEvent.py
/usr/local/lib/python3.5/site-packages/adnitc/itc/itcClient.py
/usr/local/lib/python3.5/site-packages/adnitc/main/__init__.py
/usr/local/lib/python3.5/site-packages/adnitc/main/__pycache__/__init__.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/main/__pycache__/main.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/main/__pycache__/mainImpl.cpython-35.pyc
/usr/local/lib/python3.5/site-packages/adnitc/main/main.py
/usr/local/lib/python3.5/site-packages/adnitc/main/mainImpl.py
Proceed (y/n)? y
Successfully uninstalled adnitc-1.1



To install the adnitc package, use::

python setup.py install
Method 2 (pip)
^^^^^^^^^^^^^^

If installation is successful, you will be able to import the iCalendar
package, like this::
If the package was installed with ``pip`` simply run::

>>> import icalendar
pip uninstall seriesManagementSystem


Building the documentation locally
Expand All @@ -192,11 +103,11 @@ To build the documentation follow these steps:

.. code-block:: bash
$ git clone http://ruppena@digsim.is-a-geek.com/rhode/AdNITC
$ cd adnitc
$ virtualenv-2.7 .
$ source bin/activate
$ pip install -r requirements_docs.txt --extra-index-url http://pypi.is-a-geek.com/simple --trusted-host pypi.is-a-geek.com
$ git clone https://github.com/digsim/seriesManagementSystem/
$ cd seriesManagementSystem
$ python3 -m venv venv-312
$ source venv-312/bin/activate.bash
$ pip install -r requirements_docs.txt
$ cd docs
$ make html
Expand All @@ -205,4 +116,4 @@ presentation-version use ``make presentation`` instead of ``make html``. You
can open the presentation at ``presentation/index.html``.


.. _`adnitc`: https://adnitc.gotdns.org/
.. _`sms`: https://www.andreas-ruppen.ch/
74 changes: 19 additions & 55 deletions docs/usage.rst
Original file line number Diff line number Diff line change
@@ -1,70 +1,34 @@
Usage
=================

Upon the first start a copy of a pristine application and logging configuration are created in the user's home directory ``~/.AdNITC/``. From this point on configuration files are read from this location. See see :ref:`configuration` section for more information.


This script downloads the specified calendars and parses all events in them. For each event, it will try to create a corresponding ITC entry. In order to do so, the calendar items need to be enhanced with some special information, targeted specially to the ITC system of AdNovum.

* The *Title* of an event automatically gets copied to the **comment** section of the corresponding ITC entry.
* The *Comment* of an event can be used as normally but should contain somewhere the following block::

################
itctag:UBS STMP.Wave_25:dev
ticket:STMPPLAT-16969
jira:true
zimbra:false
################
Installation
-------------

* not all information is mandatory:
From pipx
^^^^^^^^^^

* ``itctag`` is mandatory.
* ``ticket`` is optional, if not specified nothing will be written to the ticket field of the ITC system.
* ``jira`` is optional and defaults to false
* ``zimbra`` is optional and defaults to false
Simply run::

pipx install seriesManagementSystem


Uninstall
-----------

Via pip::

pips uninstall missingTVShows

* It does not matter how many ``#######`` you use, but you need to put at least 3 of them. Before and after this section you can put wathever text you want.


.. _configuration:

Configuration
--------------
Upon the first launch, the script creates the ``~/.AdNITC/`` directory containing:
* logging.conf where the logger is configured
* adnitc.conf where the general configuration is stored. Adapt at least the ``<calendars>``, ``<calendarurl>`` of the specified calendar, ``<itcurl>`` and ``<user>`` properties to get started. The script will interactively ask for passwords when the ``<user>`` tag is set for the *ITC* section or for a *Calendar* section.

The example below shows what such a file could look like::

[Config]
# Comma-separated list of calendars to parse for ITC events
calendars: cal1
# Shall we first try to do bulk updates (this is the preferred method)
usebulk: true
# Verify SSL certificates
verifyssl: true

[cal1]
# Replace XXX with your username
url: http://adnzimzh.zh.adnovum.ch:8080/home/XXX@zimbra.adnovum.ch/Calendar

[cal2]
# If a resource requires authentication (basic auth) you can specify
# the crendentials with user and pass.
# if you omit the password, then adnitc will ask for it interactively.
url: https://example.com/my_hard_work.ics
user: XXX
pass: ZZZ

[ITC]
# adnitc will aks for the password interactively.
url: https://aww.adnovum.ch/itc
user: XXX

The config file has 3 sections *Config* where general options sit, *cal1* contains url and credentials for the first calendar and *ITC* specifies url and credentials for the ITC system.

.. _debugging_and_logging:

Debugging and Logging
---------------------
As the script is run, this folder will also host a ``adnitc.log`` file, containing the log of the *last* run.

Upon the first launch, the script creates the ~/.seriesmgmtsystem/ directory containing:
* logging.yaml where the logger is configured
* seriesmgmtsystem.conf where the general configuration is stored.

0 comments on commit 1832f6a

Please sign in to comment.