autopub 1.0.0a3__py3-none-any.whl → 1.0.0a5__py3-none-any.whl

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.
autopub/__init__.py CHANGED
@@ -44,7 +44,6 @@ class Autopub:
44
44
  def release_data_file(self) -> Path:
45
45
  return Path(".autopub") / "release_data.json"
46
46
 
47
- # TODO: typed dict
48
47
  @property
49
48
  def release_data(self) -> ReleaseInfo:
50
49
  if not self.release_data_file.exists():
@@ -95,6 +94,16 @@ class Autopub:
95
94
  for plugin in self.plugins:
96
95
  plugin.prepare(self.release_data)
97
96
 
97
+ self._write_artifact(self.release_data)
98
+
99
+ for plugin in self.plugins:
100
+ plugin.post_prepare(self.release_data)
101
+
102
+ self._write_artifact(self.release_data)
103
+
104
+ def _delete_release_file(self) -> None:
105
+ self.release_file.unlink()
106
+
98
107
  def publish(self, repository: str | None = None) -> None:
99
108
  # TODO: shall we put this in a function, to make it
100
109
  # clear that we are triggering the logic to check the release file?
@@ -104,6 +113,11 @@ class Autopub:
104
113
  if isinstance(plugin, AutopubPackageManagerPlugin):
105
114
  plugin.publish(repository=repository)
106
115
 
116
+ for plugin in self.plugins:
117
+ plugin.post_publish()
118
+
119
+ self._delete_release_file()
120
+
107
121
  def _write_artifact(self, release_info: ReleaseInfo) -> None:
108
122
  data = {
109
123
  "hash": self.release_file_hash,
autopub/cli/__init__.py CHANGED
@@ -111,7 +111,7 @@ def main(
111
111
  ] = None,
112
112
  ):
113
113
  state["plugins"] = plugins
114
- state["plugins"].extend(["bump_version"])
114
+ state["plugins"].extend(["update_changelog", "bump_version"])
115
115
 
116
116
  if should_show_version:
117
117
  from importlib.metadata import version
@@ -19,6 +19,9 @@ class AutopubPlugin:
19
19
  def prepare(self, release_info: ReleaseInfo) -> None: # pragma: no cover
20
20
  ...
21
21
 
22
+ def post_prepare(self, release_info: ReleaseInfo) -> None: # pragma: no cover
23
+ ...
24
+
22
25
  def validate_release_notes(self, release_info: ReleaseInfo): # pragma: no cover
23
26
  ...
24
27
 
@@ -28,6 +31,9 @@ class AutopubPlugin:
28
31
  def on_release_notes_invalid(self, exception: AutopubException): # pragma: no cover
29
32
  ...
30
33
 
34
+ def post_publish(self) -> None: # pragma: no cover
35
+ ...
36
+
31
37
 
32
38
  @runtime_checkable
33
39
  class AutopubPackageManagerPlugin(Protocol):
@@ -36,6 +36,9 @@ class BumpVersionPlugin(AutopubPlugin):
36
36
  bump_type = {"major": 0, "minor": 1, "patch": 2}[release_info.release_type]
37
37
  new_version = version.bump(bump_type).serialize()
38
38
 
39
+ self.data["old_version"] = version.serialize()
40
+ self.data["new_version"] = new_version
41
+
39
42
  self._update_version(config, new_version)
40
43
 
41
44
  pathlib.Path("pyproject.toml").write_text(tomlkit.dumps(config)) # type: ignore
@@ -17,7 +17,7 @@ class UpdateChangelogPlugin(AutopubPlugin):
17
17
  return Path("CHANGELOG.md")
18
18
 
19
19
  def post_prepare(self, release_info: ReleaseInfo) -> None:
20
- assert release_info.version is not None
20
+ assert release_info.additional_info["new_version"]
21
21
 
22
22
  if not self.changelog_file.exists():
23
23
  self.changelog_file.write_text(f"CHANGELOG\n{CHANGELOG_HEADER}\n\n")
@@ -37,11 +37,13 @@ class UpdateChangelogPlugin(AutopubPlugin):
37
37
  header = lines[: index + 1]
38
38
  break
39
39
 
40
+ new_version = release_info.additional_info["new_version"]
41
+
40
42
  with self.changelog_file.open("w") as f:
41
43
  f.write("\n".join(header))
42
44
  f.write("\n")
43
45
 
44
- new_version_header = f"{release_info.version} - {current_date}"
46
+ new_version_header = f"{new_version} - {current_date}"
45
47
 
46
48
  f.write(f"\n{new_version_header}\n")
