Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Apakottur committed Feb 7, 2024
1 parent 8c4b165 commit 355c2b6
Show file tree
Hide file tree
Showing 15 changed files with 279 additions and 339 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand All @@ -25,6 +25,6 @@ jobs:
sudo snap install shfmt
- name: Run pre-commit
uses: pre-commit/action@v3.0.0
uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files --show-diff
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand Down
131 changes: 1 addition & 130 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,132 +1,3 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.idea
.tmp
__pycache__
45 changes: 27 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
# GENERAL #
###########
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=2000"]
Expand Down Expand Up @@ -42,6 +42,17 @@ repos:
- id: toml-sort
files: pyproject.toml
args: [--in-place, --ignore-case, --trailing-comma-inline-array]
- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: taplo-docker
args: [format, --config, ./linters/taplo.toml]
- repo: https://github.com/biomejs/pre-commit
rev: v0.1.0
hooks:
- id: biome-check
args: [--config-path, ./linters]
additional_dependencies: ["@biomejs/biome@1.5.1"]
##########
# PYTHON #
##########
Expand All @@ -54,33 +65,31 @@ repos:
- id: python-no-eval
- id: python-no-log-warn
- id: python-use-type-annotations
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: [ --config, ./linters/pyproject.toml ]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
hooks:
- id: ruff
args: [ --config, ./linters/ruff.toml ]
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
types: [file]
types_or: [python, pyi]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
args: [ --config, ./linters/ruff.toml ]
- id: ruff-format
args: [ --config, ./linters/ruff.toml ]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.6.5
- flake8-comprehensions==3.12.0
- flake8-picky-parentheses==0.5.0
- flake8-pyi==23.5.0
- flake8-bugbear==24.2.6
- flake8-comprehensions==3.14.0
- flake8-picky-parentheses==0.5.4
- flake8-pyi==24.1.0
- pep8-naming==0.13.3
- pydoclint==0.0.10
- pydoclint==0.3.10
args: [--config, ./linters/.flake8]
types: [file]
types_or: [python, pyi]
Expand All @@ -89,7 +98,7 @@ repos:
hooks:
- id: darglint
- repo: https://github.com/jendrikseipp/vulture
rev: "v2.7"
rev: v2.10
hooks:
- id: vulture
args: ["src", "tests"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ It is considered best practice to pin package versions in any production project
For example, a Poetry configuration file might look like this:

```toml

[tool.poetry]
name = "package"
version = "1.0.0"
Expand Down Expand Up @@ -51,6 +52,7 @@ This action automates this whole process.

## Usage

### As a GitHub Action
Create the following workflow:

```yml
Expand All @@ -76,6 +78,14 @@ jobs:
This workflow creates a PR which bumps all Python packages in poetry configuration files to their latest versions.
The workflow can be triggered manually and will also run automatically once a week.
### As a manual script
The Python script can be run manually:
1. Clone the repository.
2. From the root directory of the project where the `pyproject.toml` files are located, run the following command:
```shell
/path/to/action-poetry-package-update/src/main.py
```

### Action inputs

All inputs are **optional**. If not set, sensible defaults will be used.
Expand Down
46 changes: 35 additions & 11 deletions linters/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ per-file-ignores =
select = A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z

ignore =
###################################################
# Ignored - we rely on `black` to format our code #
###################################################
################################################
# Ignored - we rely on ruff to format our code #
################################################
# Whitespace before ':'
E203
# At least two spaces before inline comment
Expand All @@ -36,21 +36,37 @@ ignore =
E501
# multiple statements on one line
E704
# Only operators and comments are allowed after a closing bracket on a new line
PAR104
# Line break occurred before a binary operator
W503

#############################
# Ignored - duplicates Ruff #
#############################
# Do not perform function calls in argument defaults.
B008
# Function definition does not bind loop variable 'X'
B023
# Unnecessary generator
C401
# Unnecessary list comprehension
C419
# Module level import not at top of file
E402
# Comparison to False should be 'if condition is False:' or 'if not condition:'
E712
# Do not assign a lambda expression, use a def
E731
# Module imported but not used
F401
# Undefined name 'X'
F821
# redefinition of unused 'X' from line Y
# local variable 'X' is assigned to but never used
F841
# Redefinition of unused 'X' from line Y
F811
# Module imported but not used
F401
# first argument of a method should be named 'self'
# First argument of a method should be named 'self'
N805

#############
Expand All @@ -62,18 +78,26 @@ ignore =
DOC103
# Function X does not have a return section in docstring
DOC201
# Function X return type(s) in docstring not consistent with the return annotation.
DOC203
# Class X should not have a docstring; please combine it with the docstring of the class
DOC301
# Method X has "yield" statements, but the docstring does not have a "Yields" section
DOC402
# Function X has a "Raises" section in the docstring, but there are not "raise" statements in the body.
# TODO: Enable this once fixed.
DOC502
# Method X yield type(s) in docstring not consistent with the return annotation.
DOC404

###################################
# Other checks that we don't want #
###################################
# Method is too complex
C901
# Exception name should be named with an Error suffix
N818

# Maximum line length.
max-line-length = 120

# Pydoclint
style = google
type-hints-in-docstring = False
arg-type-hints-in-docstring = False
19 changes: 19 additions & 0 deletions linters/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"formatter": {
"enabled": true,
"lineWidth": 120,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
3 changes: 0 additions & 3 deletions linters/pyproject.toml

This file was deleted.

Loading

0 comments on commit 355c2b6

Please sign in to comment.