fogies 0.0.0.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fogies/__init__.py ADDED
File without changes
File without changes
fogies/tasks/format.py ADDED
@@ -0,0 +1,37 @@
1
+ """
2
+ Tasks for applying code formatting.
3
+ """
4
+
5
+ from typing import Callable, cast
6
+
7
+ from invoke.context import Context
8
+ from invoke.tasks import Task, task
9
+
10
+
11
+ def get_task_format() -> Task[Callable[[Context], None]]:
12
+ @task(name="format") # pyright: ignore[reportUntypedFunctionDecorator]
13
+ def task_format(context: Context) -> None:
14
+ """
15
+ Apply code formatting.
16
+ """
17
+ _ = context.run(
18
+ command=" ".join(
19
+ [
20
+ "isort",
21
+ ".",
22
+ ]
23
+ ),
24
+ echo=True,
25
+ )
26
+
27
+ _ = context.run(
28
+ command=" ".join(
29
+ [
30
+ "black",
31
+ ".",
32
+ ]
33
+ ),
34
+ echo=True,
35
+ )
36
+
37
+ return cast(Task[Callable[[Context], None]], task_format)
fogies/tasks/lint.py ADDED
@@ -0,0 +1,27 @@
1
+ """
2
+ Tasks for running linting.
3
+ """
4
+
5
+ from typing import Callable, cast
6
+
7
+ from invoke.context import Context
8
+ from invoke.tasks import Task, task
9
+
10
+
11
+ def get_task_lint() -> Task[Callable[[Context], None]]:
12
+ @task(name="lint") # pyright: ignore[reportUntypedFunctionDecorator]
13
+ def task_lint(context: Context) -> None:
14
+ """
15
+ Run linting.
16
+ """
17
+ _ = context.run(
18
+ command=" ".join(
19
+ [
20
+ "basedpyright",
21
+ ".",
22
+ ]
23
+ ),
24
+ echo=True,
25
+ )
26
+
27
+ return cast(Task[Callable[[Context], None]], task_lint)
fogies/tasks/poetry.py ADDED
@@ -0,0 +1,71 @@
1
+ """
2
+ Tasks for building and publishing with Poetry.
3
+ """
4
+
5
+ import tomllib
6
+ from pathlib import Path
7
+ from typing import Callable, cast
8
+
9
+ from invoke.collection import Collection
10
+ from invoke.context import Context
11
+ from invoke.tasks import Task, task
12
+
13
+
14
+ def get_task_build() -> Task[Callable[[Context], None]]:
15
+ @task(name="build") # pyright: ignore[reportUntypedFunctionDecorator]
16
+ def task_build(context: Context) -> None:
17
+ """
18
+ Build package artifacts.
19
+ """
20
+ _ = context.run(
21
+ command=" ".join(
22
+ [
23
+ "poetry",
24
+ "build",
25
+ ]
26
+ ),
27
+ echo=True,
28
+ )
29
+
30
+ return cast(Task[Callable[[Context], None]], task_build)
31
+
32
+
33
+ def get_task_publish(*, path_secrets_poetry: Path) -> Task[Callable[[Context], None]]:
34
+ @task(name="publish") # pyright: ignore[reportUntypedFunctionDecorator]
35
+ def task_publish(context: Context) -> None:
36
+ """
37
+ Publish package to PyPI.
38
+ """
39
+ with path_secrets_poetry.open("rb") as handle:
40
+ secrets_poetry = tomllib.load(handle)
41
+
42
+ api_key: str = cast(str, secrets_poetry["api"]["api_key"])
43
+
44
+ _ = context.run(
45
+ command=" ".join(
46
+ [
47
+ "poetry",
48
+ "publish",
49
+ "--username {}".format("__token__"),
50
+ "--password {}".format(api_key),
51
+ ]
52
+ ),
53
+ echo=True,
54
+ )
55
+
56
+ return cast(Task[Callable[[Context], None]], task_publish)
57
+
58
+
59
+ def get_collection(path_secrets_poetry: Path) -> Collection:
60
+ """
61
+ Get a collection of tasks.
62
+ """
63
+ namespace = Collection("poetry")
64
+
65
+ task_build = get_task_build()
66
+ task_publish = get_task_publish(path_secrets_poetry=path_secrets_poetry)
67
+
68
+ namespace.add_task(task_build)
69
+ namespace.add_task(task_publish)
70
+
71
+ return namespace
fogies/tasks/test.py ADDED
@@ -0,0 +1,38 @@
1
+ """
2
+ Tasks for running tests.
3
+ """
4
+
5
+ import os
6
+ import shutil
7
+ from typing import Callable, cast
8
+
9
+ from invoke.context import Context
10
+ from invoke.tasks import Task, task
11
+
12
+
13
+ def get_task_test() -> Task[Callable[[Context], None]]:
14
+ @task(name="test") # pyright: ignore[reportUntypedFunctionDecorator]
15
+ def task_test(context: Context) -> None:
16
+ """
17
+ Run tests.
18
+ """
19
+ # Explicitly set COLUMNS environment variable to match terminal width.
20
+ # Without this, execution through invoke will use a narrow default width.
21
+ env = os.environ.copy()
22
+ env["COLUMNS"] = str(shutil.get_terminal_size().columns)
23
+
24
+ _ = context.run(
25
+ command=" ".join(
26
+ [
27
+ "pytest",
28
+ # Explicitly enable color output.
29
+ # Without this, output through invoke will not be in color.
30
+ "--color=yes",
31
+ ".",
32
+ ]
33
+ ),
34
+ echo=True,
35
+ env=env,
36
+ )
37
+
38
+ return cast(Task[Callable[[Context], None]], task_test)
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: fogies
3
+ Version: 0.0.0.dev1
4
+ Summary:
5
+ Author: James Fogarty
6
+ Author-email: jayfo@users.noreply.github.com
7
+ Requires-Python: >=3.14,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.14
10
+ Description-Content-Type: text/markdown
11
+
12
+ # pyfogies
@@ -0,0 +1,9 @@
1
+ fogies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ fogies/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ fogies/tasks/format.py,sha256=EX0mAnQlgQTefy1zrqx8qhVwUK_c1f0VqPgR40ox_sM,876
4
+ fogies/tasks/lint.py,sha256=wALvWDdVtiOfBzZLNy2JGEF3BAXFA-anJlYp1FaX55s,652
5
+ fogies/tasks/poetry.py,sha256=eRiy5hjOWvZobUZBLOoqE4tZF1kSAbutfYXy37OuM30,1984
6
+ fogies/tasks/test.py,sha256=W2rHp3lBcaddKmTgESUB-dbGnXQxrgjoLmAWDUsz78o,1126
7
+ fogies-0.0.0.dev1.dist-info/METADATA,sha256=Vi7VfaL-xlmP_d3f8Y_mZUJxryBynlnH52I-HKtr_mg,312
8
+ fogies-0.0.0.dev1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
9
+ fogies-0.0.0.dev1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.2.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any