Skip to content

Commit d73e7bc

Browse files
authored
fix(docs): update (#5)
* initial commit * remove mdformat from pre-commit * update mkdocs watch items | unshow `Event.get_event_field_type` * fixes * lint dependency group
1 parent a74f042 commit d73e7bc

File tree

9 files changed

+235
-39
lines changed

9 files changed

+235
-39
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
paths:
89
- 'LICENSE'
910
- 'CHANGELOG.md'
@@ -52,7 +53,7 @@ jobs:
5253
- name: Install dependencies
5354
run: |
5455
uv pip install -e .
55-
uv pip install --group docs
56+
uv pip install --group docs --group lint
5657
5758
- name: Deploy to GitHub Pages
5859
run: uv run mkdocs gh-deploy --force

.gitignore

Lines changed: 132 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,135 @@
1-
*.egg-info/
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
211
build/
312
develop-eggs/
413
dist/
5-
.DS_store
6-
.venv/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
uv.lock
94+
95+
# celery beat schedule file
96+
celerybeat-schedule
97+
98+
# SageMath parsed files
99+
*.sage.py
100+
101+
# Environments
102+
.env
103+
.venv
104+
env/
105+
venv/
106+
ENV/
107+
env.bak/
108+
venv.bak/
109+
110+
# Spyder project settings
111+
.spyderproject
112+
.spyproject
113+
114+
# Rope project settings
115+
.ropeproject
116+
117+
# mkdocs documentation
118+
/site
119+
120+
# mypy
121+
.mypy_cache/
122+
.dmypy.json
123+
dmypy.json
124+
125+
# Pyre type checker
126+
.pyre/
127+
128+
# VS Code
129+
.vscode/
130+
131+
# PDM
132+
.pdm.toml
133+
__pypackages__/
134+
135+
.DS_Store

.pre-commit-config.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
repos:
2-
- repo: https://github.com/pycqa/isort
3-
rev: 5.13.2
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.12.5
44
hooks:
5-
- id: isort
6-
- repo: https://github.com/ambv/black
7-
rev: 22.12.0
5+
# Run the linter.
6+
- id: ruff
7+
args: [ --fix ]
8+
# Run the formatter.
9+
- id: ruff-format
10+
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v5.0.0
813
hooks:
9-
- id: black
14+
- id: end-of-file-fixer
15+
- id: trailing-whitespace
16+
17+
- repo: https://github.com/aio-libs/sort-all
18+
rev: v1.3.0
19+
hooks:
20+
- id: sort-all

mkdocs.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,17 @@ validation:
9999
# Watch
100100
watch:
101101
- docs
102-
- src
102+
- src/flet_flashlight
103+
- CHANGELOG.md
104+
- LICENSE
105+
- README.md
103106

104107
# Plugins
105108
plugins:
106109
# - footnotes
107110
- search:
108111
lang: en
112+
- open-in-new-tab
109113
- mike:
110114
alias_type: symlink
111115
- glightbox
@@ -130,21 +134,17 @@ plugins:
130134
show_labels: false
131135
show_if_no_docstring: true
132136
docstring_section_style: spacy
137+
separate_signature: true
133138
inherited_members: true
134139
preload_modules: [ flet ]
135140
filters:
136141
- "!^_" # Exclude private members starting with only one underscore
137-
- "!before_update"
138-
- "!before_event"
139-
- "!clean"
140-
- "!did_mount"
141-
- "!init"
142-
- "!is_isolated"
143-
- "!update"
144-
- "!will_unmount"
142+
- "!get_event_field_type"
145143
extensions:
146144
- griffe_modernized_annotations
145+
- griffe_warnings_deprecated
147146
inventories:
147+
- url: https://docs.flet.dev/objects.inv
148148
- url: https://docs.python.org/3/objects.inv
149149
domains: [ py, std ]
150150
- url: https://typing-extensions.readthedocs.io/en/latest/objects.inv

pyproject.toml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,43 @@ Issues = "https://github.com/flet-dev/flet-flashlight/issues"
2020
"flutter.flet_flashlight" = ["**/*"]
2121

2222
[dependency-groups]
23+
test = [
24+
"pytest >=7.2.0",
25+
]
26+
lint = [
27+
"ruff >=0.11.7",
28+
]
2329
dev = [
24-
"pre-commit>=4.2.0",
25-
"ruff>=0.11.7",
30+
"pre-commit >=4.2.0",
31+
{ include-group = 'lint' },
32+
{ include-group = 'test' },
33+
]
34+
docs-coverage = [
35+
"docstr-coverage >=2.3.2",
2636
]
2737
docs = [
28-
"mkdocs",
29-
"mkdocs-material",
30-
"mkdocstrings[python]",
31-
"mkdocstrings-python-xref",
32-
"mike",
33-
"markdown>=3.6",
34-
"pymdown-extensions",
35-
"mkdocs-glightbox",
36-
"mkdocs-section-index",
37-
"griffe-modernized-annotations",
38-
"pygments>=2.16",
38+
"mkdocs >=1.6.1",
39+
"mkdocs-material >=9.6.15",
40+
"mkdocstrings-python >=1.16.12",
41+
"mkdocstrings-python-xref >=1.16.3",
42+
"mike >=2.1.3",
43+
"markdown >=3.6",
44+
"pymdown-extensions >=10.16",
45+
"mkdocs-exclude >=1.0.2",
46+
"mkdocs-glightbox >=0.4.0",
47+
"mkdocs-open-in-new-tab >=1.0.8",
48+
"mkdocs-section-index >=0.3.10",
49+
"griffe-modernized-annotations >=1.0.8",
50+
"griffe-warnings-deprecated >=1.1.0",
51+
"pygments >=2.16",
52+
"markdown-exec[ansi] >=1.11.0",
53+
"pydocstyle >=6.3.0",
54+
"linkcheckmd >=1.4.0",
55+
{ include-group = 'docs-coverage' },
56+
]
57+
all = [
58+
{ include-group = 'dev' },
59+
{ include-group = 'docs' },
3960
]
4061

4162
[build-system]
@@ -64,6 +85,7 @@ select = [
6485
"I"
6586
]
6687
preview = true
88+
pydocstyle = { convention = 'google' }
6789

6890
[tool.ruff.format]
6991
quote-style = "double"

src/flet_flashlight/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@
88
FlashlightException,
99
)
1010
from .flashlight import Flashlight
11+
12+
__all__ = [
13+
"Flashlight",
14+
"FlashlightDisableException",
15+
"FlashlightDisableExistentUserException",
16+
"FlashlightDisableNotAvailableException",
17+
"FlashlightEnableException",
18+
"FlashlightEnableExistentUserException",
19+
"FlashlightEnableNotAvailableException",
20+
"FlashlightException",
21+
]

