stdl 0.6.9__tar.gz → 0.7.1__tar.gz

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.
Files changed (46) hide show
  1. {stdl-0.6.9 → stdl-0.7.1}/.pre-commit-config.yaml +1 -1
  2. {stdl-0.6.9 → stdl-0.7.1}/CONTRIBUTING.md +1 -1
  3. {stdl-0.6.9 → stdl-0.7.1}/Justfile +18 -15
  4. {stdl-0.6.9 → stdl-0.7.1}/PKG-INFO +17 -38
  5. {stdl-0.6.9 → stdl-0.7.1}/README.md +2 -29
  6. {stdl-0.6.9 → stdl-0.7.1}/pyproject.toml +17 -8
  7. {stdl-0.6.9 → stdl-0.7.1}/stdl/__init__.py +1 -1
  8. {stdl-0.6.9 → stdl-0.7.1}/stdl/color.py +275 -167
  9. {stdl-0.6.9 → stdl-0.7.1}/stdl/dt.py +30 -8
  10. stdl-0.7.1/stdl/fs.py +3022 -0
  11. {stdl-0.6.9 → stdl-0.7.1}/stdl/import_lazy.py +6 -3
  12. {stdl-0.6.9 → stdl-0.7.1}/stdl/lst.py +2 -2
  13. {stdl-0.6.9 → stdl-0.7.1}/stdl/st.py +14 -25
  14. {stdl-0.6.9 → stdl-0.7.1}/tests/test_color.py +52 -0
  15. {stdl-0.6.9 → stdl-0.7.1}/tests/test_dt.py +55 -0
  16. {stdl-0.6.9 → stdl-0.7.1}/tests/test_fs.py +588 -133
  17. stdl-0.7.1/tests/test_fs_async.py +536 -0
  18. {stdl-0.6.9 → stdl-0.7.1}/tests/test_st.py +38 -0
  19. stdl-0.7.1/uv.lock +1068 -0
  20. stdl-0.6.9/stdl/fs.py +0 -1746
  21. stdl-0.6.9/uv.lock +0 -696
  22. {stdl-0.6.9 → stdl-0.7.1}/.editorconfig +0 -0
  23. {stdl-0.6.9 → stdl-0.7.1}/.github/workflows/lint.yml +0 -0
  24. {stdl-0.6.9 → stdl-0.7.1}/.github/workflows/publish.yml +0 -0
  25. {stdl-0.6.9 → stdl-0.7.1}/.github/workflows/test.yml +0 -0
  26. {stdl-0.6.9 → stdl-0.7.1}/.gitignore +0 -0
  27. {stdl-0.6.9 → stdl-0.7.1}/.python-version +0 -0
  28. {stdl-0.6.9 → stdl-0.7.1}/.readthedocs.yml +0 -0
  29. {stdl-0.6.9 → stdl-0.7.1}/LICENSE +0 -0
  30. {stdl-0.6.9 → stdl-0.7.1}/docs/index.md +0 -0
  31. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/color.md +0 -0
  32. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/decorators.md +0 -0
  33. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/dt.md +0 -0
  34. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/fs.md +0 -0
  35. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/import_lazy.md +0 -0
  36. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/log.md +0 -0
  37. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/net.md +0 -0
  38. {stdl-0.6.9 → stdl-0.7.1}/docs/reference/st.md +0 -0
  39. {stdl-0.6.9 → stdl-0.7.1}/docs/requirements.txt +0 -0
  40. {stdl-0.6.9 → stdl-0.7.1}/mkdocs.yml +0 -0
  41. {stdl-0.6.9 → stdl-0.7.1}/stdl/decorators.py +0 -0
  42. {stdl-0.6.9 → stdl-0.7.1}/stdl/log.py +0 -0
  43. {stdl-0.6.9 → stdl-0.7.1}/stdl/net.py +0 -0
  44. {stdl-0.6.9 → stdl-0.7.1}/tests/test_decorators.py +0 -0
  45. {stdl-0.6.9 → stdl-0.7.1}/tests/test_lst.py +0 -0
  46. {stdl-0.6.9 → stdl-0.7.1}/tests/test_pydantic_integration.py +0 -0
@@ -8,7 +8,7 @@ repos:
8
8
  - id: check-toml
9
9
 
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.14.2
11
+ rev: v0.15.8
12
12
  hooks:
13
13
  - id: ruff-check
14
14
  args: [--fix, --exit-zero]
