semversioner 3.0.2__tar.gz → 3.1.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.
Files changed (21) hide show
  1. {semversioner-3.0.2/semversioner.egg-info → semversioner-3.1.0}/PKG-INFO +2 -29
  2. {semversioner-3.0.2 → semversioner-3.1.0}/pyproject.toml +14 -5
  3. semversioner-3.1.0/semversioner/__version__.py +1 -0
  4. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner/core.py +8 -4
  5. semversioner-3.1.0/semversioner/py.typed +0 -0
  6. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner/storage.py +13 -7
  7. {semversioner-3.0.2 → semversioner-3.1.0/semversioner.egg-info}/PKG-INFO +2 -29
  8. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner.egg-info/SOURCES.txt +1 -0
  9. semversioner-3.1.0/semversioner.egg-info/requires.txt +3 -0
  10. semversioner-3.0.2/semversioner/__version__.py +0 -1
  11. semversioner-3.0.2/semversioner.egg-info/requires.txt +0 -9
  12. {semversioner-3.0.2 → semversioner-3.1.0}/LICENSE +0 -0
  13. {semversioner-3.0.2 → semversioner-3.1.0}/README.md +0 -0
  14. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner/__init__.py +0 -0
  15. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner/__main__.py +0 -0
  16. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner/cli.py +0 -0
  17. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner/models.py +0 -0
  18. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner.egg-info/dependency_links.txt +0 -0
  19. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner.egg-info/entry_points.txt +0 -0
  20. {semversioner-3.0.2 → semversioner-3.1.0}/semversioner.egg-info/top_level.txt +0 -0
  21. {semversioner-3.0.2 → semversioner-3.1.0}/setup.cfg +0 -0
@@ -1,36 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semversioner
3
- Version: 3.0.2
3
+ Version: 3.1.0
4
4
  Summary: Manage properly semver in your repository
5
5
  Author-email: Raul Gomis <raulgomis@gmail.com>
6
- License: MIT License
7
-
8
- Copyright (c) 2020-2026 Raul Gomis
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
6
+ License-Expression: MIT
28
7
  Project-URL: Homepage, https://github.com/raulgomis/semversioner
29
8
  Classifier: Development Status :: 5 - Production/Stable
30
9
  Classifier: Environment :: Console
31
10
  Classifier: Intended Audience :: Developers
32
11
  Classifier: Intended Audience :: End Users/Desktop
33
- Classifier: License :: OSI Approved :: MIT License
34
12
  Classifier: Programming Language :: Python
35
13
  Classifier: Programming Language :: Python :: 3
36
14
  Classifier: Programming Language :: Python :: 3.10
@@ -45,11 +23,6 @@ License-File: LICENSE
45
23
  Requires-Dist: click>=8.0.0
46
24
  Requires-Dist: jinja2>=3.0.0
47
25
  Requires-Dist: packaging>=21.0
48
- Provides-Extra: dev
49
- Requires-Dist: pytest>=9.0.0; extra == "dev"
50
- Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
51
- Requires-Dist: importlib_resources>=6.0.0; extra == "dev"
52
- Requires-Dist: ruff>=0.9.0; extra == "dev"
53
26
  Dynamic: license-file
54
27
 
