Skip to content

Commit e061c59

Browse files
authored
chore: setup pre-commit (#195)
* chore: add basic pre-commit config * chore: fix shebangs and exec permission bit * style: format code using pre-commit and prettier - pre-commit hooks - prettier * ci: enforce pre-commit check * chore: add isort and black pre-commit hooks * style: format code using isort and black * chore: add pyupgrade pre-commit hook * refactor: upgrade code using pyupgrade * chore: add flake8 pre-commit hook * docs: check contribution with pre-commit
1 parent 3cba96d commit e061c59

92 files changed

Lines changed: 426 additions & 461 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Thanks for filing an issue 😄 ! Before you submit, please read the following:
33
44
Check the other issue templates if you are trying to submit a bug report, feature request, or question
55
Search open/closed issues before submitting since someone might have asked the same thing before!
6-
-->
6+
-->

.github/ISSUE_TEMPLATE/Bug_Report.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
22
name: 🐛 Bug Report
33
about: If something isn't working as expected 🤔.
4-
54
---
5+
66
## Bug Report
77

88
**Current Behavior**
99
A clear and concise description of the behavior.
1010

1111
**Input Code**
12+
1213
- REPL or Repo link if applicable:
1314

1415
```python
@@ -19,11 +20,13 @@ your = "code" + "here"
1920
A clear and concise description of what you expected to happen (or code).
2021

2122
**Environment**
23+
2224
- Python Version: [e.g. v2.6, v2.7, v3.0]
2325
- Hcloud-Python Version: [e.g. v0.1, v1.0]
2426

2527
**Possible Solution**
28+
2629
<!--- Only if you have suggestions on a fix for the bug -->
2730

2831
**Additional context/Screenshots**
29-
Add any other context about the problem here. If applicable, add screenshots to help explain.
32+
Add any other context about the problem here. If applicable, add screenshots to help explain.

.github/ISSUE_TEMPLATE/Feature_Request.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
name: 🚀 Feature Request
33
about: I have a suggestion (and may want to implement it 🙂)!
4-
54
---
65

76
## Feature Request
@@ -17,4 +16,4 @@ A clear and concise description of any alternative solutions or features you've
1716

1817
**Teachability, Documentation, Adoption, Migration Strategy**
1918
If you can, explain how users will be able to use this and possibly write out a version the docs.
20-
Maybe a screenshot or design?
19+
Maybe a screenshot or design?

.github/workflows/bot_stale.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
- uses: actions/stale@v1
1010
with:
1111
repo-token: ${{ secrets.GITHUB_TOKEN }}
12-
stale-issue-message: 'This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs.'
13-
exempt-issue-label: 'pinned'
14-
stale-issue-label: 'stale'
15-
stale-pr-message: 'This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs.'
16-
exempt-pr-label: 'pinned'
17-
stale-pr-label: 'stale'
12+
stale-issue-message: "This issue has been marked as stale because it has not had recent activity. The bot will close the issue if no further action occurs."
13+
exempt-issue-label: "pinned"
14+
stale-issue-label: "stale"
15+
stale-pr-message: "This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs."
16+
exempt-pr-label: "pinned"
17+
stale-pr-label: "stale"
1818
days-before-stale: 90
1919
days-before-close: 30

.github/workflows/code_style.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ jobs:
1414
architecture: x64
1515
- name: Install dependencies
1616
run: |
17-
python -m pip install --upgrade pip
18-
pip install -r requirements/test.txt
19-
pip install tox tox-gh-actions
20-
sudo apt install build-essential
21-
- name: flake8 with tox
22-
run: tox -e flake8
23-
- name: black with tox
24-
run: tox -e black
17+
python -m pip install --upgrade pip
18+
pip install -r requirements/test.txt
19+
pip install tox tox-gh-actions
20+
sudo apt install build-essential
21+
- name: pre-commit with tox
22+
run: tox -e pre-commit

.github/workflows/release.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- name: Set up Python
13-
uses: actions/setup-python@v3
14-
with:
15-
python-version: '3.x'
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
20-
- name: Build and publish
21-
env:
22-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24-
run: |
25-
python setup.py sdist bdist_wheel
26-
twine upload dist/*
11+
- uses: actions/checkout@v3
12+
- name: Set up Python
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: "3.x"
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine
20+
- name: Build and publish
21+
env:
22+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine upload dist/*

.github/workflows/unit_test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
10+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1111
name: Python ${{ matrix.python-version }}
1212
steps:
1313
- uses: actions/checkout@v3
@@ -18,10 +18,10 @@ jobs:
1818
architecture: x64
1919
- name: Install dependencies
2020
run: |
21-
python -m pip install --upgrade pip
22-
pip install -r requirements/test.txt
23-
pip install tox tox-gh-actions
24-
sudo apt install build-essential
21+
python -m pip install --upgrade pip
22+
pip install -r requirements/test.txt
23+
pip install tox tox-gh-actions
24+
sudo apt install build-essential
2525
- name: Test with tox
2626
run: tox
2727
env:

.gitlab-ci.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
stages:
2-
- test
2+
- test
33

44
.tests_template: &tests_template
55
before_script:
6-
- pip install tox
7-
- apk add build-base
6+
- pip install tox
7+
- apk add build-base git
88
stage: test
9-
script:
10-
tox
9+
script: tox
1110
tags:
12-
- hc-bladerunner
11+
- hc-bladerunner
1312

1413
python37:
1514
<<: *tests_template
@@ -40,5 +39,4 @@ test-style:
4039
<<: *tests_template
4140
image: python:3.9-alpine
4241
script:
43-
- tox -e flake8
44-
- tox -e black
42+
- tox -e pre-commit

.pre-commit-config.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# See https://pre-commit.com for more information
3+
# See https://pre-commit.com/hooks.html for more hooks
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.4.0
7+
hooks:
8+
- id: check-added-large-files
9+
- id: check-case-conflict
10+
- id: check-executables-have-shebangs
11+
- id: check-shebang-scripts-are-executable
12+
- id: check-symlinks
13+
- id: destroyed-symlinks
14+
15+
- id: check-json
16+
- id: check-yaml
17+
- id: check-toml
18+
19+
- id: check-merge-conflict
20+
- id: end-of-file-fixer
21+
- id: mixed-line-ending
22+
- id: trailing-whitespace
23+
24+
- repo: https://github.com/pre-commit/mirrors-prettier
25+
rev: v2.7.1
26+
hooks:
27+
- id: prettier
28+
files: \.(md|ya?ml|js|css)$
29+
30+
- repo: https://github.com/asottile/pyupgrade
31+
rev: v3.6.0
32+
hooks:
33+
- id: pyupgrade
34+
args: [--py37-plus]
35+
36+
- repo: https://github.com/pycqa/isort
37+
rev: 5.12.0
38+
hooks:
39+
- id: isort
40+
args: [--profile=black]
41+
42+
- repo: https://github.com/psf/black
43+
rev: 23.3.0
44+
hooks:
45+
- id: black
46+
47+
- repo: https://github.com/pycqa/flake8
48+
rev: 6.0.0
49+
hooks:
50+
- id: flake8

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## [1.20.0](https://github.com/hetznercloud/hcloud-python/compare/v1.19.0...v1.20.0) (2023-05-12)
44

5-
65
### Features
76

8-
* **server_type:** add field for included traffic ([#185](https://github.com/hetznercloud/hcloud-python/issues/185)) ([8ae0bc6](https://github.com/hetznercloud/hcloud-python/commit/8ae0bc6e032440538f3aeb2222a9bee34adab04b))
7+
- **server_type:** add field for included traffic ([#185](https://github.com/hetznercloud/hcloud-python/issues/185)) ([8ae0bc6](https://github.com/hetznercloud/hcloud-python/commit/8ae0bc6e032440538f3aeb2222a9bee34adab04b))

0 commit comments

Comments
 (0)