Skip to content

Commit 88fb80a

Browse files
authored
v1: Remove _async suffix from all methods, remove fire-n-forget counterparts, code improvements (#6)
* configs * remove fire-and-forget methods | remove _async in methods name * updates * fix: correct flashlight control flow and improve type checking in is_available method
1 parent d73e7bc commit 88fb80a

File tree

13 files changed

+65
-52
lines changed

13 files changed

+65
-52
lines changed

.ci/patch_pubspec_version.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# /// script
2+
# dependencies = ["pyyaml"]
3+
# ///
4+
15
import os
26
import pathlib
37
import sys
@@ -17,7 +21,7 @@
1721
"flet",
1822
]
1923

20-
with open(pubspec_path, "r") as f:
24+
with open(pubspec_path) as f:
2125
data = yaml.safe_load(f)
2226

2327
# patch version

.ci/patch_toml_version.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# /// script
2+
# dependencies = ["tomlkit"]
3+
# ///
4+
15
import os
26
import pathlib
37
import sys
@@ -14,7 +18,7 @@
1418
print(f"Patching TOML file {toml_path} to {ver}")
1519

1620
# read
17-
with open(toml_path, "r") as f:
21+
with open(toml_path) as f:
1822
t = tomlkit.parse(f.read())
1923

2024
# patch version

.docstr.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
paths: src/flet_flashlight
2+
badge: ./docs/assets/badges/docs-coverage.svg
3+
skip_file_doc: True
4+
skip_private: False
5+
ignore_patterns: # Dict with key/value pairs of file-pattern/node-pattern
6+
.*: __post_init__ # Ignore __post_init__ in all files
7+
fail_under: 50

.github/workflows/docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- dev
87
paths:
98
- 'LICENSE'
109
- 'CHANGELOG.md'

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- Deployed online documentation: https://flet-dev.github.io/flet-flashlight/
1313
- `Flashlight` control new properties: `on`, `on_error`
14-
- `Flashlight` control new methods: `is_available_async`
14+
- `Flashlight` control new methods: `is_available`
1515
- New exception classes:
1616
- `FlashlightException`
1717
- `FlashlightEnableExistentUserException`
@@ -32,4 +32,4 @@ Initial release.
3232

3333

3434
[0.2.0]: https://github.com/flet-dev/flet-flashlight/compare/0.1.0...0.2.0
35-
[0.1.0]: https://github.com/flet-dev/flet-flashlight/releases/tag/0.1.0
35+
[0.1.0]: https://github.com/flet-dev/flet-flashlight/releases/tag/0.1.0

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ This package supports the following platforms:
2525
| Android ||
2626
| Web ||
2727

28-
## Installation
28+
## Usage
29+
30+
### Installation
2931

3032
To install the `flet-flashlight` package and add it to your project dependencies:
3133

@@ -44,3 +46,7 @@ To install the `flet-flashlight` package and add it to your project dependencies
4446
```bash
4547
poetry add flet-flashlight
4648
```
49+
50+
### Examples
51+
52+
For examples, see [these](./examples).

appveyor.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@ image: ubuntu
33
version: '0.1.{build}'
44

55
environment:
6+
PYTHON_VERSION: 3.12
67
UV_PUBLISH_TOKEN:
78
secure: 174ncAbF5IjSIkmioPt62jeSnzmTlRNchUkE4QdjDWH8xK1olYtySXLJpo2q95HcP7lWJky1hv4APESiRRHnBWoY0XRFafzM/mbCDMzG1tZXiXZmpP1qzHAtRP2QSCIg18xh1TMktraUdTi7sbJnjjRhqzgbW1k0kLBxKw79MPFBhYQ/TiGcmaYWZbWVZNY3HCUCb6Dt7bG1OE2Ul9rD1gvs55xwO9Oq9FOVA1VnMYw=
89

9-
stack:
10-
- python 3.12
11-
1210
install:
1311
- source .ci/update_build_version.sh
14-
- python --version
15-
- python -m ensurepip --upgrade
16-
- pip3 install --upgrade tomlkit pyyaml
1712
- curl -LsSf https://astral.sh/uv/install.sh | sh
18-
- export PATH=$HOME/.local/bin:$PATH
13+
- export PATH="$HOME/.local/bin:$PATH"
14+
- uv python install $PYTHON_VERSION
15+
- uv python pin $PYTHON_VERSION
1916

2017
build_script:
21-
- python .ci/patch_toml_version.py pyproject.toml $PYPI_VER
22-
- python .ci/patch_pubspec_version.py src/flutter/flet_*/pubspec.yaml $PKG_VER
18+
- uv run .ci/patch_toml_version.py pyproject.toml $PYPI_VER
19+
- uv run .ci/patch_pubspec_version.py src/flutter/flet_*/pubspec.yaml $PKG_VER
2320
- (cd src/flutter/* && dart pub get && dart analyze && cd -)
2421
- uv build
2522

@@ -32,4 +29,4 @@ deploy_script:
3229
artifacts:
3330
- path: dist/*.whl
3431

35-
test: off
32+
test: off

docs/flashlight.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
::: flet_flashlight.flashlight.Flashlight
1+
## Examples
2+
3+
### Example 1
4+
5+
```python title="example_1.py"
6+
--8<-- "examples/flashlight_example/src/example_1.py"
7+
```
8+
9+
::: flet_flashlight.flashlight.Flashlight

docs/index.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ To install the `flet-flashlight` package and add it to your project dependencies
4444
poetry add flet-flashlight
4545
```
4646

47+
### Examples
4748

48-
## Example
49-
50-
```python title="main.py"
51-
--8<-- "examples/flashlight_example/src/main.py"
52-
```
49+
See [these](flashlight.md#examples).

0 commit comments

Comments
 (0)