tinydantic 0.1.0__tar.gz → 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.
@@ -56,6 +56,8 @@ jobs:
56
56
  if: github.repository_owner == 'cdwilson'
57
57
  needs:
58
58
  - publish-to-pypi
59
+ permissions:
60
+ contents: write
59
61
  runs-on: ubuntu-latest
60
62
  steps:
61
63
  - name: Download package dists
@@ -42,6 +42,9 @@ jobs:
42
42
  - name: Install Hatch
43
43
  run: pip install --upgrade hatch
44
44
 
45
+ - name: Run pre-commit checks
46
+ run: hatch run pre-commit:check
47
+
45
48
  - name: Run static analysis
46
49
  run: hatch fmt --check
47
50
 
@@ -2,28 +2,41 @@
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0 OR MIT
4
4
 
5
+ default_install_hook_types:
6
+ - pre-commit
7
+ - commit-msg
8
+
5
9
  repos:
6
10
  - repo: https://github.com/pre-commit/pre-commit-hooks
7
11
  rev: v4.6.0
8
12
  hooks:
9
- - id: trailing-whitespace
10
- args: [--markdown-linebreak-ext=md]
13
+ - id: check-ast
14
+ - id: check-docstring-first
11
15
  - id: check-executables-have-shebangs
16
+ - id: check-json
12
17
  - id: check-merge-conflict
13
18
  - id: check-shebang-scripts-are-executable
14
19
  - id: check-symlinks
20
+ - id: check-toml
21
+ - id: check-xml
22
+ - id: check-yaml
23
+ args: [--allow-multiple-documents]
15
24
  - id: debug-statements
16
25
  - id: destroyed-symlinks
17
26
  - id: detect-aws-credentials
18
27
  args: [--allow-missing-credentials]
19
28
  - id: detect-private-key
20
29
  - id: end-of-file-fixer
30
+ - id: name-tests-test
31
+ args: [--pytest-test-first]
32
+ - id: trailing-whitespace
33
+ args: [--markdown-linebreak-ext=md]
21
34
  - repo: https://github.com/fsfe/reuse-tool
22
35
  rev: v4.0.3
23
36
  hooks:
24
37
  - id: reuse
25
38
  - repo: https://github.com/astral-sh/ruff-pre-commit
26
- rev: v0.5.2
39
+ rev: v0.5.4
27
40
  hooks:
28
41
  - id: ruff
29
42
  args: [--fix]
@@ -31,6 +44,15 @@ repos:
31
44
  # Experimental taplo support
32
45
  # https://github.com/ComPWA/mirrors-taplo/issues/13#issuecomment-1930749688
33
46
  - repo: https://github.com/redeboer/taplo-pre-commit
34
- rev: v0.9.1rc1
47
+ rev: 0.9.1rc1
35
48
  hooks:
36
49
  - id: taplo
50
+ - repo: https://github.com/commitizen-tools/commitizen
51
+ rev: v3.28.0
52
+ hooks:
53
+ - id: commitizen
54
+ - repo: https://github.com/econchick/interrogate
55
+ rev: 1.7.0
56
+ hooks:
57
+ - id: interrogate
58
+ pass_filenames: false
@@ -0,0 +1,21 @@
1
+ # SPDX-FileCopyrightText: Chris Wilson <christopher.david.wilson@gmail.com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0 OR MIT
4
+
5
+ version: 2
6
+
7
+ build:
8
+ os: ubuntu-24.04
9
+ tools:
10
+ python: "3.12"
11
+
12
+ python:
13
+ install:
14
+ - method: pip
15
+ path: .
16
+ extra_requirements:
17
+ - doc
18
+
19
+ mkdocs:
20
+ configuration: mkdocs.yml
21
+ fail_on_warning: true
@@ -7,6 +7,8 @@
7
7
  "ms-python.vscode-pylance",
8
8
  "ms-python.debugpy",
9
9
  "trond-snekvik.simple-rst",
10
- "redhat.vscode-yaml"
10
+ "redhat.vscode-yaml",
11
+ "kennethlove.interrogate",
12
+ "vivaxy.vscode-conventional-commits"
11
13
  ]
12
14
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tinydantic
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Project-URL: Documentation, https://github.com/cdwilson/tinydantic#readme
5
5
  Project-URL: Issues, https://github.com/cdwilson/tinydantic/issues
6
6
  Project-URL: Source, https://github.com/cdwilson/tinydantic
@@ -19,6 +19,29 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
21
  Requires-Python: >=3.8
