Giter VIP home page Giter VIP logo

sample-python-cfd's Introduction

Sample Python App - Flask Server

CircleCI Build Status Software License

Description

The sample python flask app here is designed to demonstrate what a typical python CI workflow may look on CircleCI.

You can see the CI pipelines for this application running live on CircleCI.

In this sample config, we have a single workflow build-and-test which will install and cache our required python packages, and then run tests with pytest, a common python testing framework. This config makes use of the Python orb, a package for CircleCI's config language, which makes writing our config shorter, and easier.

Getting Started

If you would like to copy the config.yml and adapt it to your project, be sure to read the comments in the config file to ensure it works for your project. For more details, see the CircleCI configuration reference.

Addtional Sample Configuration Files

Inside the .circleci directory, you will find an extended directory that extends the configuration beyond the default .circleci/config.yml. These configuration files are tested with every pull request to this sample app, so they stay up to date and verified working.

Heroku Deploy

The .circleci/extended/heroku-deploy.yml configuration file extends the default config by adding a job to deploy to heroku via a git push. For more information on how to configure this for your own project, visit the CircleCI docs for more details

Pylint

The .circleci/extended/pylint.yml configuration file extends the default config by adding a step to sample job. The .pylintrc in the project directory is configured to fail the pipeline if any errors are present when linting.

About This App

This sample application is a flask REST server written in python, and utilizes the connexion framework which allows us build and run the service from an OpenAPI/Swagger specification.

Continuous Food Delivery

When you start up the service, you can open this page in your browser to view the available API endpoints.

Swagger UI Screenshot

Front-End

CFD(Continuous Food Delivery) is a sample application that relies on a separate UI framework. If you would like to run this project locally with a complete UI, you can use a valid CFD front-end, such as one of the following sample projects:

Language GitHub Description
Javascript (Vue.js) Link A Javascript Front-End for CFD

Run and Test Locally

If you would like to try this application out locally, you can find runtime instructions below.

Requirements

Python 3.5.2+ OR Docker

Run Local Server

To run the server on a Docker container, please execute the following from the root directory:

docker-compose up --build

If not using docker, to run the server, please execute the following from the root directory:

pip3 install -r run-requirements.txt
python3 -m openapi_server

Tests

To launch the unit tests, use pytest:

pip3 install -r requirements.txt
pytest

If you want to run tests using a live database, use the alternative compose file:

docker-compose -f docker-compose-test.yml up --build --exit-code-from web

Additional Resources

License

This repository is licensed under the MIT license. The license can be found here.

sample-python-cfd's People

Contributors

dsayling avatar jalexchen avatar pauljwright avatar sashavolodin-circleci 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.