Skip to content

Commit

Permalink
Merge pull request #4 from dnorhoj/rewrite
Browse files Browse the repository at this point in the history
Version 0.2.0
  • Loading branch information
dnorhoj authored Sep 29, 2022
2 parents 5190110 + 91c2a69 commit 12e3220
Show file tree
Hide file tree
Showing 18 changed files with 1,002 additions and 375 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and deploy to PyPi

on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"python.pythonPath": "C:\\Users\\dnorh\\AppData\\Local\\Programs\\Python\\Python39\\python.exe",
"restructuredtext.confPath": "${workspaceFolder}\\docs",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--ignore=E501"
]
],
"esbonio.sphinx.confDir": "${workspaceFolder}/docs"
}
286 changes: 130 additions & 156 deletions Pipfile.lock

Large diffs are not rendered by default.

38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# lectio.py

![](https://img.shields.io/github/license/dnorhoj/lectio.py)

[![License](https://img.shields.io/github/license/dnorhoj/lectio.py)](LICENSE)
[![Documentation Status](https://readthedocs.org/projects/lectiopy/badge/?version=latest)](https://lectiopy.readthedocs.io/en/latest/?badge=latest)
[![PyPi version](https://img.shields.io/pypi/v/lectio.py.svg)](https://pypi.org/project/lectio.py/)
[![PyPi supported python versions](https://img.shields.io/pypi/pyversions/lectio.py.svg)](https://python.org/)

*Please note: This library is nowhere close to done.*

Expand All @@ -14,13 +16,37 @@ You can read the documentation

## How do i use this?

To use this repository feel free to check the documentation [here](https://lectiopy.rtfd.io/).
You can install this library via `pip`:

pip install lectio.py

For a quickstart guide as well as some examples, you can read the documentation [here](https://lectiopy.rtfd.io/).

## Progress

<details>
<summary>Implementation progress</summary>

* [x] Schedule
* [x] User info
* [ ] Absence
* [ ] Mail
* [ ] Assignments
* [ ] Homework
* [ ] Surveys (Probably not going to be implemented)
* [ ] Grades
* [ ] Search for students / teachers

</details>

## Todo

* [ ] Finish authentication check
* [ ] Make a better README
* [ ] Start doing the hard part (basically everything)
* [ ] Quickstart, Examples, etc.

## Known bugs

* Not made to work with teacher accounts (as i have no way of testing anything)

## Contributing

Expand All @@ -30,4 +56,4 @@ If you notice something that isn't working as intended you can start an issue.

## License

This repository uses the `GNU Lesser General Public License v3.0` you can read more about it in [LICENSE](LICENSE).
This repository uses the `GNU Lesser General Public License v3.0` you can read more about it in [LICENSE](LICENSE).
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# -- Project information -----------------------------------------------------

project = 'lectio.py'
copyright = '2020, dnorhoj'
copyright = '2022, dnorhoj'
author = 'dnorhoj'

# The full version, including alpha/beta/rc tags
release = '0.0.1'
release = '0.2.0'


# -- General configuration ---------------------------------------------------
Expand Down
25 changes: 23 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
Welcome to lectio.py's documentation!
Welcome to lectio.py
=======================================

Lectio.py is a Python library for reading and interacting with lectio.dk,
a Danish school management system.

.. note::
This library is not affiliated with lectio.dk or macom in any way.
Nor is it endorsed by them. It scrapes the website as there is no
official API.

**Features:**

- Pythonic API
- Easy to use

Information
-----------

**Useful links:** :doc:`/installation` | :doc:`/quickstart`
**Reference:** :doc:`/reference` | :doc:`/exceptions`

Table of contents
-----------------

.. toctree::
:maxdepth: 2
:caption: Contents:

installation
quickstart
Expand Down
18 changes: 17 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
Installation
============

TODO
To install lectio.py and its dependencies, you can simply install it from PyPi::

pip install lectio.py

or clone the repository and install it manually::

git clone https://github.com/dnorhoj/Lectio.py.git
cd lectio.py
python setup.py install

You can check if the installation was successful by running::

python

>>> import lectio
>>> lectio.__version__

29 changes: 28 additions & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
Quickstart
==========

TODO
Let's start with a simple example, where we will get your schedule for today.

Schedule
--------

Create a new file, and add the following code:

.. code-block:: python
from lectio import Lectio
from datetime import datetime, timedelta
lec = Lectio('<username>', '<password>')
# Get my user object
me = lec.me()
# Get the schedule for today
schedule = me.get_schedule(datetime.now(), datetime.now() + timedelta(days=1))
We now have a list of all :class:`lectio.helpers.Module` in the ``schedule`` variable. Let's print it:

.. code-block:: python
for module in schedule:
print(module.title, module.teacher, module.room)
**More to come...!**
49 changes: 48 additions & 1 deletion docs/reference.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,53 @@
.. currentmodule:: lectio

API Reference
=============

.. automodule:: lectio.lectio
Lectio
------

.. autoclass:: Lectio
:members:
:undoc-members:


School
------

.. autoclass:: lectio.models.school.School
:members:
:undoc-members:

User
----

User
^^^^

.. autoclass:: lectio.models.user.User
:members:
:undoc-members:

Me
^^^

.. autoclass:: lectio.models.user.Me
:members:
:undoc-members:

User types
^^^^^^^^^^

.. autoclass:: lectio.models.user.UserType
:members:
:undoc-members:

Misc
----

Module
^^^^^^

.. autoclass:: lectio.helpers.schedule.Module
:members:
:undoc-members:
9 changes: 6 additions & 3 deletions lectio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# flake8: noqa
from .lectio import Lectio, Module
from . import lectio
from . import exceptions
from .lectio import Lectio
from .helpers.schedule import Module
from .exceptions import *
from .models.user import User, UserType
from .models.school import School
from .models import *
11 changes: 11 additions & 0 deletions lectio/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""Here are all the custom Lectio.py exceptions as well as their explanation"""


class LectioError(Exception):
"""Base lectio.py exception"""

Expand All @@ -8,3 +11,11 @@ class UnauthenticatedError(LectioError):

class IncorrectCredentialsError(LectioError):
"""Incorrect credentials error, mostly thrown in auto-login on session expired"""


class InstitutionDoesNotExistError(LectioError):
"""The institution with the id you provided does not exist."""


class UserDoesNotExistError(LectioError):
"""The user does not exist."""
2 changes: 2 additions & 0 deletions lectio/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# flake8: noqa
from .schedule import *
Loading

0 comments on commit 12e3220

Please sign in to comment.