Run project locally
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
Python 3 installed on your machine and pipenv.
If you do not have Python installed on your machine you can follow this guide
You can install
pipenv
using the following commandpip install pipenv
.
Installation
This guide is for Mac OSX, Linux, or Windows.
Get the source code from the GitHub repository
Create a virtual environment using pipenv and install dependencies:
Run tool locally
Now you should be ready to run the tool locally.
pipenv run python main.py
Visit http://localhost:8080 in your browser to check it out. Note that whenever you want to run the tool, you have to activate the virtualenv first.
Adding new dependencies
Pipfiles contain information about the dependencies of your project, and supersede the requirements.txt file that is typically used in Python projects.
To install a Python package for your project use the install
keyword. For example,
pipenv install beautifulsoup4
The package name, together with its version and a list of its own dependencies, can be frozen by updating the Pipfile.lock. This is done using the lock keyword,
pipenv lock
Managing your development environment
There are usually some Python packages that are only required in your development environment and not in your production environment, such as unit testing packages. Pipenv will let you keep the two environments separate using the --dev flag. For example,
pipenv install --dev nose2
Testing
This project runs both Python unit tests, and Cypress end-to-end tests in CI.
To run Python tests locally:
If you haven't already, install Python dev dependencies.
Then:
pipenv run python -m pytest
To run Cypress locally:
If you haven't already, start the Clima application and confirm that http://localhost:8080/ is up.
Then:
cd tests/node; npm install; npm run cy:open
Versioning
When you release a new version of the tool you should first use bumpversion
to update the version of the tool. You can use the following command:
If the above command do not work even if you have committed all the files try with bumpversion patch --allow-dirty
Secondly, you should describe the changes in CHANGELOG.md
Deploy to Google Cloud Run
You need to have gcloud installed on your computer. A short guide on how to deploy on Google Cloud Run can be found here.
First make sure you that:
gcloud is up-to-date
that you are logged in with the right account
you have updated the Pipfile.lock.
Test project
Test project
Last updated