lazyscribe-onnx 0.1.2__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.
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: lazyscribe-onnx
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: ONNX model artifact handling for lazyscribe
|
|
5
|
+
Author: Akshay Gupta
|
|
6
|
+
Author-email: Akshay Gupta <akgcodes@gmail.com>
|
|
7
|
+
License: MIT license
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
22
|
+
Classifier: Topic :: Software Development
|
|
23
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
24
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
25
|
+
Requires-Dist: attrs>=21.2.0,<=26.1.0
|
|
26
|
+
Requires-Dist: lazyscribe>=2.0.0,<=2.2.1,!=3
|
|
27
|
+
Requires-Dist: onnx>=1.12.0,<=1.21.0
|
|
28
|
+
Requires-Dist: python-slugify>=5.0.0,<=8.0.4
|
|
29
|
+
Requires-Dist: commitizen ; extra == 'build'
|
|
30
|
+
Requires-Dist: uv ; extra == 'build'
|
|
31
|
+
Requires-Dist: lazyscribe-onnx[build] ; extra == 'dev'
|
|
32
|
+
Requires-Dist: lazyscribe-onnx[qa] ; extra == 'dev'
|
|
33
|
+
Requires-Dist: lazyscribe-onnx[tests] ; extra == 'dev'
|
|
34
|
+
Requires-Dist: edgetest>=2026.5.0 ; extra == 'qa'
|
|
35
|
+
Requires-Dist: mypy ; extra == 'qa'
|
|
36
|
+
Requires-Dist: pre-commit ; extra == 'qa'
|
|
37
|
+
Requires-Dist: pre-commit-uv ; extra == 'qa'
|
|
38
|
+
Requires-Dist: pyproject-fmt ; extra == 'qa'
|
|
39
|
+
Requires-Dist: ruff ; extra == 'qa'
|
|
40
|
+
Requires-Dist: types-python-slugify ; extra == 'qa'
|
|
41
|
+
Requires-Dist: pytest ; extra == 'tests'
|
|
42
|
+
Requires-Dist: pytest-cov ; extra == 'tests'
|
|
43
|
+
Requires-Dist: time-machine ; extra == 'tests'
|
|
44
|
+
Requires-Python: >=3.10.0
|
|
45
|
+
Project-URL: Documentation, https://github.com/lazyscribe/lazyscribe-onnx
|
|
46
|
+
Project-URL: Repository, https://github.com/lazyscribe/lazyscribe-onnx
|
|
47
|
+
Provides-Extra: build
|
|
48
|
+
Provides-Extra: dev
|
|
49
|
+
Provides-Extra: qa
|
|
50
|
+
Provides-Extra: tests
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""Define the custom handler."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import Any, ClassVar
|
|
5
|
+
|
|
6
|
+
import onnx
|
|
7
|
+
from attrs import define
|
|
8
|
+
from lazyscribe._utils import utcnow
|
|
9
|
+
from lazyscribe.artifacts.base import Artifact
|
|
10
|
+
from slugify import slugify
|
|
11
|
+
|
|
12
|
+
__all__: list[str] = ["ONNXArtifact"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@define(auto_attribs=True) # noqa: RUF067
|
|
16
|
+
class ONNXArtifact(Artifact):
|
|
17
|
+
"""Handler for ONNX model objects."""
|
|
18
|
+
|
|
19
|
+
alias: ClassVar[str] = "onnx"
|
|
20
|
+
suffix: ClassVar[str] = "onnx"
|
|
21
|
+
binary: ClassVar[bool] = True
|
|
22
|
+
output_only: ClassVar[bool] = False
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def construct(
|
|
26
|
+
cls,
|
|
27
|
+
name: str,
|
|
28
|
+
value: Any | None = None,
|
|
29
|
+
fname: str | None = None,
|
|
30
|
+
created_at: datetime | None = None,
|
|
31
|
+
expiry: datetime | None = None,
|
|
32
|
+
writer_kwargs: dict | None = None,
|
|
33
|
+
version: int = 0,
|
|
34
|
+
dirty: bool = True,
|
|
35
|
+
**kwargs,
|
|
36
|
+
):
|
|
37
|
+
"""Construct the handler class."""
|
|
38
|
+
created_at = created_at or utcnow()
|
|
39
|
+
return cls( # type: ignore[call-arg]
|
|
40
|
+
name=name,
|
|
41
|
+
value=value,
|
|
42
|
+
fname=fname
|
|
43
|
+
or f"{slugify(name)}-{slugify(created_at.strftime('%Y%m%d%H%M%S'))}.{cls.suffix}",
|
|
44
|
+
writer_kwargs=writer_kwargs or {},
|
|
45
|
+
version=version,
|
|
46
|
+
created_at=created_at,
|
|
47
|
+
expiry=expiry,
|
|
48
|
+
dirty=dirty,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def read(cls, buf, **kwargs):
|
|
53
|
+
"""Read in the artifact.
|
|
54
|
+
|
|
55
|
+
Parameters
|
|
56
|
+
----------
|
|
57
|
+
buf : file-like object
|
|
58
|
+
The buffer from a ``fsspec`` filesystem.
|
|
59
|
+
**kwargs
|
|
60
|
+
Keyword arguments for the read method.
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
Any
|
|
65
|
+
The artifact.
|
|
66
|
+
"""
|
|
67
|
+
return onnx.load(buf, **kwargs)
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def write(cls, obj, buf, **kwargs):
|
|
71
|
+
"""Write the content to an ONNX file.
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
obj : object
|
|
76
|
+
The ONNX-serializable object.
|
|
77
|
+
buf : file-like object
|
|
78
|
+
The buffer from a ``fsspec`` filesystem.
|
|
79
|
+
**kwargs
|
|
80
|
+
Keyword arguments for :py:meth:`onnx.save`.
|
|
81
|
+
"""
|
|
82
|
+
onnx.save(obj, buf, **kwargs)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "uv_build"
|
|
3
|
+
requires = [ "uv-build>=0.8.0,<=0.9.5" ]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "lazyscribe-onnx"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "ONNX model artifact handling for lazyscribe"
|
|
9
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
+
license = { text = "MIT license" }
|
|
11
|
+
authors = [ { name = "Akshay Gupta", email = "akgcodes@gmail.com" } ]
|
|
12
|
+
requires-python = ">=3.10.0"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Natural Language :: English",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
25
|
+
"Programming Language :: Python :: Free Threading :: 2 - Beta",
|
|
26
|
+
"Topic :: Scientific/Engineering",
|
|
27
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
28
|
+
"Topic :: Software Development",
|
|
29
|
+
"Topic :: Software Development :: Build Tools",
|
|
30
|
+
"Topic :: Software Development :: Documentation",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"attrs<=26.1.0,>=21.2.0",
|
|
34
|
+
"lazyscribe!=3,<=2.2.1,>=2.0.0",
|
|
35
|
+
"onnx<=1.21.0,>=1.12.0",
|
|
36
|
+
"python-slugify<=8.0.4,>=5.0.0",
|
|
37
|
+
]
|
|
38
|
+
optional-dependencies.build = [ "commitizen", "uv" ]
|
|
39
|
+
optional-dependencies.dev = [
|
|
40
|
+
"lazyscribe-onnx[build]",
|
|
41
|
+
"lazyscribe-onnx[qa]",
|
|
42
|
+
"lazyscribe-onnx[tests]"
|
|
43
|
+
]
|
|
44
|
+
optional-dependencies.qa = [
|
|
45
|
+
"edgetest>=2026.5.0",
|
|
46
|
+
"mypy",
|
|
47
|
+
"pre-commit",
|
|
48
|
+
"pre-commit-uv",
|
|
49
|
+
"pyproject-fmt",
|
|
50
|
+
"ruff",
|
|
51
|
+
"types-python-slugify",
|
|
52
|
+
]
|
|
53
|
+
optional-dependencies.tests = [ "pytest", "pytest-cov", "time-machine" ]
|
|
54
|
+
urls.Documentation = "https://github.com/lazyscribe/lazyscribe-onnx"
|
|
55
|
+
urls.Repository = "https://github.com/lazyscribe/lazyscribe-onnx"
|
|
56
|
+
entry-points."lazyscribe.artifact_type".onnx = "lazyscribe_onnx:ONNXArtifact"
|
|
57
|
+
|
|
58
|
+
[tool.uv]
|
|
59
|
+
build-backend.module-name = "lazyscribe_onnx"
|
|
60
|
+
build-backend.module-root = ""
|
|
61
|
+
|
|
62
|
+
[tool.ruff]
|
|
63
|
+
target-version = "py310"
|
|
64
|
+
lint.select = [
|
|
65
|
+
"B", # flake8-bugbear
|
|
66
|
+
"C", # flake8-comprehensions
|
|
67
|
+
"D", # pydocstyle
|
|
68
|
+
"E", # pycodestyle errors
|
|
69
|
+
"F", # pyflakes
|
|
70
|
+
"I", # isort
|
|
71
|
+
"LOG", # flake8-logging
|
|
72
|
+
"RUF", # Ruff errors
|
|
73
|
+
"SIM", # flake8-simplify
|
|
74
|
+
"T20", # flake8-print
|
|
75
|
+
"TID252", # flake8-tidy-imports ban relative imports
|
|
76
|
+
"UP", # pyupgrade
|
|
77
|
+
"W", # pycodestyle warnings
|
|
78
|
+
]
|
|
79
|
+
lint.ignore = [
|
|
80
|
+
"C901", # Function/method is too complex. (Add back in later.)
|
|
81
|
+
"E501", # Line too long. Using formatter instead.
|
|
82
|
+
]
|
|
83
|
+
lint.per-file-ignores."**/{tests,docs}/*" = [ "ARG", "D", "E402", "F841" ]
|
|
84
|
+
lint.per-file-ignores."__init__.py" = [ "E402" ]
|
|
85
|
+
lint.per-file-ignores."tutorials/*" = [ "D", "T201" ]
|
|
86
|
+
lint.flake8-tidy-imports.ban-relative-imports = "all"
|
|
87
|
+
lint.pydocstyle.convention = "numpy"
|
|
88
|
+
lint.preview = true
|
|
89
|
+
|
|
90
|
+
[tool.pyproject-fmt]
|
|
91
|
+
column_width = 88
|
|
92
|
+
indent = 4
|
|
93
|
+
keep_full_version = true
|
|
94
|
+
max_supported_python = "3.14"
|
|
95
|
+
|
|
96
|
+
[tool.mypy]
|
|
97
|
+
python_version = "3.10"
|
|
98
|
+
warn_return_any = true
|
|
99
|
+
warn_unused_configs = true
|
|
100
|
+
ignore_missing_imports = true
|
|
101
|
+
allow_redefinition = true
|
|
102
|
+
check_untyped_defs = true
|
|
103
|
+
|
|
104
|
+
[tool.commitizen]
|
|
105
|
+
version_provider = "uv"
|
|
106
|
+
tag_format = "v$version"
|
|
107
|
+
update_changelog_on_bump = true
|
|
108
|
+
version_files = [
|
|
109
|
+
"lazyscribe_onnx/_meta.py:__version__",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[tool.edgetest]
|
|
113
|
+
exclude_newer = "3 days"
|
|
114
|
+
|
|
115
|
+
[[tool.edgetest.env]]
|
|
116
|
+
name = "core"
|
|
117
|
+
extras = [ "tests" ]
|
|
118
|
+
upgrade = [ "attrs", "lazyscribe", "onnx", "python-slugify" ]
|
|
119
|
+
command = "pytest tests"
|