22
+ Provides-Extra: compliance
23
+ Requires-Dist: reuse>=4.0.0; extra == 'compliance'
24
+ Provides-Extra: dev
25
+ Requires-Dist: commitizen; extra == 'dev'
26
+ Requires-Dist: interrogate; extra == 'dev'
27
+ Requires-Dist: mkdocs-material; extra == 'dev'
28
+ Requires-Dist: mkdocstrings; extra == 'dev'
29
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
30
+ Requires-Dist: packaging; extra == 'dev'
31
+ Requires-Dist: pre-commit; extra == 'dev'
32
+ Requires-Dist: reuse>=4.0.0; extra == 'dev'
33
+ Requires-Dist: ruff; extra == 'dev'
34
+ Requires-Dist: uv; extra == 'dev'
35
+ Provides-Extra: doc
36
+ Requires-Dist: mkdocs-material; extra == 'doc'
37
+ Requires-Dist: mkdocstrings; extra == 'doc'
38
+ Provides-Extra: pre-commit
39
+ Requires-Dist: pre-commit; extra == 'pre-commit'
40
+ Provides-Extra: test
41
+ Requires-Dist: packaging; extra == 'test'
42
+ Provides-Extra: types
43
+ Requires-Dist: mypy>=1.0.0; extra == 'types'
44
+ Requires-Dist: packaging; extra == 'types'
22
45
  Description-Content-Type: text/markdown
23
46
 
24
47
  # tinydantic
@@ -20,6 +20,6 @@ precedence = "aggregate"
20
20
  SPDX-FileCopyrightText = "Chris Wilson <christopher.david.wilson@gmail.com>"
21
21
  SPDX-License-Identifier = "CC-BY-4.0"
22
22
  path = [
23
- "*.md",
23
+ "**.md",
24
24
  ]
25
25
  precedence = "aggregate"
@@ -0,0 +1 @@
1
+ # Get Started
@@ -0,0 +1,11 @@
1
+ # SPDX-FileCopyrightText: Chris Wilson <christopher.david.wilson@gmail.com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0 OR MIT
4
+
5
+ site_name: tinydantic
6
+ site_url: https://cdwilson.github.io/tinydantic
7
+ theme:
8
+ name: material
9
+ plugins:
10
+ - search
11
+ - mkdocstrings
@@ -42,6 +42,42 @@ name = "tinydantic"
42
42
  readme = "README.md"
43
43
  requires-python = ">=3.8"
44
44
 
45
+ [project.optional-dependencies]
46
+ compliance = [
47
+ "reuse>=4.0.0",
48
+ ]
49
+ dev = [
50
+ "commitizen",
51
+ "interrogate",
52
+ "ruff",
53
+ "tinydantic[compliance,doc,pre-commit,test,types]",
54
+ "uv",
55
+ ]
56
+ # "doc" is the reserved feature name to mark dependencies needed for generating
57
+ # documentation:
58
+ # https://packaging.python.org/en/latest/specifications/core-metadata/#provides-extra-multiple-use
59
+ #
60
+ # TODO(cdwilson): should this be changed to "docs"? "docs" appears to be more
61
+ # popular than "doc":
62
+ # https://github.com/scientific-python/specs/pull/324#issuecomment-2150738534
63
+ doc = [
64
+ "mkdocs-material",
65
+ "mkdocstrings",
66
+ ]
67
+ pre-commit = [
68
+ "pre-commit",
69
+ ]
70
+ # "test" is the reserved feature name to mark dependencies needed for running
71
+ # automated tests:
72
+ # https://packaging.python.org/en/latest/specifications/core-metadata/#provides-extra-multiple-use
73
+ test = [
74
+ "packaging",
75
+ ]
76
+ types = [
77
+ "mypy>=1.0.0",
78
+ "packaging", # TODO(cdwilson): this is duplicated in test
79
+ ]
80
+
45
81
  [project.urls]
46
82
  Documentation = "https://github.com/cdwilson/tinydantic#readme"
47
83
  Issues = "https://github.com/cdwilson/tinydantic/issues"
@@ -51,27 +87,50 @@ Source = "https://github.com/cdwilson/tinydantic"
51
87
  raw-options = { local_scheme = "no-local-version" }
52
88
  source = "vcs"
53
89
 
90
+ [tool.hatch.envs.compliance]
91
+ features = [
92
+ "compliance",
93
+ ]
94
+
95
+ [tool.hatch.envs.compliance.scripts]
96
+ check = "reuse lint"
97
+ sbom = "reuse spdx -o reuse.spdx"
98
+
54
99
  [tool.hatch.envs.default]
