Skip to content

Commit 1ced0aa

Browse files
authored
Merge pull request #5 from python-discord/update-ci
Update packaging and CI config for CJ9
2 parents bb83538 + c49d624 commit 1ced0aa

File tree

7 files changed

+32
-51
lines changed

7 files changed

+32
-51
lines changed

.github/workflows/lint.yaml

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
name: Lint
44

5-
# Trigger the workflow on both push (to the main repository)
6-
# and pull requests (against the main repository, but from any repo).
7-
on: [push, pull_request]
5+
# Trigger the workflow on both push (to the main repository, on the main branch)
6+
# and pull requests (against the main repository, but from any repo, from any branch).
7+
on:
8+
push:
9+
branches:
10+
- main
11+
pull_request:
812
# Brand new concurrency setting! This ensures that not more than one run can be triggered for the same commit.
913
# It is useful for pull requests coming from the main repository since both triggers will match.
1014
concurrency: lint-${{ github.sha }}
@@ -14,22 +18,19 @@ jobs:
1418
runs-on: ubuntu-latest
1519

1620
env:
17-
# Set an environment variable to select pip's cache directory for us to actually cache between runs.
18-
PIP_CACHE_DIR: /tmp/pip-cache-dir
1921
# The Python version your project uses. Feel free to change this if required.
20-
PYTHON_VERSION: 3.9
22+
PYTHON_VERSION: "3.10"
2123

2224
steps:
2325
# Checks out the repository in the current folder.
2426
- name: Checks out repository
25-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2628

2729
# Set up the right version of Python
2830
- name: Set up Python ${{ env.PYTHON_VERSION }}
29-
id: python
30-
uses: actions/setup-python@v2
31+
uses: actions/setup-python@v3
3132
with:
3233
python-version: ${{ env.PYTHON_VERSION }}
3334

34-
- name: Run pre-commit hooks.
35-
uses: pre-commit/action@v2.0.3
35+
- name: Run pre-commit hooks
36+
uses: pre-commit/action@v3.0.0

.pre-commit-config.yaml

+4-7
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ repos:
1818
hooks:
1919
- id: python-check-blanket-noqa
2020

21-
- repo: https://github.com/pre-commit/mirrors-isort
22-
rev: v5.9.2
21+
- repo: https://github.com/PyCQA/isort
22+
rev: 5.10.1
2323
hooks:
2424
- id: isort
2525

2626
- repo: https://github.com/pycqa/flake8
27-
rev: 3.9.2
27+
rev: 4.0.1
2828
hooks:
2929
- id: flake8
3030
additional_dependencies:
31-
- flake8-annotations~=2.0
32-
- flake8-bandit~=2.1
33-
- flake8-docstrings~=1.5
34-
- flake8-isort~=4.0
31+
- flake8-docstrings~=1.6.0

README.md

-6
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ Our first and probably most important tool is flake8. It will run a set of plugi
2828
Here is a sample output:
2929
```
3030
~> flake8
31-
./app.py:1:1: D100 Missing docstring in public module
3231
./app.py:1:6: N802 function name 'helloWorld' should be lowercase
3332
./app.py:1:16: E201 whitespace after '('
34-
./app.py:1:17: ANN001 Missing type annotation for function argument 'name'
35-
./app.py:1:23: ANN201 Missing return type annotation for public function
3633
./app.py:2:1: D400 First line should end with a period
3734
./app.py:2:1: D403 First word of the first line should be properly capitalized
3835
./app.py:3:19: E225 missing whitespace around operator
@@ -53,10 +50,7 @@ It is run by calling `flake8` in the project root.
5350

5451
#### Plugin List:
5552

56-
- `flake8-annotations`: Checks your code for the presence of [type-hints](https://docs.python.org/3/library/typing.html).
57-
- `flake8-bandit`: Checks for common security breaches.
5853
- `flake8-docstring`: Checks that you properly documented your code.
59-
- `flake8-isort`: Makes sure you ran ISort on the project.
6054

6155
### ISort: automatic import sorting
6256

dev-requirements.txt

+4-7
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
# This list will have to be migrated if you wish to use another dependency manager.
44

55
# Base tools
6-
flake8~=3.7
7-
isort~=5.9
8-
pre-commit~=2.13.0
6+
flake8~=4.0.1
7+
isort~=5.10.1
8+
pre-commit~=2.17.0
99

1010
# Flake8 plugins, see https://github.com/python-discord/code-jam-template/tree/main#plugin-list
11-
flake8-annotations~=2.0
12-
flake8-bandit~=2.1
13-
flake8-docstrings~=1.5
14-
flake8-isort~=4.0
11+
flake8-docstrings~=1.6.0

samples/Pipfile

+5-8
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ name = "pypi"
77

88
[dev-packages]
99
# Base tools
10-
flake8 = "~=3.7"
11-
isort = "~=5.9"
12-
pre-commit = "~=2.13.0"
10+
flake8 = "~=4.0.1"
11+
isort = "~=5.10.1"
12+
pre-commit = "~=2.17.0"
1313

1414
# Flake8 plugins, see https://github.com/python-discord/code-jam-template/tree/main#plugin-list
15-
flake8-annotations = "~=2.0"
16-
flake8-bandit = "~=2.1"
17-
flake8-docstrings = "~=1.5"
18-
flake8-isort = "~=4.0"
15+
flake8-docstrings = "~=1.6.0"
1916

2017
[requires]
21-
python_version = "3.9"
18+
python_version = "3.10"

samples/pyproject.toml

+5-8
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ authors = ["Author 1 <email@mail.com>"]
66
license = "MIT"
77

88
[tool.poetry.dependencies]
9-
python = "3.9.*"
9+
python = "3.10.*"
1010

1111
[tool.poetry.dev-dependencies]
1212
# Base tools
13-
flake8 = "~3.7"
14-
isort = "~5.9"
15-
pre-commit = "~2.13.0"
13+
flake8 = "~4.0.1"
14+
isort = "~5.10.1"
15+
pre-commit = "~2.17.0"
1616

1717
# Flake8 plugins, see https://github.com/python-discord/code-jam-template/tree/main#plugin-list
18-
flake8-annotations = "~2.0"
19-
flake8-bandit = "~2.1"
20-
flake8-docstrings = "~1.5"
21-
flake8-isort = "~4.0"
18+
flake8-docstrings = "~1.6.0"
2219

2320

2421
[build-system]

tox.ini

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ max-line-length=119
99
exclude=.venv,__pycache__
1010
# Ignore some of the most obnoxious linting errors.
1111
ignore=
12-
B311,W503,E226,S311,T000
12+
W503,E226,
1313
# Missing Docstrings
1414
D100,D104,D105,D106,D107,
1515
# Docstring Whitespace
@@ -19,9 +19,7 @@ ignore=
1919
# Docstring Content
2020
D400,D401,D402,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D416,D417,
2121
# Comments
22-
E266,
23-
# Type Annotations
24-
ANN002,ANN003,ANN101,ANN102,ANN204,ANN206
22+
E266
2523

2624
[isort]
2725
# Select the 5th style (Hanging grid grouped) to handle longer import.

0 commit comments

Comments
 (0)