stdl 0.6.2__tar.gz → 0.6.4__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 (53) hide show
  1. stdl-0.6.4/.editorconfig +12 -0
  2. stdl-0.6.4/.github/workflows/lint.yml +23 -0
  3. stdl-0.6.4/.github/workflows/publish.yml +25 -0
  4. stdl-0.6.4/.github/workflows/test.yml +33 -0
  5. stdl-0.6.4/.gitignore +134 -0
  6. stdl-0.6.4/.pre-commit-config.yaml +15 -0
  7. stdl-0.6.4/.python-version +1 -0
  8. stdl-0.6.4/.readthedocs.yml +31 -0
  9. stdl-0.6.4/CONTRIBUTING.md +81 -0
  10. stdl-0.6.4/Justfile +62 -0
  11. stdl-0.6.4/PKG-INFO +137 -0
  12. stdl-0.6.4/README.md +76 -0
  13. stdl-0.6.2/README.md → stdl-0.6.4/docs/index.md +1 -1
  14. stdl-0.6.4/docs/reference/color.md +1 -0
  15. stdl-0.6.4/docs/reference/decorators.md +1 -0
  16. stdl-0.6.4/docs/reference/dt.md +1 -0
  17. stdl-0.6.4/docs/reference/fs.md +1 -0
  18. stdl-0.6.4/docs/reference/import_lazy.md +1 -0
  19. stdl-0.6.4/docs/reference/log.md +1 -0
  20. stdl-0.6.4/docs/reference/net.md +1 -0
  21. stdl-0.6.4/docs/reference/st.md +1 -0
  22. stdl-0.6.4/docs/requirements.txt +4 -0
  23. stdl-0.6.4/mkdocs.yml +99 -0
  24. stdl-0.6.4/pyproject.toml +205 -0
  25. stdl-0.6.4/stdl/__init__.py +1 -0
  26. {stdl-0.6.2 → stdl-0.6.4}/stdl/color.py +382 -121
  27. {stdl-0.6.2 → stdl-0.6.4}/stdl/decorators.py +16 -11
  28. {stdl-0.6.2 → stdl-0.6.4}/stdl/dt.py +27 -34
  29. {stdl-0.6.2 → stdl-0.6.4}/stdl/fs.py +69 -73
  30. stdl-0.6.4/stdl/import_lazy.py +123 -0
  31. {stdl-0.6.2 → stdl-0.6.4}/stdl/log.py +8 -7
  32. {stdl-0.6.2 → stdl-0.6.4}/stdl/lst.py +4 -5
  33. {stdl-0.6.2 → stdl-0.6.4}/stdl/net.py +4 -3
  34. {stdl-0.6.2 → stdl-0.6.4}/stdl/st.py +14 -24
  35. {stdl-0.6.2 → stdl-0.6.4}/tests/test_color.py +172 -132
  36. stdl-0.6.4/tests/test_pydantic_integration.py +79 -0
  37. stdl-0.6.4/uv.lock +534 -0
  38. stdl-0.6.2/PKG-INFO +0 -74
  39. stdl-0.6.2/pyproject.toml +0 -94
  40. stdl-0.6.2/setup.cfg +0 -4
  41. stdl-0.6.2/setup.py +0 -3
  42. stdl-0.6.2/stdl/__init__.py +0 -1
  43. stdl-0.6.2/stdl.egg-info/PKG-INFO +0 -74
  44. stdl-0.6.2/stdl.egg-info/SOURCES.txt +0 -24
  45. stdl-0.6.2/stdl.egg-info/dependency_links.txt +0 -1
  46. stdl-0.6.2/stdl.egg-info/requires.txt +0 -16
  47. stdl-0.6.2/stdl.egg-info/top_level.txt +0 -1
  48. {stdl-0.6.2 → stdl-0.6.4}/LICENSE +0 -0
  49. {stdl-0.6.2 → stdl-0.6.4}/tests/test_decorators.py +0 -0
  50. {stdl-0.6.2 → stdl-0.6.4}/tests/test_dt.py +0 -0
  51. {stdl-0.6.2 → stdl-0.6.4}/tests/test_fs.py +0 -0
  52. {stdl-0.6.2 → stdl-0.6.4}/tests/test_lst.py +0 -0
  53. {stdl-0.6.2 → stdl-0.6.4}/tests/test_st.py +0 -0
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+ end_of_line = lf
10
+
11
+ [*.{yaml,yml}]
12
+ indent_size = 2
@@ -0,0 +1,23 @@
1
+ name: Lint
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ lint:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v5
9
+
10
+ - name: Install uv
11
+ uses: astral-sh/setup-uv@v7
12
+
13
+ - name: Set up Python
14
+ run: uv python install 3.12
15
+
16
+ - name: Install dependencies
17
+ run: uv sync --extra dev --python 3.12
18
+
19
+ - name: Check formatting with Ruff
20
+ run: uv run --python 3.12 ruff format --check .
21
+
22
+ - name: Run Ruff lint
23
+ run: uv run --python 3.12 ruff check .
@@ -0,0 +1,25 @@
1
+ name: Upload Python Package
2
+ on:
3
+ release:
4
+ types: [published]
5
+
6
+ jobs:
7
+ deploy:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v5
11
+
12
+ - name: Install uv
13
+ uses: astral-sh/setup-uv@v7
14
+ with:
15
+ python-version: 3.12
16
+
17
+ - name: Build and publish
18
+ env:
19
+ TWINE_USERNAME: __token__
20
+
21
+ TWINE_PASSWORD: ${{ secrets.TOKEN }}
22
+
23
+ run: |
24
+ uv build
25
+ uv run --with twine twine upload dist/*
@@ -0,0 +1,33 @@
1
+ name: Tests
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ tests:
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ os: [ubuntu-latest, macos-latest, windows-latest]
10
+ python-version: [
11
+ "3.10",
12
+ "3.11",
13
+ "3.12",
14
+ "3.13",
15
+ "3.14"
16
+ ]
17
+ runs-on: ${{ matrix.os }}
18
+
19
+ steps:
20
+ - uses: actions/checkout@v5
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v7
24
+
25
+
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ run: uv python install ${{ matrix.python-version }}
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --extra test --python ${{ matrix.python-version }}
31
+
32
+ - name: Run pytest
33
+ run: uv run --python ${{ matrix.python-version }} pytest -v
stdl-0.6.4/.gitignore ADDED
@@ -0,0 +1,134 @@
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
11
+ build/
12
+ develop-eggs/
13
+ dist/
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
+
85
+ # pipenv
86
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
87
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
88
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
89
+ # install all needed dependencies.
90
+ #Pipfile.lock
91
+
92
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
93
+ __pypackages__/
94
+
95
+ # Celery stuff
96
+ celerybeat-schedule
97
+ celerybeat.pid
98
+
99
+ # SageMath parsed files
100
+ *.sage.py
101
+
102
+ # Environments
103
+ .env
104
+ .venv
105
+ env/
106
+ venv/
107
+ ENV/
108
+ env.bak/
109
+ venv.bak/
110
+
111
+ # Spyder project settings
112
+ .spyderproject
113
+ .spyproject
114
+
115
+ # Rope project settings
116
+ .ropeproject
117
+
118
+ # mkdocs documentation
119
+ /site
120
+
121
+ # mypy
122
+ .mypy_cache/
123
+ .dmypy.json
124
+ dmypy.json
125
+
126
+ # Pyre type checker
127
+ .pyre/
128
+
129
+ # IDEs
130
+ .vscode
131
+ .idea
132
+
133
+ *example*.py
134
+ *ruff_cache*
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-toml
9
+
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ rev: v0.14.2
12
+ hooks:
13
+ - id: ruff-check
14
+ args: [--fix, --exit-zero]
15
+ - id: ruff-format
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,31 @@
1
+ # .readthedocs.yml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Set the OS, Python version and other tools you might need
9
+
10
+ build:
11
+ os: ubuntu-22.04
12
+ tools:
13
+ python: "3.10"
14
+
15
+ # Build documentation in the docs/ directory with Sphinx
16
+ # sphinx:
17
+ # configuration: docs/conf.py
18
+
19
+ # Python environment
20
+ python:
21
+ install:
22
+ # these are needed, because they are not part of standard setup
23
+ - requirements: docs/requirements.txt
24
+
25
+ # Build documentation with MkDocs
26
+ mkdocs:
27
+ configuration: mkdocs.yml
28
+ fail_on_warning: false
29
+
30
+ # Optionally build your docs in additional formats such as PDF and ePub
31
+ formats: all
@@ -0,0 +1,81 @@
1
+ # Development
2
+
3
+ ## Environment
4
+
5
+ For local development, you need Python 3.10 or later installed.
6
+ We use [uv](https://docs.astral.sh/uv/) for project management, [Hatch](https://hatch.pypa.io/latest/) for environment management, and [just](https://github.com/casey/just) as our command runner.
7
+
8
+ ## Dependencies
9
+
10
+ To install this package and its development dependencies, run:
11
+
12
+ ```sh
13
+ just dev
14
+ ```
15
+
16
+ or
17
+
18
+ ```sh
19
+ uv sync --extra dev
20
+ ```
21
+
22
+ ## Code checking
23
+
24
+ To execute all code checking tools together, run:
25
+
26
+ ```sh
27
+ just check
28
+ ```
29
+
30
+ ### Linting
31
+
32
+ We utilize [ruff](https://docs.astral.sh/ruff/) for linting, which analyzes code for potential issues and enforces consistent style. Refer to `pyproject.toml` for configuration details.
33
+
34
+ To run linting:
35
+
36
+ ```sh
37
+ just lint
38
+ ```
39
+
40
+ ### Formatting
41
+
42
+ [ruff](https://docs.astral.sh/ruff/) is also used for code formatting. Refer to `pyproject.toml` for configuration details.
43
+
44
+ To run formatting:
45
+
46
+ ```sh
47
+ just format
48
+ ```
49
+
50
+ ## Testing
51
+
52
+ We use [pytest](https://docs.pytest.org/en/stable/) for testing. You have two options for running tests:
53
+
54
+ ```sh
55
+ # Run tests on your current Python version
56
+ uv run --extra test pytest -v
57
+
58
+ # Run tests across all supported Python versions
59
+ just test
60
+ ```
61
+
62
+ ## Pre-commit Hooks
63
+
64
+ We use [pre-commit](https://pre-commit.com/) to run quality checks automatically:
65
+
66
+ ```sh
67
+ # Install pre-commit hooks
68
+ uv tool install pre-commit
69
+ pre-commit install
70
+
71
+ # Run hooks manually on all files
72
+ pre-commit run --all-files
73
+ ```
74
+
75
+ ## Documentation
76
+
77
+ We follow the [Google docstring format](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for code documentation. All user-facing classes and functions must be documented with docstrings and type hints.
78
+
79
+ ## Release Process
80
+
81
+ New versions are automatically published to [PyPI](https://pypi.org/project/stdl/) when a GitHub release is created.
stdl-0.6.4/Justfile ADDED
@@ -0,0 +1,62 @@
1
+ @_:
2
+ just --list
3
+
4
+ _require-uv:
5
+ @uv --version > /dev/null || (echo "Please install uv: https://docs.astral.sh/uv/" && exit 1)
6
+
7
+ _require-hatch:
8
+ @hatch --version > /dev/null || (echo "Please install hatch: uv tool install hatch" && exit 1)
9
+
10
+ # check code style and potential issues
11
+ lint:
12
+ ruff check
13
+
14
+ # format code
15
+ format:
16
+ ruff format
17
+
18
+ # fix automatically fixable linting issues
19
+ fix:
20
+ ruff check --fix
21
+
22
+ # run tests across all supported Python versions
23
+ test: _require-hatch
24
+ hatch run test:test
25
+
26
+ # build the package
27
+ build: _require-uv
28
+ uv build
29
+
30
+ # setup or update local dev environment, keeps previously installed extras
31
+ dev: _require-uv
32
+ uv sync --inexact --extra dev
33
+ uv run pre-commit install
34
+
35
+ # run tests with coverage and show a coverage report
36
+ coverage:
37
+ coverage run -m pytest
38
+ coverage report
39
+
40
+ # clean build artifacts and caches
41
+ clean:
42
+ rm -rf .venv .pytest_cache .mypy_cache .ruff_cache
43
+ find . -type d -name "__pycache__" -exec rm -r {} +
44
+
45
+ # static type check with mypy
46
+ typecheck: _require-uv
47
+ uv run mypy
48
+
49
+ # check code for common misspellings
50
+ spell:
51
+ codespell
52
+
53
+ # run all quality checks
54
+ check: format lint coverage typecheck spell
55
+
56
+ # list available recipes
57
+ help:
58
+ just --list
59
+
60
+ alias fmt := format
61
+ alias cov := coverage
62
+ alias mypy := typecheck
stdl-0.6.4/PKG-INFO ADDED
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: stdl
3
+ Version: 0.6.4
4
+ Summary: Extended Python Standard Library
5
+ Project-URL: Repository, https://github.com/zigai/stdl
6
+ Project-URL: Issues, https://github.com/zigai/stdl/issues
7
+ Project-URL: Homepage, https://github.com/zigai/stdl
8
+ Author-email: Žiga Ivanšek <ziga.ivansek@gmail.com>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2022 Žiga Ivanšek
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: ANSI colors,color formats,filesystem,lazy import,list utils,logging configuration,python lazy import,python utilities,standard library,stdl,string utils,terminal links,terminal output
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Programming Language :: Python
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3 :: Only
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Programming Language :: Python :: 3.14
43
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
44
+ Classifier: Typing :: Typed
45
+ Requires-Python: >=3.10
46
+ Requires-Dist: python-dateutil>=2.8.2
47
+ Requires-Dist: pyyaml>=6.0.2
48
+ Requires-Dist: toml>=0.10.2
49
+ Requires-Dist: tqdm>=4.67.1
50
+ Provides-Extra: dev
51
+ Requires-Dist: codespell; extra == 'dev'
52
+ Requires-Dist: coverage; extra == 'dev'
53
+ Requires-Dist: mypy; extra == 'dev'
54
+ Requires-Dist: pre-commit; extra == 'dev'
55
+ Requires-Dist: pytest; extra == 'dev'
56
+ Requires-Dist: ruff; extra == 'dev'
57
+ Provides-Extra: test
58
+ Requires-Dist: coverage; extra == 'test'
59
+ Requires-Dist: pytest; extra == 'test'
60
+ Description-Content-Type: text/markdown
61
+
62
+ # stdl
63
+
64
+ [![Tests](https://github.com/zigai/stdl/actions/workflows/tests.yml/badge.svg)](https://github.com/zigai/stdl/actions/workflows/test.yml)
65
+ [![Documentation Status](https://readthedocs.org/projects/stdl/badge/?version=latest)](https://stdl.readthedocs.io/en/latest/?badge=latest)
66
+ [![PyPI version](https://badge.fury.io/py/stdl.svg)](https://badge.fury.io/py/stdl)
67
+ ![Supported versions](https://img.shields.io/badge/python-3.10+-blue.svg)
68
+ [![Downloads](https://static.pepy.tech/badge/stdl)](https://pepy.tech/project/stdl)
69
+ [![license](https://img.shields.io/github/license/zigai/stdl.svg)](https://github.com/zigai/stdl/blob/master/LICENSE)
70
+
71
+ `stdl` is a collection of Python utilities that complement the standard library.
72
+
73
+ ## Features
74
+
75
+ - File and directory operations
76
+ - String manipulation
77
+ - ANSI color support for terminal output
78
+ - Date and time formatting
79
+ - List utils
80
+ - Lazy imports
81
+ - Logging configuration for `logging` and `loguru`
82
+ - [See docs](https://stdl.readthedocs.io/en/latest/?badge=latest)
83
+
84
+ ## Installation
85
+
86
+ ### Using pip
87
+
88
+ ```sh
89
+ pip install stdl
90
+ ```
91
+
92
+ ### Using uv
93
+
94
+ ```sh
95
+ uv add stdl
96
+ ```
97
+
98
+ ### From source
99
+
100
+ ```sh
101
+ pip install git+https://github.com/zigai/stdl.git
102
+ # or
103
+ uv add git+https://github.com/zigai/stdl.git
104
+ ```
105
+
106
+ ## Examples
107
+
108
+ ### Lazy imports
109
+
110
+ ```python
111
+ from typing import TYPE_CHECKING
112
+ from stdl.import_lazy import import_lazy
113
+
114
+ if TYPE_CHECKING:
115
+ from os.path import abspath, join
116
+ import numpy as np
117
+ import torch
118
+ else:
119
+ import_lazy("os.path", ["join", "abspath"], verbose=True)
120
+ import_lazy("numpy", alias="np", verbose=True)
121
+ import_lazy("torch", verbose=True)
122
+
123
+ print(np.zeros(4))
124
+ # importing "numpy" took 0.060s
125
+ # [0. 0. 0. 0.]
126
+ print(torch)
127
+ # <LazyImport: torch>
128
+ print(torch.randn(8))
129
+ # importing "torch" took 1.118s
130
+ # tensor([0., 0., 0., 0., 0., 0., 0., 0.])
131
+ print(torch)
132
+ # <module 'torch' from .../torch/__init__.py'
133
+ ```
134
+
135
+ ## License
136
+
137
+ [MIT License](https://github.com/zigai/stdl/blob/master/LICENSE)
stdl-0.6.4/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # stdl
2
+
3
+ [![Tests](https://github.com/zigai/stdl/actions/workflows/tests.yml/badge.svg)](https://github.com/zigai/stdl/actions/workflows/test.yml)
4
+ [![Documentation Status](https://readthedocs.org/projects/stdl/badge/?version=latest)](https://stdl.readthedocs.io/en/latest/?badge=latest)
5
+ [![PyPI version](https://badge.fury.io/py/stdl.svg)](https://badge.fury.io/py/stdl)
6
+ ![Supported versions](https://img.shields.io/badge/python-3.10+-blue.svg)
7
+ [![Downloads](https://static.pepy.tech/badge/stdl)](https://pepy.tech/project/stdl)
8
+ [![license](https://img.shields.io/github/license/zigai/stdl.svg)](https://github.com/zigai/stdl/blob/master/LICENSE)
9
+
10
+ `stdl` is a collection of Python utilities that complement the standard library.
11
+
12
+ ## Features
13
+
14
+ - File and directory operations
15
+ - String manipulation
16
+ - ANSI color support for terminal output
17
+ - Date and time formatting
18
+ - List utils
19
+ - Lazy imports
20
+ - Logging configuration for `logging` and `loguru`
21
+ - [See docs](https://stdl.readthedocs.io/en/latest/?badge=latest)
22
+
23
+ ## Installation
24
+
25
+ ### Using pip
26
+
27
+ ```sh
28
+ pip install stdl
29
+ ```
30
+
31
+ ### Using uv
32
+
33
+ ```sh
34
+ uv add stdl
35
+ ```
36
+
37
+ ### From source
38
+
39
+ ```sh
40
+ pip install git+https://github.com/zigai/stdl.git
41
+ # or
42
+ uv add git+https://github.com/zigai/stdl.git
43
+ ```
44
+
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
+ ## License
75
+
76
+ [MIT License](https://github.com/zigai/stdl/blob/master/LICENSE)
@@ -6,7 +6,7 @@
6
6
  [![Downloads](https://static.pepy.tech/badge/stdl)](https://pepy.tech/project/stdl)
7
7
  [![license](https://img.shields.io/github/license/zigai/stdl.svg)](https://github.com/zigai/stdl/blob/master/LICENSE)
8
8
 
9
- `stdl` is a collection of Python utilities that complement the standard library.
9
+ `stdl` is a collection of Python utilities that complement the standard library. It provides common functions and tools that developers frequently need, with minimal external dependencies.
10
10
 
11
11
  ## Features
12
12
  - File and directory operations
@@ -0,0 +1 @@
1
+ ::: stdl.color
@@ -0,0 +1 @@
1
+ ::: stdl.decorators
@@ -0,0 +1 @@
1
+ ::: stdl.dt
@@ -0,0 +1 @@
1
+ ::: stdl.fs
@@ -0,0 +1 @@
1
+ ::: stdl.import_lazy
@@ -0,0 +1 @@
1
+ ::: stdl.log
@@ -0,0 +1 @@
1
+ ::: stdl.net
@@ -0,0 +1 @@
1
+ ::: stdl.st
@@ -0,0 +1,4 @@
1
+ mkdocs
2
+ mkdocs-material
3
+ mkdocs-autorefs
4
+ mkdocstrings[python]