55
- dependencies = [
56
- "packaging",
57
- "pytest",
58
- "reuse",
59
- 'typing-extensions; python_version < "3.11"',
100
+ features = [
101
+ "dev",
102
+ ]
103
+
104
+ [tool.hatch.envs.doc]
105
+ features = [
106
+ "doc",
107
+ ]
108
+
109
+ # TODO(cdwilson): remove this when https://github.com/pypa/hatch/issues/1553
110
+ # is implemented
111
+ [tool.hatch.envs.hatch-test]
112
+ features = [
113
+ "test",
60
114
  ]
61
115
 
62
116
  [tool.hatch.envs.types]
63
- extra-dependencies = [
64
- "mypy>=1.0.0",
117
+ features = [
118
+ "types",
65
119
  ]
66
120
 
67
121
  [tool.hatch.envs.types.scripts]
68
122
  check = "mypy --install-types --non-interactive {args:src/tinydantic tests}"
69
123
 
124
+ [tool.hatch.envs.pre-commit]
125
+ features = [
126
+ "pre-commit",
127
+ ]
128
+
129
+ [tool.hatch.envs.pre-commit.scripts]
130
+ check = "pre-commit run --all-files"
131
+
70
132
  [tool.coverage.run]
71
133
  branch = true
72
- omit = [
73
- "src/tinydantic/__about__.py",
74
- ]
75
134
  parallel = true
76
135
  source_pkgs = [
77
136
  "tests",
@@ -135,10 +194,6 @@ ignore = [
135
194
  "Q002", # https://docs.astral.sh/ruff/rules/bad-quotes-docstring/
136
195
  "Q003", # https://docs.astral.sh/ruff/rules/avoidable-escaped-quote/
137
196
  "W191", # https://docs.astral.sh/ruff/rules/tab-indentation/
138
-
139
- # TODO @cdwilson: these are temporary, remove them before release
140
- "D",
141
- "ERA001",
142
197
  ]
143
198
  select = [
144
199
  "ALL",
@@ -189,3 +244,21 @@ ban-relative-imports = "all" # https://docs.astral.sh/ruff/settings/#lint_flake8
189
244
  [tool.ruff.lint.flake8-pytest-style]
190
245
  fixture-parentheses = false
191
246
  mark-parentheses = false
247
+
248
+ [tool.commitizen]
249
+ major_version_zero = true
250
+ name = "cz_conventional_commits"
251
+ tag_format = "v$version"
252
+ version_provider = "scm"
253
+ version_scheme = "semver2"
254
+
255
+ [tool.interrogate]
256
+ exclude = [
257
+ ".hatch",
258
+ ]
259
+ fail-under = 100
260
+ ignore-private = true
261
+ ignore-semiprivate = true
262
+ omit-covered-files = true
263
+ style = "google"
264
+ verbose = 2
@@ -1,3 +1,5 @@
1
1
  # SPDX-FileCopyrightText: Chris Wilson <christopher.david.wilson@gmail.com>
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0 OR MIT
4
+
5
+ """Tests for the ``tinydantic`` package."""
@@ -0,0 +1,30 @@
1
+ # SPDX-FileCopyrightText: Chris Wilson <christopher.david.wilson@gmail.com>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0 OR MIT
4
+
5
+ """Version tests."""
6
+
7
+ from importlib import metadata
8
+
9
+ from packaging.version import parse
10
+
11
+ from tinydantic import __version__
12
+
13
+
14
+ class TestPackageVersion:
15
+ """Package version tests."""
16
+
17
+ def test_version_is_a_string(self):
18
+ """Package version is a string."""
19
+ assert isinstance(__version__, str)
20
+
21
+ def test_version_matches_metadata_version(self):
22
+ """Package version matches installed metadata."""
23
+ assert __version__ == metadata.version("tinydantic")
24
+
25
+ def test_version_is_valid(self):
26
+ """Package version is compliant with PyPA Version specifiers.
27
+
28
+ See https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers
29
+ """
30
+ parse(__version__)
@@ -1,20 +0,0 @@
1
- # SPDX-FileCopyrightText: Chris Wilson <christopher.david.wilson@gmail.com>
2
- #
3
- # SPDX-License-Identifier: Apache-2.0 OR MIT
4
-
5
- from importlib.metadata import version
6
-
7
- from packaging.version import parse
8
-
9
- from tinydantic import __version__
10
-
11
-
12
- class TestVersion:
13
- def test_version_is_a_string(self):
14
- assert isinstance(__version__, str)
15
-
16
- def test_version_matches_metadata_version(self):
17
- assert __version__ == version("tinydantic")
18
-
19
- def test_version_is_valid(self):
20
- parse(__version__)
File without changes
File without changes
File without changes
File without changes
File without changes