Skip to content

Commit

Permalink
update pre-commit to work with safety
Browse files Browse the repository at this point in the history
  • Loading branch information
FredHappyface committed Feb 16, 2025
1 parent 62d66b3 commit ebc6f67
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 107 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
downloads/
env*
requirements_optional.txt
tests/data
sticker*.txt
sorted
perf.py
/*.tgs
/test_*

poetry.lock
uv.lock

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
38 changes: 30 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
rev: v0.9.6
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.354
rev: v1.1.394
hooks:
- id: pyright

- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.3.3
- repo: local
hooks:
- id: python-safety-dependencies-check
files: pyproject.toml
- id: generate requirements
name: generate requirements
entry: uv export --no-hashes --no-dev -o requirements.txt
language: system
pass_filenames: false
- id: safety
name: safety
entry: uv run safety
language: system
pass_filenames: false
- id: make docs
name: make docs
entry: uv run handsdown --cleanup -o documentation/reference
language: system
pass_filenames: false
- id: build package
name: build package
entry: uv build
language: system
pass_filenames: false
- id: pytest
name: pytest
entry: uv run pytest
language: system
pass_filenames: false

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -35,7 +57,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/boidolr/pre-commit-images
rev: v1.5.2
rev: v1.8.4
hooks:
- id: optimize-jpg
- id: optimize-png
Expand Down
2 changes: 1 addition & 1 deletion documentation/reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ A full list of `Tstickers` project modules.
- [Convert](tstickers/convert.md#convert)
- [Convert Pyrlottie](tstickers/convert_pyrlottie.md#convert-pyrlottie)
- [Convert Rlottie Python](tstickers/convert_rlottie_python.md#convert-rlottie-python)
- [Downloader](tstickers/downloader.md#downloader)
- [Manager](tstickers/manager.md#manager)
15 changes: 1 addition & 14 deletions documentation/reference/tstickers/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,15 @@
- [Cli](#cli)
- [cli](#cli)
- [is_library_installed](#is_library_installed)

## cli

[Show source in cli.py:22](../../../tstickers/cli.py#L22)
[Show source in cli.py:18](../../../tstickers/cli.py#L18)

Cli entry point.

#### Signature

```python
def cli() -> None: ...
```



## is_library_installed

[Show source in cli.py:18](../../../tstickers/cli.py#L18)

#### Signature

```python
def is_library_installed(library_name: str) -> bool: ...
```
31 changes: 3 additions & 28 deletions documentation/reference/tstickers/convert.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- [Convert](#convert)
- [Backend](#backend)
- [assure_dir_exists](#assure_dir_exists)
- [convertAnimated](#convertanimated)
- [convertAnimatedFunc](#convertanimatedfunc)
- [convertStatic](#convertstatic)
Expand All @@ -26,33 +25,9 @@ class Backend(IntEnum): ...



## assure_dir_exists

[Show source in convert.py:38](../../../tstickers/convert.py#L38)

Make the directory if it does not exist.

#### Arguments

----
- `parts` *Path* - path parts

#### Returns

-------
- `Path` - the full path

#### Signature

```python
def assure_dir_exists(*parts: Path | str) -> Path: ...
```



## convertAnimated

[Show source in convert.py:106](../../../tstickers/convert.py#L106)
[Show source in convert.py:90](../../../tstickers/convert.py#L90)

Convert animated stickers to webp, gif and png.

Expand Down Expand Up @@ -110,7 +85,7 @@ def convertAnimatedFunc(

## convertStatic

[Show source in convert.py:75](../../../tstickers/convert.py#L75)
[Show source in convert.py:58](../../../tstickers/convert.py#L58)

Convert static stickers to png and gif.

Expand All @@ -135,7 +110,7 @@ def convertStatic(swd: Path, threads: int = 4) -> int: ...

## convertWithPIL

[Show source in convert.py:55](../../../tstickers/convert.py#L55)
[Show source in convert.py:38](../../../tstickers/convert.py#L38)

Convert the webp file to png.

Expand Down
2 changes: 1 addition & 1 deletion documentation/reference/tstickers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
- [Convert](./convert.md)
- [Convert Pyrlottie](./convert_pyrlottie.md)
- [Convert Rlottie Python](./convert_rlottie_python.md)
- [Downloader](./downloader.md)
- [Manager](./manager.md)
Loading

0 comments on commit ebc6f67

Please sign in to comment.