47
49
  f.write(f"{VERSION_HEADER * len(new_version_header)}\n\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autopub
3
- Version: 1.0.0a3
3
+ Version: 1.0.0a5
4
4
  Summary: Automatic package release upon pull request merge
5
5
  Home-page: https://github.com/autopub/autopub
6
6
  License: AGPL-3.0
@@ -0,0 +1,16 @@
1
+ autopub/__init__.py,sha256=qEStdLBp3kmz78ThFjI_xDJeITDDli5U_zyZ6ZhBZ-w,5927
2
+ autopub/cli/__init__.py,sha256=8FKaFRqJ0lsxoN54x1y4UPBlIgV276KY4Sad_HCiFIc,3000
3
+ autopub/cli/plugins.py,sha256=0wzL1ipSrNWh2hi2fp0k0HL15GPncSqKgt15tHRM_pw,1117
4
+ autopub/exceptions.py,sha256=JYn8sIYWCedhtO3XfftZ0M5M_rAPxiGQ4MGbWUaTYwE,1243
5
+ autopub/plugins/__init__.py,sha256=qI1WFfdkZVSuZjuhfhdB7MW3UTxA7c9YIKf3GxquVXY,1318
6
+ autopub/plugins/bump_version.py,sha256=rNKczSd9lxR7uhzugH7pppq4k1Q8oaVN_WApxk4xDSU,1441
7
+ autopub/plugins/pdm.py,sha256=Pczye06fKg8_HMJDkEfMXQyvao9rZ7sqzTHFd6lLEpU,532
8
+ autopub/plugins/poetry.py,sha256=d2LvW9RI7ZB3reBOXbcp1mqWmzQ06Uyg_T-MxTvlSBg,517
9
+ autopub/plugins/update_changelog.py,sha256=PVFww5CG9XsF8lNyIhSlOWA7CkjpmPCWiBxUOI90RIg,1525
10
+ autopub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ autopub/types.py,sha256=FcRH4l27nrkQFUQrbAKxNzPPJfzg_0DExZYsCu9Jdzk,249
12
+ autopub-1.0.0a5.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
13
+ autopub-1.0.0a5.dist-info/METADATA,sha256=zuiANMRC0TqMphmBbr4ILEhgFluHbT_jMZA5METiE_M,3757
14
+ autopub-1.0.0a5.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
15
+ autopub-1.0.0a5.dist-info/entry_points.txt,sha256=oeTav5NgCxif6mcZ_HeVGgGv5LzS4DwdI01nr4bO1IM,43
16
+ autopub-1.0.0a5.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- autopub/__init__.py,sha256=zcNp8aJE_jo-D5xvDuWNZ-ZK6c67NqbTaKtwfGJWtZs,5576
2
- autopub/cli/__init__.py,sha256=XG1QVlKPv7svwFOcuosBzXr9AIy9xKDTuOPfI14dtBs,2980
3
- autopub/cli/plugins.py,sha256=0wzL1ipSrNWh2hi2fp0k0HL15GPncSqKgt15tHRM_pw,1117
4
- autopub/exceptions.py,sha256=JYn8sIYWCedhtO3XfftZ0M5M_rAPxiGQ4MGbWUaTYwE,1243
5
- autopub/plugins/__init__.py,sha256=HtnCcxvZqTUC79vs5aVpNHenRCNuTPpz1gAu2OYkCzg,1153
6
- autopub/plugins/bump_version.py,sha256=p-_q80pJDCUy-fKhp-9_9HWTWC2pKe2lFJnimuHHH7w,1338
7
- autopub/plugins/pdm.py,sha256=Pczye06fKg8_HMJDkEfMXQyvao9rZ7sqzTHFd6lLEpU,532
8
- autopub/plugins/poetry.py,sha256=d2LvW9RI7ZB3reBOXbcp1mqWmzQ06Uyg_T-MxTvlSBg,517
9
- autopub/plugins/update_changelog.py,sha256=MmDBGFs6v8zPn3NCfUumpF8YODhg5x2AdjyTzgq5bYQ,1456
10
- autopub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- autopub/types.py,sha256=FcRH4l27nrkQFUQrbAKxNzPPJfzg_0DExZYsCu9Jdzk,249
12
- autopub-1.0.0a3.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
13
- autopub-1.0.0a3.dist-info/METADATA,sha256=_HTF8W7KaobHX_Bbk_TMcJfvN_qf74J07SFy2DfVqUk,3757
14
- autopub-1.0.0a3.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
15
- autopub-1.0.0a3.dist-info/entry_points.txt,sha256=oeTav5NgCxif6mcZ_HeVGgGv5LzS4DwdI01nr4bO1IM,43
16
- autopub-1.0.0a3.dist-info/RECORD,,