@@ -10,7 +10,7 @@ We use [uv](https://docs.astral.sh/uv/) for project management, [Hatch](https://
10
10
  To install this package and its development dependencies, run:
11
11
 
12
12
  ```sh
13
- just dev
13
+ just sync
14
14
  ```
15
15
 
16
16
  or
@@ -4,38 +4,39 @@
4
4
  _require-uv:
5
5
  @uv --version > /dev/null || (echo "Please install uv: https://docs.astral.sh/uv/" && exit 1)
6
6
 
7
- _require-hatch:
8
- @hatch --version > /dev/null || (echo "Please install hatch: uv tool install hatch" && exit 1)
7
+ _require-hatch: _require-uv
8
+ @uvx hatch --version > /dev/null || (echo "Unable to run hatch through uvx" && exit 1)
9
9
 
10
10
  # check code style and potential issues
11
- lint:
12
- ruff check
11
+ lint: _require-uv
12
+ uv run ruff check .
13
13
 
14
14
  # format code
15
- format:
16
- ruff format
15
+ format: _require-uv
16
+ uv run ruff format .
17
17
 
18
18
  # fix automatically fixable linting issues
19
- fix:
20
- ruff check --fix
19
+ fix: _require-uv
20
+ uv run ruff check --fix .
21
21
 
22
22
  # run tests across all supported Python versions
23
23
  test: _require-hatch
24
- hatch run test:test
24
+ uvx hatch run test:test
25
+
25
26
 
26
27
  # build the package
27
28
  build: _require-uv
28
29
  uv build
29
30
 
30
31
  # setup or update local dev environment, keeps previously installed extras
31
- dev: _require-uv
32
+ sync: _require-uv
32
33
  uv sync --inexact --extra dev
33
34
  uv run pre-commit install
34
35
 
35
36
  # run tests with coverage and show a coverage report
36
- coverage:
37
- coverage run -m pytest
38
- coverage report
37
+ coverage: _require-uv
38
+ uv run coverage run -m pytest
39
+ uv run coverage report
39
40
 
40
41
  # clean build artifacts and caches
41
42
  clean:
@@ -47,8 +48,8 @@ typecheck: _require-uv
47
48
  uv run mypy
48
49
 
49
50
  # check code for common misspellings
50
- spell:
51
- codespell
51
+ spell: _require-uv
52
+ uv run codespell
52
53
 
53
54
  # run all quality checks
54
55
  check: format lint coverage typecheck spell
@@ -60,3 +61,5 @@ help:
60
61
  alias fmt := format
61
62
  alias cov := coverage
62
63
  alias mypy := typecheck
64
+
65
+ alias dev := sync
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stdl
3
- Version: 0.6.9
3
+ Version: 0.7.1
4
4
  Summary: Extended Python Standard Library
5
5
  Project-URL: Repository, https://github.com/zigai/stdl
6
6
  Project-URL: Issues, https://github.com/zigai/stdl/issues
@@ -50,20 +50,26 @@ Requires-Dist: python-dateutil>=2.8.2
50
50
  Requires-Dist: pyyaml>=6.0.2
51
51
  Requires-Dist: toml>=0.10.2
52
52
  Requires-Dist: typing-extensions>=4.0; python_version < '3.11'
53
+ Provides-Extra: async
54
+ Requires-Dist: anyio>=4.0.0; extra == 'async'
53
55
  Provides-Extra: dev
54
- Requires-Dist: codespell; extra == 'dev'
55
- Requires-Dist: coverage; extra == 'dev'
56
- Requires-Dist: mypy; extra == 'dev'
57
- Requires-Dist: pre-commit; extra == 'dev'
56
+ Requires-Dist: anyio>=4.0.0; extra == 'dev'
57
+ Requires-Dist: codespell>=2.4.2; extra == 'dev'
58
+ Requires-Dist: coverage>=7.13.5; extra == 'dev'
59
+ Requires-Dist: mypy>=1.19.1; extra == 'dev'
60
+ Requires-Dist: pre-commit>=4.5.1; extra == 'dev'
58
61
  Requires-Dist: pydantic>=2; extra == 'dev'
59
- Requires-Dist: pytest; extra == 'dev'
60
- Requires-Dist: ruff; extra == 'dev'
62
+ Requires-Dist: pytest>=9.0.2; extra == 'dev'
63
+ Requires-Dist: rattle-blank-lines>=0.2.6; extra == 'dev'
64
+ Requires-Dist: rattle-lint>=1.0.6; extra == 'dev'
65
+ Requires-Dist: ruff==0.15.8; extra == 'dev'
61
66
  Provides-Extra: full
62
67
  Requires-Dist: tqdm>=4.67.1; extra == 'full'
63
68
  Provides-Extra: test
64
- Requires-Dist: coverage; extra == 'test'
69
+ Requires-Dist: anyio>=4.0.0; extra == 'test'
70
+ Requires-Dist: coverage>=7.13.5; extra == 'test'
65
71
  Requires-Dist: pydantic>=2; extra == 'test'
66
- Requires-Dist: pytest; extra == 'test'
72
+ Requires-Dist: pytest>=9.0.2; extra == 'test'
67
73
  Description-Content-Type: text/markdown
68
74
 
69
75
  # stdl
@@ -94,12 +100,14 @@ Description-Content-Type: text/markdown
94
100
 
95
101
  ```sh
96
102
  pip install stdl
103
+ pip install 'stdl[async]'
97
104
  ```
98
105
 
99
106
  ### Using uv
100
107
 
101
108
  ```sh
102
109
  uv add stdl
110
+ uv add 'stdl[async]'
103
111
  ```
104
112
 
105
113
  ### From source
@@ -110,35 +118,6 @@ pip install git+https://github.com/zigai/stdl.git
110
118
  uv add git+https://github.com/zigai/stdl.git
111
119
  ```
112
120
 
113
- ## Examples
114
-
115
- ### Lazy imports
116
-
117
- ```python
118
- from typing import TYPE_CHECKING
119
- from stdl.import_lazy import import_lazy
120
-
121
- if TYPE_CHECKING:
122
- from os.path import abspath, join
123
- import numpy as np
124
- import torch
125
- else:
126
- import_lazy("os.path", ["join", "abspath"], verbose=True)
127
- import_lazy("numpy", alias="np", verbose=True)
128
- import_lazy("torch", verbose=True)
129
-
130
- print(np.zeros(4))
131
- # importing "numpy" took 0.060s
132
- # [0. 0. 0. 0.]
133
- print(torch)
134
- # <LazyImport: torch>
135
- print(torch.randn(8))
136
- # importing "torch" took 1.118s
137
- # tensor([0., 0., 0., 0., 0., 0., 0., 0.])
138
- print(torch)
139
- # <module 'torch' from .../torch/__init__.py'
140
- ```
141
-
142
121
  ## License
143
122
 
144
123
  [MIT License](https://github.com/zigai/stdl/blob/master/LICENSE)
@@ -26,12 +26,14 @@
26
26
 
27
27
  ```sh
28
28
  pip install stdl
29
+ pip install 'stdl[async]'
29
30
  ```
30
31
 
31
32
  ### Using uv
32
33
 
33
34
  ```sh
34
35
  uv add stdl
36
+ uv add 'stdl[async]'
35
37
  ```
36
38
 
37
39
  ### From source
@@ -42,35 +44,6 @@ pip install git+https://github.com/zigai/stdl.git
42
44
  uv add git+https://github.com/zigai/stdl.git
43
45
  ```
44
46
 
45
- ## Examples
46
-
47
- ### Lazy imports
48
-
49
- ```python
50
- from typing import TYPE_CHECKING
51
- from stdl.import_lazy import import_lazy
52
-
53
- if TYPE_CHECKING:
54
- from os.path import abspath, join
55
- import numpy as np
56
- import torch
57
- else:
58
- import_lazy("os.path", ["join", "abspath"], verbose=True)
59
- import_lazy("numpy", alias="np", verbose=True)
60
- import_lazy("torch", verbose=True)
61
-
62
- print(np.zeros(4))
63
- # importing "numpy" took 0.060s
64
- # [0. 0. 0. 0.]
65
- print(torch)
66
- # <LazyImport: torch>
67
- print(torch.randn(8))
68
- # importing "torch" took 1.118s
69
- # tensor([0., 0., 0., 0., 0., 0., 0., 0.])
70
- print(torch)
71
- # <module 'torch' from .../torch/__init__.py'
72
- ```
73
-
74
47
  ## License
75
48
 
76
49
  [MIT License](https://github.com/zigai/stdl/blob/master/LICENSE)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stdl"
3
- version = "0.6.9"
3
+ version = "0.7.1"
4
4
  description = "Extended Python Standard Library"
5
5
  authors = [{ name = "Žiga Ivanšek", email = "ziga.ivansek@gmail.com" }]
6
6
  license = { file = "LICENSE" }
@@ -46,18 +46,22 @@ keywords = [
46
46
  ]
47
47
 
48
48
  [project.optional-dependencies]
49
+ async = ["anyio>=4.0.0"]
49
50
  full = ["tqdm>=4.67.1"]
50
51
  dev = [
51
- "pytest",
52
- "coverage",
53
- "ruff",
54
- "pre-commit",
55
- "mypy",
56
- "codespell",
52
+ "anyio>=4.0.0",
53
+ "pytest>=9.0.2",
54
+ "coverage>=7.13.5",
55
+ "ruff==0.15.8",
56
+ "pre-commit>=4.5.1",
57
+ "mypy>=1.19.1",
58
+ "codespell>=2.4.2",
57
59
  "pydantic>=2",
60
+ "rattle-lint>=1.0.6",
61
+ "rattle-blank-lines>=0.2.6",
58
62
  ]
59
63
 
60
- test = ["pytest", "coverage", "pydantic>=2"]
64
+ test = ["anyio>=4.0.0", "pytest>=9.0.2", "coverage>=7.13.5", "pydantic>=2"]
61
65
  [project.urls]
62
66
  Repository = "https://github.com/zigai/stdl"
63
67
  Issues = "https://github.com/zigai/stdl/issues"
@@ -113,6 +117,11 @@ warn_unused_configs = true
113
117
  strict_equality = true
114
118
  ignore_missing_imports = true
115
119
 
120
+ [tool.rattle]
121
+ root = true
122
+ enable = ["rattle_blank_lines.rules"]
123
+ disable = ["rattle.rules"]
124
+
116
125
  [tool.ruff]
117
126
  line-length = 100
118
127
 
@@ -1,2 +1,2 @@
1
1
  from stdl import color, decorators, dt, fs, import_lazy, log, lst, net, st
2
- from stdl.fs import Directory, File
2
+ from stdl.fs import AsyncFileHandle, Directory, File