Giter VIP home page Giter VIP logo

co7095-cw's Introduction

CO7095-CW

This repository holds the code for CO7095 Course Work, University of Leicester, 2022-2023.

Disclaimer

This repository is listed under open source license GPL V3.0. The content is provided "as is", without any warranty, including the normally implied warranty for merchantability.

Usage

Set up Python environment

The first step is to set up a Python environment. The recommended Python version is 3.10. Please also ensure that Python executible and its libraries are in PATH. Most distribution has Python in their package manager, try refering to Python documents on how to set up on your system.

Run the following command to install dependencies:

sudo pip install -r <path/to/>requirements.txt

Then, the python source code should also be in the python findable paths. This project is archived for easily finding the corresponding code, so the importing path in source code is not correctly set up. This can either be achieved by setting your IDE to find then (depending on the IDE of choice), or to simply put all files into the same folder.

Set up a MySQL database

Please refer to the documents of your preferred database system/engine/etc. on how to set up a MySQL Database. The database has to be compatible with latest standard, and have to be accessible from the environment where backend is going to be. The database this application is developed for is MySQL CE 8.0.

After properly setting up a database, import the .sql database backup.

Please also ensure that you have an account in MySQL that can access (all priviledges on this schema) the imported database, and that you can use it from your place of running the backend. MySQL account by default disables remote login, so you might need to re-enable it.

Set up the Flask backend

The backend is written in python with Flask. The Python version this application is developed on is Python 3.10. Pypi is recommended for dependency set up.

Before running the backend, ensure the following packages are properly installed (already in requirements.txt):

Flask
mysql-connector-python

Modify the beginning of the flask_app.py to use your MySQL instance with your username and password. Then the backend can be run with:

python <path/to/>flask_app.py

Afterwards please check the firewall to make sure the corresponding process can access the port, usually 5000.

Run the calendar application

First make sure all the source file of the application is located under a findable path for python. The following packages need to be installed (also included in requirements.txt):

textual
textual-dev

Modify the URL in backend_functions.py to point to your running Flask instance. Then, use a modern, fully interactive terminal (like powershell on Windows, xfce/gnome terminal on linux, even tools like PuTTY and Termius, NOT an output only terminal), run:

python <path/to>/calendar_app.py

Testing

The testing sources are developed for pytest 7.2.0, with asyncio, raise and coverage plugin set up. DO NOT use alt-asyncio unless time out has been properly set up.

pytest should be able to recognise the test files, and run the functions automatically. To run with coverage check, install coverage with pip then execute:

coverage run -m pytest

with your choice of parameters. By default, this command runs all tests in the tests folder. Note that this also requires the source code to be locateable, so another easy solution is to copy them into the tests folder, or to set up the Python environment correctly. To view coverage report, run:

coverage report

This will show the content of .coverage report generated in the last coverage run. To run each test file individually and see their test coverage, run:

coverage run -m pytest <path/to>test_<something>.py
coverage report

Note that the built-in tester, like the one in PyCharm, are not based on coverage and may give wrong coverage information based on your execution method. coverage focuses only on effective statements, while the built-in ones may consider things irrelevent like blank lines, etc. It's recommended to only use coverage for this project.

co7095-cw's People

Contributors

firefox2100 avatar bloodysakura666 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.