modelsdotdev 0.20260514.0__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,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vercel, Inc.
4
+ Model data Copyright (c) 2025 models.dev
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,61 @@
1
+ Metadata-Version: 2.4
2
+ Name: modelsdotdev
3
+ Version: 0.20260514.0
4
+ Summary: An offline models.dev database bundle exposed as a typed Python module.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+
21
+ # modelsdotdev-python
22
+
23
+ An offline [models.dev](https://models.dev) database bundle exposed as a
24
+ Python module.
25
+
26
+ ```python
27
+ from modelsdotdev import get_model_by_id, get_provider_by_name
28
+
29
+ provider = get_provider_by_name("OpenAI")
30
+ model = get_model_by_id("openai/gpt-5.5")
31
+
32
+ if provider is not None:
33
+ provider_model = provider.get_model_by_id("gpt-5.5")
34
+ provider_models = list(provider.iter_models())
35
+ ```
36
+
37
+ ## Development
38
+
39
+ Install dependencies and run the test suite with uv:
40
+
41
+ ```sh
42
+ uv run pytest
43
+ ```
44
+
45
+ Running the test suite refreshes the database used by tests. Editable installs
46
+ refresh the in-tree SQLite database; other installs use a temporary database
47
+ path exposed through `MODELDOTDEV_DATABASE_PATH`. You can also refresh the
48
+ in-tree database explicitly with the Poe task:
49
+
50
+ ```sh
51
+ uv run poe generate-db
52
+ ```
53
+
54
+ Source checkouts do not generate the database during normal imports or editable
55
+ installs. Distribution builds generate it automatically if it is missing so
56
+ published artifacts remain self-contained.
57
+
58
+ ## License
59
+
60
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for
61
+ details.
@@ -0,0 +1,41 @@
1
+ # modelsdotdev-python
2
+
3
+ An offline [models.dev](https://models.dev) database bundle exposed as a
4
+ Python module.
5
+
6
+ ```python
7
+ from modelsdotdev import get_model_by_id, get_provider_by_name
8
+
9
+ provider = get_provider_by_name("OpenAI")
10
+ model = get_model_by_id("openai/gpt-5.5")
11
+
12
+ if provider is not None:
13
+ provider_model = provider.get_model_by_id("gpt-5.5")
14
+ provider_models = list(provider.iter_models())
15
+ ```
16
+
17
+ ## Development
18
+
19
+ Install dependencies and run the test suite with uv:
20
+
21
+ ```sh
22
+ uv run pytest
23
+ ```
24
+
25
+ Running the test suite refreshes the database used by tests. Editable installs
26
+ refresh the in-tree SQLite database; other installs use a temporary database
27
+ path exposed through `MODELDOTDEV_DATABASE_PATH`. You can also refresh the
28
+ in-tree database explicitly with the Poe task:
29
+
30
+ ```sh
31
+ uv run poe generate-db
32
+ ```
33
+
34
+ Source checkouts do not generate the database during normal imports or editable
35
+ installs. Distribution builds generate it automatically if it is missing so
36
+ published artifacts remain self-contained.
37
+
38
+ ## License
39
+
40
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for
41
+ details.
@@ -0,0 +1,106 @@
1
+ """Build hooks for packaging the generated models.dev database."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import importlib
6
+ import sys
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ _ROOT = Path(__file__).resolve().parent
11
+ _SRC = _ROOT / "src"
12
+ _DB_PATH = _SRC / "modelsdotdev" / "_db.sqlite"
13
+
14
+
15
+ def _uv_build() -> Any:
16
+ return importlib.import_module("uv_build")
17
+
18
+
19
+ def _ensure_database() -> None:
20
+ if _DB_PATH.is_file():
21
+ return
22
+
23
+ src = str(_SRC)
24
+ if src not in sys.path:
25
+ sys.path.insert(0, src)
26
+
27
+ sync = importlib.import_module("modelsdotdev._internal.sync")
28
+ sync.generate_database(output=_DB_PATH)
29
+
30
+
31
+ def build_sdist(
32
+ sdist_directory: str,
33
+ config_settings: dict[str, Any] | None = None,
34
+ ) -> str:
35
+ """Build a source distribution after ensuring package data exists."""
36
+ _ensure_database()
37
+ return _uv_build().build_sdist(sdist_directory, config_settings)
38
+
39
+
40
+ def build_wheel(
41
+ wheel_directory: str,
42
+ config_settings: dict[str, Any] | None = None,
43
+ metadata_directory: str | None = None,
44
+ ) -> str:
45
+ """Build a wheel after ensuring package data exists."""
46
+ _ensure_database()
47
+ return _uv_build().build_wheel(
48
+ wheel_directory,
49
+ config_settings,
50
+ metadata_directory,
51
+ )
52
+
53
+
54
+ def build_editable(
55
+ wheel_directory: str,
56
+ config_settings: dict[str, Any] | None = None,
57
+ metadata_directory: str | None = None,
58
+ ) -> str:
59
+ """Build an editable wheel without mutating the source checkout."""
60
+ return _uv_build().build_editable(
61
+ wheel_directory,
62
+ config_settings,
63
+ metadata_directory,
64
+ )
65
+
66
+
67
+ def get_requires_for_build_wheel(
68
+ config_settings: dict[str, Any] | None = None,
69
+ ) -> list[str]:
70
+ """Return additional build requirements for wheel builds."""
71
+ hook = getattr(_uv_build(), "get_requires_for_build_wheel", None)
72
+ if hook is None:
73
+ return []
74
+ return hook(config_settings)
75
+
76
+
77
+ def get_requires_for_build_editable(
78
+ config_settings: dict[str, Any] | None = None,
79
+ ) -> list[str]:
80
+ """Return additional build requirements for editable wheel builds."""
81
+ hook = getattr(_uv_build(), "get_requires_for_build_editable", None)
82
+ if hook is None:
83
+ return []
84
+ return hook(config_settings)
85
+
86
+
87
+ def prepare_metadata_for_build_wheel(
88
+ metadata_directory: str,
89
+ config_settings: dict[str, Any] | None = None,
90
+ ) -> str:
91
+ """Prepare wheel metadata using uv_build."""
92
+ return _uv_build().prepare_metadata_for_build_wheel(
93
+ metadata_directory,
94
+ config_settings,
95
+ )
96
+
97
+
98
+ def prepare_metadata_for_build_editable(
99
+ metadata_directory: str,
100
+ config_settings: dict[str, Any] | None = None,
101
+ ) -> str:
102
+ """Prepare editable wheel metadata using uv_build."""
103
+ return _uv_build().prepare_metadata_for_build_editable(
104
+ metadata_directory,
105
+ config_settings,
106
+ )
@@ -0,0 +1,115 @@
1
+ [project]
2
+ name = "modelsdotdev"
3
+ version = "0.20260514.0"
4
+ description = "An offline models.dev database bundle exposed as a typed Python module."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.12"
9
+ classifiers = [
10
+ "Development Status :: 3 - Alpha",
11
+ "Intended Audience :: Developers",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3 :: Only",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Programming Language :: Python :: 3.14",
19
+ "Topic :: Software Development :: Libraries :: Python Modules",
20
+ "Typing :: Typed",
21
+ ]
22
+
23
+ [build-system]
24
+ requires = ["uv_build>=0.11.0,<0.12"]
25
+ build-backend = "build_backend"
26
+ backend-path = ["."]
27
+
28
+ [tool.uv.build-backend]
29
+ module-root = "src"
30
+ source-include = ["build_backend.py"]
31
+
32
+ [dependency-groups]
33
+ dev = [
34
+ "ty~=0.0.35",
35
+ "mypy~=2.1.0",
36
+ "poethepoet~=0.37.0",
37
+ "pytest~=9.0.3",
38
+ "ruff~=0.15.2",
39
+ ]
40
+
41
+ [tool.poe.tasks]
42
+ generate-db = "python -m modelsdotdev._internal.sync"
43
+
44
+ [tool.mypy]
45
+ python_version = "3.12"
46
+ strict = true
47
+ warn_return_any = true
48
+ warn_unused_configs = true
49
+ mypy_path = ["src"]
50
+ packages = ["modelsdotdev", "tests"]
51
+ explicit_package_bases = true
52
+
53
+ [[tool.mypy.overrides]]
54
+ module = "tests.*"
55
+ disable_error_code = ["unused-ignore"]
56
+
57
+ [tool.ty.environment]
58
+ python-version = "3.12"
59
+ root = ["./src", "./"]
60
+
61
+ [tool.ruff]
62
+ line-length = 80
63
+ indent-width = 4
64
+ target-version = "py312"
65
+ exclude = [
66
+ ".github",
67
+ ".git",
68
+ "build",
69
+ "dist",
70
+ ".eggs",
71
+ ]
72
+
73
+ [tool.ruff.lint]
74
+ preview = true
75
+ extend-select = [
76
+ "B", # flake8-bugbear
77
+ "C4", # flake8-comprehensions
78
+ "D", # pydocstyle
79
+ "E", # error
80
+ "ERA", # flake8-eradicate
81
+ "F", # pyflakes
82
+ "FBT", # flake8-boolean-trap
83
+ "G", # flake8-logging-format
84
+ "I", # isort
85
+ "N", # pep8-naming
86
+ "PGH", # pygrep-hooks
87
+ "PIE", # flake8-pie
88
+ "PLE", # pylint-error
89
+ "PLW", # pylint-warning
90
+ "PLC", # pylint-convention
91
+ "RUF", # ruff specific
92
+ "SIM", # flake8-simplify
93
+ "T20", # flake8-print
94
+ "TC", # flake8-type-checking
95
+ "UP", # pyupgrade
96
+ "W", # warning
97
+ ]
98
+
99
+ extend-ignore = [
100
+ "D203", # incorrect-blank-line-before-class
101
+ "D213", # multi-line-summary-second-line
102
+ "F541", # f-string-missing-placeholders
103
+ "PLW1514", # unspecified-encoding (UTF-8 is Python 3 default)
104
+ "PLW2901", # redefined-loop-name (intentional pattern for line processing)
105
+ ]
106
+
107
+ [tool.ruff.lint.per-file-ignores]
108
+ "tests/**/*.py" = [
109
+ "D", # docstrings not required in tests
110
+ "PLC2701", # allow private imports in tests
111
+ ]
112
+
113
+ [tool.pytest.ini_options]
114
+ testpaths = ["tests"]
115
+ pythonpath = ["src"]
@@ -0,0 +1 @@
1
+ _db.sqlite
@@ -0,0 +1,43 @@
1
+ """Typed offline interface for an offline models.dev database."""
2
+
3
+ from modelsdotdev._internal.data import (
4
+ Capability,
5
+ Cost,
6
+ ExperimentalMode,
7
+ Limits,
8
+ Modalities,
9
+ Modality,
10
+ Model,
11
+ ModelProviderConfig,
12
+ ModelRef,
13
+ Provider,
14
+ ProviderAPIShape,
15
+ Status,
16
+ get_model_by_id,
17
+ get_provider_by_id,
18
+ get_provider_by_name,
19
+ iter_models,
20
+ iter_providers,
21
+ parse_model_id,
22
+ )
23
+
24
+ __all__ = [
25
+ "Capability",
26
+ "Cost",
27
+ "ExperimentalMode",
28
+ "Limits",
29
+ "Modalities",
30
+ "Modality",
31
+ "Model",
32
+ "ModelProviderConfig",
33
+ "ModelRef",
34
+ "Provider",
35
+ "ProviderAPIShape",
36
+ "Status",
37
+ "get_model_by_id",
38
+ "get_provider_by_id",
39
+ "get_provider_by_name",
40
+ "iter_models",
41
+ "iter_providers",
42
+ "parse_model_id",
43
+ ]