Skip to content

Commit 32dee47

Browse files
authored
v0.2.0 (#3)
* Add absolufy_imports to pre_commit * Add data/ dir * Update readme * Add vulture to pre_commit * Add codespell, pyupgrade and yesqa to pre_commit * Add dependabot * Add CodeQL pipeline * Add dependency review pipeline * Add pre-commit badge * Add pre-commit to build pipeline * Add pre_commit cache * Remove unused packages from lock * Add codespell * Update readme * Update .gitignore * Update poetry.lock * Create LICENSE * Update readme
1 parent 8af53b4 commit 32dee47

File tree

15 files changed

+304
-418
lines changed

15 files changed

+304
-418
lines changed

.codespell

Whitespace-only changes.

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
ignore:
8+
- dependency-name: "python"
9+
assignees:
10+
- "piotr-rarus"

.github/hooks/.pre-commit-config.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ default_stages: [commit]
33
fail_fast: true
44

55
repos:
6+
67
- repo: https://github.com/pre-commit/pre-commit-hooks
78
rev: v4.0.1
89
hooks:
@@ -14,24 +15,53 @@ repos:
1415
- id: check-toml
1516
- id: check-xml
1617
- id: check-yaml
18+
- id: debug-statements
1719
- id: detect-private-key
1820
- id: end-of-file-fixer
1921
- id: no-commit-to-branch
20-
args: ['--branch', 'master']
2122
- id: pretty-format-json
2223
- id: trailing-whitespace
2324

25+
- repo: https://github.com/MarcoGorelli/absolufy-imports
26+
rev: v0.3.1
27+
hooks:
28+
- id: absolufy-imports
29+
files: ^src/
30+
31+
- repo: https://github.com/jendrikseipp/vulture
32+
rev: v2.4
33+
hooks:
34+
- id: vulture
35+
36+
- repo: https://github.com/codespell-project/codespell
37+
rev: v2.1.0
38+
hooks:
39+
- id: codespell
40+
types_or: [python, rst, markdown]
41+
args: [--ignore-words=.codespell]
42+
2443
- repo: https://github.com/timothycrosley/isort
2544
rev: 5.10.1
2645
hooks:
2746
- id: isort
2847
name: isort (python)
2948

49+
- repo: https://github.com/asottile/pyupgrade
50+
rev: v2.34.0
51+
hooks:
52+
- id: pyupgrade
53+
args: [--py39-plus]
54+
55+
- repo: https://github.com/asottile/yesqa
56+
rev: v1.3.0
57+
hooks:
58+
- id: yesqa
59+
3060
- repo: https://github.com/psf/black
3161
rev: 22.3.0
3262
hooks:
33-
- id: black
34-
language_version: python3.8
63+
- id: black
64+
language_version: python3.8
3565

3666
- repo: https://gitlab.com/pycqa/flake8
3767
rev: 4.0.1

.github/workflows/build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,23 @@ jobs:
2828
path: .venv
2929
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
3030

31+
- name: Cache pre-commit
32+
uses: actions/cache@v3
33+
with:
34+
path: ~/.cache/pre-commit
35+
key: pre-commit-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('.github/hooks/.pre-commit-config.yml') }}
36+
3137
- name: Install dependencies
3238
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
3339
run: poetry install --no-interaction --no-root
3440

35-
- name: Linter
41+
- name: pre-commit
3642
run: |
37-
poetry run flake8 src
43+
poetry run pre-commit run -a -c .github/hooks/.pre-commit-config.yml
3844
3945
- name: Mypy
4046
run: |
41-
poetry run mypy --incremental --show-error-codes --pretty src
47+
poetry run mypy --install-types --incremental --show-error-codes --pretty src
4248
4349
- name: Tests
4450
run: |

.github/workflows/codeql.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '16 0 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
4+
#
5+
# Source repository: https://github.com/actions/dependency-review-action
6+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7+
name: 'Dependency Review'
8+
on: [pull_request]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
dependency-review:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: 'Checkout Repository'
18+
uses: actions/checkout@v3
19+
- name: 'Dependency Review'
20+
uses: actions/dependency-review-action@v1

.gitignore

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ __pycache__/
66
# C extensions
77
*.so
88

9-
109
# Distribution / packaging
1110
.Python
1211
build/
@@ -15,11 +14,13 @@ dist/
1514
downloads/
1615
eggs/
1716
.eggs/
17+
lib/
1818
lib64/
1919
parts/
2020
sdist/
2121
var/
2222
wheels/
23+
share/python-wheels/
2324
*.egg-info/
2425
.installed.cfg
2526
*.egg
@@ -38,14 +39,17 @@ pip-delete-this-directory.txt
3839
# Unit test / coverage reports
3940
htmlcov/
4041
.tox/
42+
.nox/
4143
.coverage
4244
.coverage.*
4345
.cache
4446
nosetests.xml
4547
coverage.xml
4648
*.cover
49+
*.py,cover
4750
.hypothesis/
4851
.pytest_cache/
52+
cover/
4953

5054
# Translations
5155
*.mo
@@ -55,6 +59,7 @@ coverage.xml
5559
*.log
5660
local_settings.py
5761
db.sqlite3
62+
db.sqlite3-journal
5863

5964
# Flask stuff:
6065
instance/
@@ -67,24 +72,56 @@ instance/
6772
docs/_build/
6873

6974
# PyBuilder
75+
.pybuilder/
7076
target/
7177

7278
# Jupyter Notebook
7379
.ipynb_checkpoints
7480

75-
# pyenv
76-
.python-version
81+
# IPython
82+
profile_default/
83+
ipython_config.py
7784

78-
# celery beat schedule file
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
79116
celerybeat-schedule
117+
celerybeat.pid
80118

81119
# SageMath parsed files
82120
*.sage.py
83121

84122
# Environments
85123
.env
86124
.venv
87-
.envrc
88125
env/
89126
venv/
90127
ENV/
@@ -103,7 +140,21 @@ venv.bak/
103140

104141
# mypy
105142
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
106154

107-
# Project's custom
108-
.vscode/
109-
.idea/
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
#.idea/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Piotr Rarus
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ flake8:
2121
format: isort black
2222

2323
mypy:
24-
poetry run mypy --incremental --show-error-codes --pretty src
24+
poetry run mypy --incremental --install-types --show-error-codes --pretty src
2525

2626
pre_commit:
2727
poetry run pre-commit run -a -c .github/hooks/.pre-commit-config.yml

0 commit comments

Comments
 (0)