Simple project with backend and client side where you can menage athletes and gym exercises in different categories.
- Database:
SqlLite
- Testing:
PyTest
- Data modifications:
Pandas
- Documentation generating:
Sphinx
db.py
and bo.py
are important things in project,
in first one there are all queries to database and in second one there are all handlers for db queries functions with additional functionality.
Example db/bo:
db
def get_all_from_table(conn: Connection, table_name: str) -> list:
"""
Get all data from a table.
:param conn: The database connection.
:type conn: Connection
:param table_name: The name of the table.
:type table_name: str
:return: A list containing all the data from the table.
:rtype: list
"""
query = f'SELECT * FROM {table_name}' # <--- Query to execute
result = conn.execute(query) # <--- Result from executed query
return result.fetchall()
bo
def get_all_from_table(conn: Connection, table_name: str) -> list:
"""
Get all data from the table.
:param conn: The database connection.
:type conn: Connection
:param table_name: The name of the table.
:type table_name: str
:return: A list containing all the data from the table.
:rtype: list
"""
return db.get_all_from_table(conn, table_name)
python3 -m venv env
and activate virtual environment
source ./env/bin/activate
pip install -r requirements.txt
python app/main.py
In project there are two sqlite databases: sportAppDatabase
and sportAppDatabaseTest
You can run test with command:
pytest
or
pytest -v
Each important function has full description with examples and parameters types etc. You can generate sphinx documentation with command:
sphinx-build -b html . build
After that you should see documentation as html page in build
directory.
Only what you must to do is open index.html in browser.