Skip to content

Commit

Permalink
Dependencies upgrade and switch to ruff for formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Astropilot committed Dec 14, 2023
1 parent d837339 commit 9cd0ebd
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Start by cloning the repository:
```console
$ git clone https://github.com/Infisical/infisical-python
$ cd infisical-python
$ git clone https://github.com/Astropilot/thumbhash-python
$ cd thumbhash-python
```

We recommand that you create a virtual environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smokeshow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- run: pip install smokeshow

- uses: dawidd6/action-download-artifact@v2.26.0
- uses: dawidd6/action-download-artifact@v3.0.0
with:
workflow: test.yml
commit: ${{ github.event.workflow_run.head_sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false

steps:
Expand Down
15 changes: 7 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"python.linting.enabled": true,
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"python.linting.mypyEnabled": true,
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports.ruff": "explicit"
}
},
"ruff.organizeImports": false,
"ruff.fixAll": false,
"ruff.importStrategy": "fromEnvironment",
"autoDocstring.docstringFormat": "sphinx-notypes",
"python.analysis.typeCheckingMode": "strict"
"python.analysis.typeCheckingMode": "strict",
"mypy.runUsingActiveInterpreter": true,
"ruff.lint.args": ["--extend-exclude=/**/site-packages/**/*.py"],
"autoDocstring.docstringFormat": "sphinx-notypes"
}
63 changes: 33 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "thumbhash-python"
description = 'A Python implementation of the Thumbhash image placeholder generation algorithm.'
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
license = "MIT"
authors = [
{ name = "Yohann MARTIN", email = "[email protected]" },
Expand All @@ -22,17 +22,19 @@ classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"Pillow >=8.0.0,<10.0.0",
"typer[all] ==0.7.0"
"Pillow >=8.0.0,<11.0.0",
"typer[all] >=0.7.0,<1.0.0"
]
dynamic = ["version"]

Expand All @@ -42,18 +44,14 @@ Issues = "https://github.com/Astropilot/thumbhash-python/issues"
Source = "https://github.com/Astropilot/thumbhash-python"

[project.optional-dependencies]
test = [
"pytest >=7.1.3,<8.0.0",
"coverage[toml] >= 6.5.0,< 8.0"
]
dev = [
"mypy ==1.1.1",
"ruff ==0.0.257",
"black ==23.1.0",
"isort >=5.0.6,<6.0.0",
"devtools[pygments] ==0.10.0",
"types-Pillow >=10.0.0",

"types-Pillow >=9.0.0"
"mypy ==1.7.1",
"ruff ==0.1.8",
"devtools[pygments] ==0.12.2",
"pytest >=7.1.3,<8.0.0",
"coverage[toml] >=6.5.0,<8.0"
]

[project.scripts]
Expand All @@ -66,12 +64,11 @@ path = "thumbhash/__version__.py"
exclude = [
"/.github",
"/.vscode",
"/scripts"
"/scripts",
]

[tool.isort]
profile = "black"
known_third_party = ["thumbhash", "typer"]
[tool.hatch.build.targets.wheel]
packages = ["thumbhash"]

[tool.mypy]
strict = true
Expand All @@ -90,27 +87,33 @@ exclude_lines = [
"if TYPE_CHECKING:",
]

[tool.ruff]
target-version = "py37"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
# "I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"UP", # pyupgrade
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"E501", # line too long, handled by ruff
"B008", # do not perform function calls in argument defaults
"C901", # too complex,
"W191", # indentation contains tabs
"B904" # Opinionated warning on exception chaining
]
[tool.ruff.format]
line-ending = "lf"
quote-style = "double"
indent-style = "space"

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]

[tool.ruff.isort]
known-third-party = ["thumbhash"]
known-third-party = ["thumbhash", "typer", "PIL"]

[tool.pyright]
reportUnknownMemberType=false
Expand Down
3 changes: 1 addition & 2 deletions scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
set -x

ruff check thumbhash tests --fix
black thumbhash tests
isort thumbhash tests
ruff format thumbhash tests
2 changes: 0 additions & 2 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ set -x

mypy thumbhash
ruff check thumbhash tests
black thumbhash tests --check
isort thumbhash tests --check-only
2 changes: 1 addition & 1 deletion thumbhash/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.0"
__version__ = "1.0.1"
2 changes: 1 addition & 1 deletion thumbhash/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def encode(
dir_okay=False,
readable=True,
resolve_path=True,
)
),
) -> None:
"""
Get thumbhash from image
Expand Down

0 comments on commit 9cd0ebd

Please sign in to comment.