Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

communitiesuk/funding-service-design-fund-discovery-frontend

Repository files navigation

funding-service-design-fund-discovery

made-with-python Code style : black

Repo for the funding service design fund discovery.

Built with Flask.

Prerequisites

  • python ^= 3.10

Getting started

Installation

Clone the repository

Create a Virtual environment

python3 -m venv .venv

Enter the virtual environment

...either macOS using bash:

source .venv/bin/activate

...or if on Windows using Command Prompt:

.venv\Scripts\activate.bat

Install dependencies

From the top-level directory enter the command to install pip and the dependencies of the project

python3 -m pip install --upgrade pip && pip install -r requirements-dev.txt

NOTE: requirements-dev.txt and requirements.txt are updated using pip-tools pip-compile To update requirements please manually add the dependencies in the .in files (not the requirements.txt files) Then run:

pip-compile requirements.in

pip-compile requirements-dev.in

Build GovUK Assets

This build step imports assets required for the GovUK template and styling components. It also builds customised swagger files which slightly clean the layout provided by the vanilla SwaggerUI 3.52.0 (which is included in dependency swagger-ui-bundle==0.0.9) are located at /swagger/custom/3_52_0.

Before first usage, the vanilla bundle needs to be imported and overwritten with the modified files. To do this run:

python3 build.py

Developer note: If you receive a certification error when running the above command on macOS, consider if you need to run the Python 'Install Certificates.command' which is a file located in your globally installed Python directory. For more info see StackOverflow

How to use

Enter the virtual environment as described above, then:

flask run

Run with Gunicorn

In deployed environments the service is run with gunicorn. You can run the service locally with gunicorn to test

First set the FLASK_ENV environment you wish to test eg:

export FLASK_ENV=dev

Then run gunicorn using the following command:

gunicorn wsgi:app -c run/gunicorn/local.py

Pipelines

Place brief descriptions of Pipelines here

  • Deploy to Gov PaaS - This is a simple pipeline to demonstrate capabilities. Builds, tests and deploys a simple python application to the PaaS for evaluation in Dev and Test Only.

Testing

Unit & Accessibility Testing

To run all tests including aXe accessibility tests (using Chrome driver for Selenium) in a development environment run:

...on macOS

pytest --driver Chrome --driver-path .venv/lib/python3.10/site-packages/chromedriver_py/chromedriver_mac64

...on linux64

pytest --driver Chrome --driver-path .venv/lib/python3.10/site-packages/chromedriver_py/chromedriver_linux64

...on win32

pytest --driver Chrome --driver-path .venv/lib/python3.10/site-packages/chromedriver_py/chromedriver_win32.exe

The aXe reports are printed at /axe_reports

Linting

This repo comes with a .pre-commit-config.yaml, if you wish to use this do the following while in your virtual enviroment:

pre-commit install

Once the above is done you will have autoformatting and pep8 compliance built into your workflow. You will be notified of any pep8 errors during commits.

About

funding-service-design-fund-discovery-frontend

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published