Skip to content

Commit ca149df

Browse files
committed
Initial commit
0 parents  commit ca149df

10 files changed

+983
-0
lines changed

.circleci/config.yml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
version: 2.1
2+
3+
orbs:
4+
5+
jobs:
6+
install:
7+
working_directory: ~/project-name
8+
docker:
9+
- image: circleci/python:3.9.7
10+
steps:
11+
- checkout
12+
# Download and cache dependencies
13+
- restore_cache:
14+
keys:
15+
- project-name-poetry-1.1.10-{{ checksum "poetry.lock" }}
16+
- run:
17+
name: Update Poetry to version 1.1.10
18+
command: |
19+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - --version 1.1.10
20+
- run:
21+
name: Install dependencies
22+
command: |
23+
source /home/circleci/.poetry/env
24+
poetry run pip install --upgrade pip
25+
poetry install
26+
- save_cache:
27+
key: project-name-poetry-1.1.10-{{ checksum "poetry.lock" }}
28+
paths:
29+
- /home/circleci/.cache/pypoetry/virtualenvs
30+
- /home/circleci/.poetry/env
31+
32+
test:
33+
working_directory: ~/project-name
34+
docker:
35+
- image: circleci/python:3.9.7
36+
steps:
37+
- checkout
38+
- restore_cache:
39+
key: project-name-poetry-1.1.10-{{ checksum "poetry.lock" }}
40+
- run:
41+
name: run pytest
42+
command: |
43+
source /home/circleci/.poetry/env
44+
make test
45+
- store_test_results:
46+
path: tests-results.xml
47+
- store_artifacts:
48+
path: htmlcov
49+
50+
black:
51+
working_directory: ~/project-name
52+
docker:
53+
- image: circleci/python:3.9.7
54+
steps:
55+
- checkout
56+
- restore_cache:
57+
key: project-name-poetry-1.1.10-{{ checksum "poetry.lock" }}
58+
- run:
59+
name: run black
60+
command: |
61+
source /home/circleci/.poetry/env
62+
make black
63+
64+
lint:
65+
working_directory: ~/project-name
66+
docker:
67+
- image: circleci/python:3.9.7
68+
steps:
69+
- checkout
70+
- restore_cache:
71+
key: project-name-poetry-1.1.10-{{ checksum "poetry.lock" }}
72+
- run:
73+
name: run pylint
74+
command: |
75+
source /home/circleci/.poetry/env
76+
make lint
77+
78+
isort:
79+
working_directory: ~/project-name
80+
docker:
81+
- image: circleci/python:3.9.7
82+
steps:
83+
- checkout
84+
- restore_cache:
85+
key: project-name-poetry-1.1.10-{{ checksum "poetry.lock" }}
86+
- run:
87+
name: run isort
88+
command: |
89+
source /home/circleci/.poetry/env
90+
make isort
91+
92+
93+
workflows:
94+
version: 2
95+
project-name:
96+
jobs:
97+
- install
98+
- test:
99+
requires:
100+
- install
101+
- lint:
102+
requires:
103+
- install
104+
- black:
105+
requires:
106+
- install
107+
- isort:
108+
requires:
109+
- install

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
# unit tests / coverage reports
6+
/tests-results.xml
7+
/.coverage
8+
/coverage.xml
9+
/htmlcov/
10+
11+
# pyenv
12+
/.python-version
13+
14+
# IDE
15+
.idea/
16+
.vscode/
17+
18+
# macOS
19+
.DS_Store

.pre-commit-config.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-json
9+
- repo: local
10+
hooks:
11+
- id: black
12+
name: Formatting (black)
13+
entry: poetry run black
14+
language: system
15+
types: [python]
16+
stages: [commit]
17+
- id: lint
18+
name: Linter (pylint)
19+
entry: poetry run pylint
20+
language: system
21+
types: [python]
22+
stages: [commit]
23+
- id: isort
24+
name: Ordering imports (isort)
25+
entry: poetry run isort
26+
language: system
27+
types: [python]
28+
stages: [commit]
29+
- id: test
30+
name: Unit tests (pytest)
31+
entry: make test
32+
pass_filenames: false
33+
language: system
34+
types: [python]
35+
stages: [push]

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
test:
2+
poetry run pytest tests --cov src --cov-report=html --junit-xml=tests-results.xml
3+
4+
black:
5+
poetry run black . --check
6+
7+
lint:
8+
poetry run pylint src tests
9+
10+
isort:
11+
poetry run isort . --check

README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# {project-name}
2+
3+
{project-description}
4+
5+
## Installation
6+
7+
To install this project, you need `Python 3.9.7`.
8+
The recommended way to install it is using [pyenv](https://github.com/pyenv/pyenv).
9+
10+
### Install poetry
11+
12+
```bash
13+
python -m pip install --upgrade pip
14+
pip install poetry==1.1.10
15+
```
16+
17+
### Install requirements through poetry
18+
19+
```bash
20+
poetry install --no-root
21+
```
22+
23+
### Install git hooks (running before commit and push commands)
24+
25+
```bash
26+
poetry run pre-commit install -t pre-commit
27+
poetry run pre-commit install -t pre-push
28+
```
29+
30+
## Testing
31+
32+
To run unit tests, run `pytest` with:
33+
```bash
34+
poetry run pytest tests --cov src
35+
```
36+
or
37+
```bash
38+
make test
39+
```
40+
41+
## Formatting and static analysis
42+
43+
### Code formatting with `black`
44+
45+
To check code formatting, run `black` with:
46+
```bash
47+
poetry run black . --check
48+
```
49+
or
50+
```bash
51+
make black
52+
```
53+
54+
You can also [integrate it to your IDE](https://black.readthedocs.io/en/stable/integrations/editors.html) to reformat
55+
your code each time you save a file.
56+
57+
### Static analysis
58+
59+
To run static analysis, run `pylint` with:
60+
```bash
61+
poetry run pylint src tests
62+
```
63+
or
64+
```bash
65+
make lint
66+
```
67+
68+
### Imports ordering
69+
70+
To check imports ordering, run `isort` with:
71+
```bash
72+
poetry run isort . --check
73+
```
74+
or
75+
```bash
76+
make isort
77+
```

0 commit comments

Comments
 (0)