55
28
  # Semversioner
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0"]
2
+ requires = ["setuptools>=77.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -8,7 +8,8 @@ dynamic = ["version"]
8
8
  description = "Manage properly semver in your repository"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
- license = {file = "LICENSE"}
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
12
13
  authors = [
13
14
  {name = "Raul Gomis", email = "raulgomis@gmail.com"}
14
15
  ]
@@ -17,7 +18,6 @@ classifiers = [
17
18
  "Environment :: Console",
18
19
  "Intended Audience :: Developers",
19
20
  "Intended Audience :: End Users/Desktop",
20
- "License :: OSI Approved :: MIT License",
21
21
  "Programming Language :: Python",
22
22
  "Programming Language :: Python :: 3",
23
23
  "Programming Language :: Python :: 3.10",
@@ -33,12 +33,12 @@ dependencies = [
33
33
  "packaging>=21.0",
34
34
  ]
35
35
 
36
- [project.optional-dependencies]
36
+ [dependency-groups]
37
37
  dev = [
38
38
  "pytest>=9.0.0",
39
39
  "pytest-cov>=6.0.0",
40
- "importlib_resources>=6.0.0",
41
40
  "ruff>=0.9.0",
41
+ "ty>=0.0.1",
42
42
  ]
43
43
 
44
44
  [project.scripts]
@@ -67,3 +67,12 @@ ignore = ["E501"]
67
67
 
68
68
  [tool.ruff.lint.isort]
69
69
  known-first-party = ["semversioner"]
70
+
71
+ [tool.pytest.ini_options]
72
+ testpaths = ["tests"]
73
+
74
+ [tool.coverage.report]
75
+ exclude_also = [
76
+ "@abstractmethod",
77
+ "if __name__ == .__main__.:",
78
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "3.1.0"
@@ -2,7 +2,7 @@ import logging
2
2
  from datetime import datetime, timezone
3
3
  from pathlib import Path
4
4
 
5
- from jinja2 import Template
5
+ from jinja2.sandbox import SandboxedEnvironment
6
6
 
7
7
  from semversioner.models import (
8
8
  Changeset,
@@ -78,9 +78,13 @@ class Semversioner:
78
78
  releases = [x for x in releases if x.version == version]
79
79
 
80
80
  current_version = self.get_last_version()
81
- return Template(template, trim_blocks=True).render(
82
- releases=releases,
83
- current_version=current_version,
81
+ return (
82
+ SandboxedEnvironment(trim_blocks=True)
83
+ .from_string(template)
84
+ .render(
85
+ releases=releases,
86
+ current_version=current_version,
87
+ )
84
88
  )
85
89
 
86
90
  def release(self) -> Release:
File without changes
@@ -4,6 +4,7 @@ import logging
4
4
  from abc import ABCMeta, abstractmethod
5
5
  from datetime import datetime, timezone
6
6
  from pathlib import Path
7
+ from typing import Any
7
8
 
8
9
  from packaging.version import parse
9
10
 
@@ -74,8 +75,8 @@ class EnhancedJSONEncoder(json.JSONEncoder):
74
75
  By default, the json.JSONEncoder class doesn't know how to encode dataclasses, so we define a custom encoding here.
75
76
  """
76
77
 
77
- def default(self, o):
78
- if dataclasses.is_dataclass(o):
78
+ def default(self, o: Any) -> Any:
79
+ if dataclasses.is_dataclass(o) and not isinstance(o, type):
79
80
  return dataclasses.asdict(o, dict_factory=lambda x: {k: v for (k, v) in x if v is not None})
80
81
  return super().default(o)
81
82
 
@@ -99,20 +100,25 @@ class ReleaseJsonMapper:
99
100
  return json.dumps(data, cls=EnhancedJSONEncoder, indent=2, sort_keys=True)
100
101
 
101
102
  @staticmethod
102
- def from_json(data: dict, release_identifier: str) -> Release:
103
+ def from_json(data: dict[str, Any] | list[dict[str, Any]], release_identifier: str) -> Release:
103
104
  """
104
105
  Creates a Release object from a JSON-formatted string.
105
106
  """
106
107
  created_at: datetime | None = None
107
108
 
108
- if "created_at" in data: # New format
109
+ if isinstance(data, dict) and "created_at" in data: # New format
109
110
  created_at = datetime.fromisoformat(data["created_at"])
110
- version = data["version"]
111
- changes = sorted(data["changes"], key=lambda k: k["type"] + k["description"])
111
+ version: str = data["version"]
112
+ raw_changes: list[dict[str, Any]] = data["changes"]
112
113
  else:
113
- changes = sorted(data, key=lambda k: k["type"] + k["description"])
114
+ raw_changes = data if isinstance(data, list) else data["changes"]
114
115
  version = release_identifier
115
116
 
117
+ changes = sorted(
118
+ (Changeset(**change) for change in raw_changes),
119
+ key=lambda k: k.type + k.description,
120
+ )
121
+
116
122
  return Release(version=version, changes=changes, created_at=created_at)
117
123
 
118
124
 
@@ -1,36 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: semversioner
3
- Version: 3.0.2
3
+ Version: 3.1.0
4
4
  Summary: Manage properly semver in your repository
5
5
  Author-email: Raul Gomis <raulgomis@gmail.com>
6
- License: MIT License
7
-
8
- Copyright (c) 2020-2026 Raul Gomis
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
6
+ License-Expression: MIT
28
7
  Project-URL: Homepage, https://github.com/raulgomis/semversioner
29
8
  Classifier: Development Status :: 5 - Production/Stable
30
9
  Classifier: Environment :: Console
31
10
  Classifier: Intended Audience :: Developers
32
11
  Classifier: Intended Audience :: End Users/Desktop
33
- Classifier: License :: OSI Approved :: MIT License
34
12
  Classifier: Programming Language :: Python
35
13
  Classifier: Programming Language :: Python :: 3
36
14
  Classifier: Programming Language :: Python :: 3.10
@@ -45,11 +23,6 @@ License-File: LICENSE
45
23
  Requires-Dist: click>=8.0.0
46
24
  Requires-Dist: jinja2>=3.0.0
47
25
  Requires-Dist: packaging>=21.0
48
- Provides-Extra: dev
49
- Requires-Dist: pytest>=9.0.0; extra == "dev"
50
- Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
51
- Requires-Dist: importlib_resources>=6.0.0; extra == "dev"
52
- Requires-Dist: ruff>=0.9.0; extra == "dev"
53
26
  Dynamic: license-file
54
27
 
55
28
  # Semversioner
@@ -7,6 +7,7 @@ semversioner/__version__.py
7
7
  semversioner/cli.py
8
8
  semversioner/core.py
9
9
  semversioner/models.py
10
+ semversioner/py.typed
10
11
  semversioner/storage.py
11
12
  semversioner.egg-info/PKG-INFO
12
13
  semversioner.egg-info/SOURCES.txt
@@ -0,0 +1,3 @@
1
+ click>=8.0.0
2
+ jinja2>=3.0.0
3
+ packaging>=21.0
@@ -1 +0,0 @@
1
- __version__ = "3.0.2"
@@ -1,9 +0,0 @@
1
- click>=8.0.0
2
- jinja2>=3.0.0
3
- packaging>=21.0
4
-
5
- [dev]
6
- pytest>=9.0.0
7
- pytest-cov>=6.0.0
8
- importlib_resources>=6.0.0
9
- ruff>=0.9.0
File without changes
File without changes
File without changes