src/flet_flashlight/exceptions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
__all__ = [
2+
"FlashlightDisableException",
3+
"FlashlightDisableExistentUserException",
4+
"FlashlightDisableNotAvailableException",
5+
"FlashlightEnableException",
6+
"FlashlightEnableExistentUserException",
7+
"FlashlightEnableNotAvailableException",
8+
"FlashlightException",
9+
]
10+
11+
112
class FlashlightException(Exception):
213
"""
314
Base class for all [`Flashlight`][(p).] exceptions.

src/flet_flashlight/flashlight.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
import asyncio
2+
from typing import Optional
23

34
import flet as ft
45

5-
from .exceptions import *
6+
from .exceptions import (
7+
FlashlightDisableException,
8+
FlashlightDisableExistentUserException,
9+
FlashlightDisableNotAvailableException,
10+
FlashlightEnableException,
11+
FlashlightEnableExistentUserException,
12+
FlashlightEnableNotAvailableException,
13+
FlashlightException,
14+
)
615

716
__all__ = ["Flashlight"]
817

918

1019
@ft.control("Flashlight")
1120
class Flashlight(ft.Service):
1221
"""
13-
A control to use FlashLight. Works on iOS and Android. Based on torch_light Flutter widget (https://pub.dev/packages/torch_light).
22+
A control to use FlashLight. Works on iOS and Android.
1423
1524
Note:
16-
This control is a non-visual and should be added to `page.services` list before it can be used.
25+
This control is a non-visual and should be added
26+
to [`Page.services`][flet.Page.services] list before it can be used.
1727
"""
1828

1929
on = False
2030
"""
2131
Whether the flashlight is currently turned on.
2232
"""
2333

24-
on_error: ft.OptionalControlEventHandler["Flashlight"] = None
34+
on_error: Optional[ft.ControlEventHandler["Flashlight"]] = None
2535
"""
2636
Fires when an error occurs.
27-
28-
The `data` property of the event handler argument contains information on the error.
37+
38+
The [`data`][flet.Event.data] property of the event handler argument
39+
contains information on the error.
2940
"""
3041

3142
async def turn_on_async(self):

src/flutter/flet_flashlight/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ dependencies:
2727
dev_dependencies:
2828
flutter_test:
2929
sdk: flutter
30-
flutter_lints: ^2.0.0
30+
flutter_lints: ^3.0.0

0 commit comments

Comments
 (0)