Skip to content

Commit c86411e

Browse files
authored
Update readme and update config to onboarding config (CircleCI-Public#6)
* update readme with better sample config docs * more tidying * remove tox file
1 parent b9c408d commit c86411e

7 files changed

Lines changed: 47 additions & 44 deletions

File tree

.circleci/config.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,41 @@
11
version: 2.1
22

33
orbs:
4-
# The node orb contains a set of prepackaged circleci configuration you can use
5-
# Orbs commands and jobs help you with common scripting around a language/tool
4+
# The python orb contains a set of prepackaged circleci configuration you can use repeatedly in your configurations files
5+
# Orb commands and jobs help you with common scripting around a language/tool
66
# so you dont have to copy and paste it everywhere.
7+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
78
python: circleci/python@1.2
89

910
workflows:
10-
sample:
11+
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
12+
# Inside the workflow, you define the jobs you want to run.
13+
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
1114
jobs:
1215
- build-and-test
1316

17+
1418
jobs:
15-
build-and-test:
19+
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
20+
# These next lines defines a docker executors: https://circleci.com/docs/2.0/executor-types/
21+
# You can specify an image from dockerhub or use one of the convenience images from CircleCI's Developer Hub
22+
# A list of available CircleCI docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
23+
# The executor is the environment in which the steps below will be executed - below will use a python 3.9 container
24+
# Change the version below to your required version of python
1625
docker:
17-
# Be sure to change this to major.minor version of python you need to support.
18-
- image: cimg/python:3.9
19-
# Checkout the code as the first step.
26+
- image: cimg/python:3.8
27+
# Checkout the code as the first step. This is a dedicated CircleCI step.
2028
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
21-
# Here we're making sure we use just use the global env pip. By default it uses the project root's requirements.txt.
29+
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
2230
# Then run your tests!
2331
# CircleCI will report the results back to your VCS provider.
2432
steps:
2533
- checkout
2634
- python/install-packages:
2735
pkg-manager: pip
28-
# app-dir: ~/project/package-directory/ If you're requirements.txt isn't in the root directory.
29-
pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
36+
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
37+
# pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
3038
- run:
3139
name: Run tests
3240
# This assumes pytest is installed via the install-package step above
3341
command: pytest
34-

LICENSE

Whitespace-only changes.

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
# Sample Python App - Flask Server
22

3-
[![CircleCI Build Status](https://circleci.com/gh/dsayling/sample-flask.svg?style=shield)](https://circleci.com/gh/dsayling/sample-flask) [![Software License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/CircleCI-Public/cimg-python/master/LICENSE)
3+
TODO: links in this document will need updating after migration to another github organization.
4+
5+
[![CircleCI Build Status](https://circleci.com/gh/dsayling/sample-flask.svg?style=shield)](https://circleci.com/gh/dsayling/sample-flask) [![Software License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/dsayling/sample-flask/main/LICENSE)
46

57
## Description
68

7-
The sample app here is designed to demonstrate one of the most simple python CircleCI workflows. Here in this application we're simply installing dev python packages and then running tests with pytest.
9+
The sample app here is designed to demonstrate a simple python CircleCI workflows.
10+
11+
In this sample pipeline, we're simply installing dev python packages, with the [CircleCI python orb](https://circleci.com/developer/orbs/orb/circleci/python), and then running tests with pytest.
812

913
## Getting Started
1014

11-
You can see this CICD pipeline running live on CircleCI: https://app.circleci.com/pipelines/github/dsayling/sample-flask?branch=main
15+
You can see the CI pipeline for this application running [live on CircleCI](https://app.circleci.com/pipelines/github/dsayling/sample-flask?branch=main).
16+
17+
Here you can find the CircleCI configuration file, aka [config.yml](https://github.com/dsayling/sample-flask/blob/main/.circleci/config.yml).
1218

13-
TODO: Show config here
19+
## Adapting to your workflow
1420

15-
## Adapting your workflow
21+
If you would like to copy the [config.yml](https://github.com/dsayling/sample-flask/blob/main/.circleci/config.yml), be sure to follow the steps below to ensure the config.yml works for your project:
1622

17-
Something something about copying config file into your project
18-
Link to convience images for other versions.
19-
Set the expecations for the user copying the config and how they can use it.
23+
* Find the definition of the executor and ensure the correct version of python is used for your application via the convenience image tag on the [CircleCI Developer Hub](https://circleci.com/developer/images/image/cimg/python).
24+
* Find the `install-packages` command in the configuration file, here you can define an alternative `requirements.txt` file, if necessary.
25+
* The `install-packages` command will effective run `pip install requirements.txt` as a part of your config, while automatically caching those dependencies for faster CI runs later.
26+
* Find the `Run Tests` step and include any additional runtime arguments necessary for `pytest` or update it to the testing tool you're using, e.g. `nosetests`.
2027

2128
## Build and Test Locally
2229

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

2532
### Requirements
2633

27-
Python 3.5.2+
34+
Python 3.5.2+ OR Docker
2835

2936
### Running with Docker
3037

@@ -49,11 +56,11 @@ python3 -m openapi_server
4956

5057
### Tests
5158

52-
To launch the integration tests, use tox:
59+
To launch the integration tests, use pytest:
5360

5461
```
55-
sudo pip install tox
56-
tox
62+
pip3 install -r test-requirements.txt
63+
pytest
5764
```
5865

5966
## Additional Resources

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
connexion[swagger-ui] >= 2.6.0; python_version>="3.6"
2-
flask-cors >= 3.0
3-
swagger-ui-bundle >= 0.0.2
4-
python_dateutil >= 2.6.0
5-
setuptools >= 21.0.0
1+
-r run-requirements.txt
2+
pytest~=4.6.7 # needed for python 2.7+3.4
3+
pytest-cov>=2.8.1
4+
pytest-randomly==1.2.3 # needed for python 2.7+3.4
5+
Flask-Testing==0.8.0

run-requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
connexion[swagger-ui] >= 2.6.0; python_version>="3.6"
2+
flask-cors >= 3.0
3+
swagger-ui-bundle >= 0.0.2
4+
python_dateutil >= 2.6.0
5+
setuptools >= 21.0.0

test-requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

tox.ini

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)