Basic Development Environment #
Create a mySQL database, either locally or on a remote server.
Fork and clone gitlab.com/hECT-Software/rianu.
.envfile in the
backend/directory with the login to your mysql database. It should look something like:
Start the backend in one terminal window.
cd backend/ pipenv shell pipenv sync --dev uvicorn main:app --reload
Start the frontend in a different terminal window.
Comment line 46-49 of
npm ci npm run dev
Access the user interface via
http://localhost:8080/. Changes you make to the code should be automatically updated, no need to rebuild every time.
Making Database Changes #
To manage database versioning we use alembic after making changes to the database schema in models.py from your python environment run:
alembic revision --autogenerate -m "<commit message>"
This with automatically generate code to upgrade and downgrade the database to and from that point.
Then to upgrade the database to reflect the changes run:
alembic upgrade head
View revsions to the database by running:
Committing Changes #
Python Pre Commit Checks #
Before committing it is recommended to run Black and Pylint, this keeps code in format consistent and of high quality. To do this from your python environment fun:
Black will auto automatically reformat the python code according to blacks format rules.
pylint $(git ls-files '*.py')
Pylint will show warnings in the console, this doesn’t have to be perfect, but try to ensure its at least a 7/10.
Svelte Pre commit checks #
Note: There are a lot of linting errors in svelte at the moment so don’t worry about running this too much, till we make some progress getting it up to speed.
npm run lint:fix
Note: Remember to exclude the changed comments in rollup.config.js on line 46
git commit -m "<commit message>"