Metadata-Version: 2.1
Name: ktumon
Version: 1.0.1
Summary: App to monitor notifications published by KTU
Author-email: Anantha Narayanan N <ananthanryn@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2022 Anantha Narayanan N
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
        
Project-URL: Source, https://github.com/ananthanryn/ktu-mon
Keywords: ktu,ktumon,kerala
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: Microsoft :: Windows
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: End Users/Desktop
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE


# KTU Mon

## Introduction

KTU Mon is an application that was developed as a desperate attempt at trying to get myself up to date with the recent notifications published by KTU.  

Once upon a time I missed registering for few backlog exams because I put way too much trust in the elected UUC's of my college. I had hoped they would continue providing updates through their Instagram page, only to realize one day that they've deleted the whole damn account and I had missed my backlog exams.  
Those UUC's were useless to say the least (ആരംഭ ശൂരത്വം മാത്രം).  

Although I have dropped out from this University and no longer need the app, I have decided to add useless enhacements and publish this application as a package so that other students out there studying in KTU might find it useful.  

Since this is Open Source code, you can try to understand the engineering behind this over-engineered webscraper and please feel free to post bugs, issue fixes, contribute improvements etc.  

Thanks,  
Anantha

## Installation & Usage

> The recommended way to install is through pipX  

1. Get pipX from pip

    ```
    python -m pip install --user pipx
    ```

2. Make sure that pipX is on PATH by going to it's installed folder ```C:\Users\{USER_NAME}\AppData\Roaming\Python\Python3x\Scripts``` and executing

    ```
    pipx ensurepath
    ```

3. Restart the terminal and run pipX by typing ```pipx```

4. If that didn't work, then manually add the ```pipx.exe``` file in the location ```C:\Users\{USER_NAME}\AppData\Roaming\Python\Python3x\Scripts``` to PATH

5. After that you can install KTU Mon by typing the following into the terminal

    ```
    pipx install ktumon
    ```

6. After installing, you can run it by typing ```ktumon``` in the terminal.  
    > It is recommended that you do not run it immediately. Instead set it up to make it run during startup and restart the system.

7. But inorder for the application to run at startup you'll need to add the executable ```ktumon.exe``` from the location ```C:\Users\{USER_NAME}\AppData\Roaming\Python\Python3x\Scripts``` to the Startup folder.

8. Press Windows logo key + R to open the Run prompt and type ```shell:startup``` this will open up the Startup folder. Paste in the shortcut of the ```ktumon.exe``` executable in there.

9. Now restart the system.  
The first run would take some time to set up the local database and fetch the latest data from KTU, so please be patient. You'll be getting a desktop notification once the application has finished setting up.

## Technical Stuff

The application runs as a system tray icon making use of Pystray. We use a local sqlite database for our database related stuff.

We spawn new threads to run the timer that checks for notifications at set intervals.

The application's Web GUI runs on Uvicorn ASGI Web Server with FastAPI as Web Framework using the Jinja2 Templating Engine and the frontend is completely made using Bootstrap CSS Framework.

The Pystray Process is used to spawn a new Process for running Uvicorn on demand. The spawned Uvicorn Process automatically opens up the default browser to show the Web GUI.

We use a WebSocket connection with the frontend to the backend to determine whether or not to terminate the spawned Uvicorn Process.

The spawned Uvicorn Process is terminated as soon as the User closes the Web GUI tab or the whole Browser itself.

## Development & Contribution

In order to develop and contribute, fork this project and clone it to your local machine.  
We use Visual Studio Code for development and recommend you to use it as well.

You should have Python 3.11 or above.  
We recommennd working with a virtual environment to isolate the packages.

You can install ```virtualenv``` for that purpose

```
pipx install virtualenv
```

Then within the cloned repository run the following command to create a virtual environment

```
virtualenv venv
```

After which change the interpreter within Visual Studio Code to point to the Python Interpreter contained within the created virtual environment.

Now create a new terminal in Visual Studio Code and you'll see that the virtual environement is activated.  

>You can see ```(venv)``` in the shell prompt of the terminal.

After which type in the following command to install an editable module of the project you are working on

```
pip install -e .[dev]
```

After making any changes to the code you can always run it whenever by executing ```ktumon```  

Whenever you are modifying the code, most of the time you won't have to rebuild and reinstall the editable module and that is the advantage of this approach.

Now you're all set!

The following command is used to build the distribution packages

```
python -m build
```
