Skip to content

Commit 9cd0ebd

Browse files
committed
Dependencies upgrade and switch to ruff for formatting
1 parent d837339 commit 9cd0ebd

File tree

9 files changed

+47
-48
lines changed

9 files changed

+47
-48
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Start by cloning the repository:
22
```console
3-
$ git clone https://github.com/Infisical/infisical-python
4-
$ cd infisical-python
3+
$ git clone https://github.com/Astropilot/thumbhash-python
4+
$ cd thumbhash-python
55
```
66

77
We recommand that you create a virtual environment:

.github/workflows/smokeshow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- run: pip install smokeshow
2222

23-
- uses: dawidd6/action-download-artifact@v2.26.0
23+
- uses: dawidd6/action-download-artifact@v3.0.0
2424
with:
2525
workflow: test.yml
2626
commit: ${{ github.event.workflow_run.head_sha }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1616
fail-fast: false
1717

1818
steps:

.vscode/settings.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
2-
"python.linting.enabled": true,
3-
"python.formatting.provider": "black",
4-
"editor.formatOnSave": true,
5-
"python.linting.mypyEnabled": true,
62
"[python]": {
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "charliermarsh.ruff",
75
"editor.codeActionsOnSave": {
8-
"source.organizeImports": true
6+
"source.organizeImports.ruff": "explicit"
97
}
108
},
11-
"ruff.organizeImports": false,
129
"ruff.fixAll": false,
1310
"ruff.importStrategy": "fromEnvironment",
14-
"autoDocstring.docstringFormat": "sphinx-notypes",
15-
"python.analysis.typeCheckingMode": "strict"
11+
"python.analysis.typeCheckingMode": "strict",
12+
"mypy.runUsingActiveInterpreter": true,
13+
"ruff.lint.args": ["--extend-exclude=/**/site-packages/**/*.py"],
14+
"autoDocstring.docstringFormat": "sphinx-notypes"
1615
}

pyproject.toml

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "thumbhash-python"
77
description = 'A Python implementation of the Thumbhash image placeholder generation algorithm.'
88
readme = "README.md"
9-
requires-python = ">=3.7"
9+
requires-python = ">=3.8"
1010
license = "MIT"
1111
authors = [
1212
{ name = "Yohann MARTIN", email = "contact@codexus.fr" },
@@ -22,17 +22,19 @@ classifiers = [
2222
"Intended Audience :: Developers",
2323
"License :: OSI Approved :: MIT License",
2424
"Programming Language :: Python",
25-
"Programming Language :: Python :: 3.7",
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3 :: Only",
2627
"Programming Language :: Python :: 3.8",
2728
"Programming Language :: Python :: 3.9",
2829
"Programming Language :: Python :: 3.10",
2930
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
3032
"Programming Language :: Python :: Implementation :: CPython",
3133
"Programming Language :: Python :: Implementation :: PyPy",
3234
]
3335
dependencies = [
34-
"Pillow >=8.0.0,<10.0.0",
35-
"typer[all] ==0.7.0"
36+
"Pillow >=8.0.0,<11.0.0",
37+
"typer[all] >=0.7.0,<1.0.0"
3638
]
3739
dynamic = ["version"]
3840

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

4446
[project.optional-dependencies]
45-
test = [
46-
"pytest >=7.1.3,<8.0.0",
47-
"coverage[toml] >= 6.5.0,< 8.0"
48-
]
4947
dev = [
50-
"mypy ==1.1.1",
51-
"ruff ==0.0.257",
52-
"black ==23.1.0",
53-
"isort >=5.0.6,<6.0.0",
54-
"devtools[pygments] ==0.10.0",
48+
"types-Pillow >=10.0.0",
5549

56-
"types-Pillow >=9.0.0"
50+
"mypy ==1.7.1",
51+
"ruff ==0.1.8",
52+
"devtools[pygments] ==0.12.2",
53+
"pytest >=7.1.3,<8.0.0",
54+
"coverage[toml] >=6.5.0,<8.0"
5755
]
5856

5957
[project.scripts]
@@ -66,12 +64,11 @@ path = "thumbhash/__version__.py"
6664
exclude = [
6765
"/.github",
6866
"/.vscode",
69-
"/scripts"
67+
"/scripts",
7068
]
7169

72-
[tool.isort]
73-
profile = "black"
74-
known_third_party = ["thumbhash", "typer"]
70+
[tool.hatch.build.targets.wheel]
71+
packages = ["thumbhash"]
7572

7673
[tool.mypy]
7774
strict = true
@@ -90,27 +87,33 @@ exclude_lines = [
9087
"if TYPE_CHECKING:",
9188
]
9289

93-
[tool.ruff]
94-
target-version = "py37"
90+
[tool.ruff.lint]
9591
select = [
96-
"E", # pycodestyle errors
97-
"W", # pycodestyle warnings
98-
"F", # pyflakes
99-
# "I", # isort
100-
"C", # flake8-comprehensions
101-
"B", # flake8-bugbear
92+
"E", # pycodestyle errors
93+
"W", # pycodestyle warnings
94+
"F", # pyflakes
95+
"I", # isort
96+
"C", # flake8-comprehensions
97+
"B", # flake8-bugbear
98+
"UP", # pyupgrade
10299
]
103100
ignore = [
104-
"E501", # line too long, handled by black
105-
"B008", # do not perform function calls in argument defaults
106-
"C901", # too complex
101+
"E501", # line too long, handled by ruff
102+
"B008", # do not perform function calls in argument defaults
103+
"C901", # too complex,
104+
"W191", # indentation contains tabs
105+
"B904" # Opinionated warning on exception chaining
107106
]
107+
[tool.ruff.format]
108+
line-ending = "lf"
109+
quote-style = "double"
110+
indent-style = "space"
108111

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

112115
[tool.ruff.isort]
113-
known-third-party = ["thumbhash"]
116+
known-third-party = ["thumbhash", "typer", "PIL"]
114117

115118
[tool.pyright]
116119
reportUnknownMemberType=false

scripts/format.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
set -x
33

44
ruff check thumbhash tests --fix
5-
black thumbhash tests
6-
isort thumbhash tests
5+
ruff format thumbhash tests

scripts/lint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ set -x
55

66
mypy thumbhash
77
ruff check thumbhash tests
8-
black thumbhash tests --check
9-
isort thumbhash tests --check-only

thumbhash/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.0"
1+
__version__ = "1.0.1"

thumbhash/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def encode(
1818
dir_okay=False,
1919
readable=True,
2020
resolve_path=True,
21-
)
21+
),
2222
) -> None:
2323
"""
2424
Get thumbhash from image

0 commit comments

Comments
 (0)