autopub 1.0.0a45__py3-none-any.whl → 1.0.0a47__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
@@ -41,8 +41,8 @@ class Autopub:
41
41
  RELEASE_FILE_PATH = "RELEASE.md"
42
42
  plugins: list[AutopubPlugin]
43
43
 
44
- def __init__(self) -> None:
45
- self.plugins = []
44
+ def __init__(self, plugins: list[type[AutopubPlugin]] | None = None) -> None:
45
+ self.plugins = [plugin() for plugin in plugins or []]
46
46
 
47
47
  @cached_property
48
48
  def config(self) -> ConfigType:
@@ -86,7 +86,6 @@ class Autopub:
86
86
  return ReleaseInfo.from_dict(release_info)
87
87
 
88
88
  def load_plugins(self, default_plugins: list[str] | None = None) -> None:
89
- print("🦆 loading plugins")
90
89
  default_plugins = default_plugins or []
91
90
 
92
91
  additional_plugins: list[str] = self.config.get("plugins", []) # type: ignore
@@ -94,7 +93,6 @@ class Autopub:
94
93
  all_plugins = default_plugins + additional_plugins
95
94
 
96
95
  plugins = load_plugins(all_plugins)
97
- print("plugins", plugins)
98
96
 
99
97
  self.plugins += [plugin_class() for plugin_class in plugins]
100
98
 
@@ -104,7 +102,7 @@ class Autopub:
104
102
  if not release_file.exists():
105
103
  for plugin in self.plugins:
106
104
  plugin.on_release_file_not_found()
107
-
105
+
108
106
  raise ReleaseFileNotFound()
109
107
 
110
108
  try:
@@ -116,7 +114,7 @@ class Autopub:
116
114
 
117
115
  for plugin in self.plugins:
118
116
  plugin.post_check(release_info)
119
-
117
+
120
118
  for plugin in self.plugins:
121
119
  plugin.on_release_notes_valid(release_info)
122
120
 
autopub/cli/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Optional, TypedDict
1
+ from typing import Annotated, Optional, TypedDict
2
2
 
3
3
  import rich
4
4
  import typer
@@ -6,7 +6,6 @@ from rich.console import Group, RenderableType
6
6
  from rich.markdown import Markdown
7
7
  from rich.padding import Padding
8
8
  from rich.panel import Panel
9
- from typing_extensions import Annotated
10
9
 
11
10
  from autopub import Autopub
12
11
  from autopub.exceptions import AutopubException, InvalidConfiguration
@@ -116,8 +115,7 @@ def main(
116
115
  raise typer.Exit()
117
116
 
118
117
  autopub = Autopub()
119
-
120
-
118
+
121
119
  # default plugins we always want to load (?)
122
120
  autopub.load_plugins(["git", "update_changelog", "bump_version"])
123
121
 
autopub/exceptions.py CHANGED
@@ -4,8 +4,8 @@ from pydantic import ValidationError
4
4
  class AutopubException(Exception):
5
5
  message: str
6
6
 
7
- def __init__(self) -> None:
8
- super().__init__(self.message)
7
+ def __init__(self, message: str | None = None) -> None:
8
+ super().__init__(message or self.message)
9
9
 
10
10
 
11
11
  class ReleaseFileNotFound(AutopubException):
autopub/plugin_loader.py CHANGED
@@ -1,3 +1,4 @@
1
+ # TODO: use this instead: https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/
1
2
  from __future__ import annotations
2
3
 
3
4
  import os
@@ -27,7 +27,7 @@ class AutopubPlugin:
27
27
  if configuration_class is None:
28
28
  return
29
29
 
30
- plugin_config = config.get(self.id, {})
30
+ plugin_config = config.get("plugin_config", {}).get(self.id, {})
31
31
 
32
32
  self._config = configuration_class.model_validate(plugin_config)
33
33
 
@@ -38,8 +38,6 @@ class BumpVersionPlugin(AutopubPlugin):
38
38
  release_info.previous_version = str(version)
39
39
  release_info.version = version.bump(bump_type).serialize()
40
40
 
41
- print("👊 bumped version to", release_info.version)
42
-
43
41
  def post_prepare(self, release_info: ReleaseInfo) -> None:
44
42
  config = self.pyproject_config
45
43
 
autopub/plugins/git.py CHANGED
@@ -19,13 +19,13 @@ class GitPlugin(AutopubPlugin):
19
19
 
20
20
  commit_message = textwrap.dedent(
21
21
  f"""
22
- Release {release_info.version}
22
+ 🤖 Release {release_info.version}
23
23
 
24
24
  {release_info.release_notes}
25
25
 
26
26
  [skip ci]
27
27
  """
28
- )
28
+ ).strip()
29
29
 
30
30
  # TODO: config?
31
31
  self.run_command(["git", "rm", "RELEASE.md"])
autopub/plugins/github.py CHANGED
@@ -31,7 +31,9 @@ class GithubConfig(BaseModel):
31
31
  """
32
32
  Thanks for adding the `RELEASE.md` file!
33
33
 
34
- Here's a preview of the changelog:
34
+ Below is the changelog that will be used for the release.
35
+
36
+ ---
35
37
 
36
38
  {changelog}
37
39
  """,
@@ -43,7 +45,9 @@ class GithubConfig(BaseModel):
43
45
 
44
46
  Here's the error:
45
47
 
48
+ ```text
46
49
  {error}
50
+ ```
47
51
  """,
48
52
  )
49
53
 
@@ -142,11 +146,6 @@ class GithubPlugin(AutopubPlugin):
142
146
  self, text: str, marker: str = "<!-- autopub-comment -->"
143
147
  ) -> None:
144
148
  """Update or create a comment on the current PR with the given text."""
145
- print(
146
- f"Updating or creating comment on PR {self.pull_request} in {self.repository}"
147
- )
148
-
149
- # Look for existing autopub comment
150
149
  comment_body = f"{marker}\n{text}"
151
150
 
152
151
  # Search for existing comment
@@ -323,13 +322,12 @@ class GithubPlugin(AutopubPlugin):
323
322
  return pr_contributors
324
323
 
325
324
  def on_release_notes_valid(self, release_info: ReleaseInfo) -> None:
326
- print(self.config)
327
325
  assert self.pull_request is not None
328
326
 
329
327
  changelog = self._get_release_message(release_info)
330
328
 
331
329
  message = self.config.comment_template_success.format(
332
- changelog=changelog
330
+ changelog=changelog.strip()
333
331
  )
334
332
 
335
333
  self._update_or_create_comment(message)
@@ -347,7 +345,7 @@ class GithubPlugin(AutopubPlugin):
347
345
  def _get_release_message(
348
346
  self,
349
347
  release_info: ReleaseInfo,
350
- include_release_info: bool = False,
348
+ include_release_info: bool = True,
351
349
  discussion_url: Optional[str] = None,
352
350
  ) -> str:
353
351
  assert self.pull_request is not None
@@ -355,8 +353,6 @@ class GithubPlugin(AutopubPlugin):
355
353
  contributors = self._get_pr_contributors()
356
354
  message = textwrap.dedent(
357
355
  f"""
358
- ## {release_info.version}
359
-
360
356
  {release_info.release_notes}
361
357
  """
362
358
  )
@@ -364,7 +360,7 @@ class GithubPlugin(AutopubPlugin):
364
360
  if not include_release_info:
365
361
  return message
366
362
 
367
- message += f"This release was contributed by @{contributors['pr_author']} in #{self.pull_request.number}"
363
+ message += f"\nThis release was contributed by @{contributors['pr_author']} in #{self.pull_request.number}"
368
364
 
369
365
  if contributors["additional_contributors"]:
370
366
  additional_contributors = [
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: autopub
3
+ Version: 1.0.0a47
4
+ Summary: Automatic package release upon pull request merge
5
+ Project-URL: Source, https://github.com/autopub/autopub
6
+ Project-URL: Issues, https://github.com/autopub/autopub/issues
7
+ Author-email: Justin Mayer <entroP@gmail.com>, Patrick Arminio <patrick.arminio@gmail.com>
8
+ License-Expression: AGPL-3.0
9
+ License-File: LICENSE
10
+ Keywords: automatic,packaging,publish,release,version
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: System :: Software Distribution
17
+ Classifier: Topic :: System :: Systems Administration
18
+ Requires-Python: <4.0,>=3.9.0
19
+ Requires-Dist: dunamai>=1.23.0
20
+ Requires-Dist: pydantic>=2.10.5
21
+ Requires-Dist: pygithub>=2.5.0
22
+ Requires-Dist: python-frontmatter>=1.1.0
23
+ Requires-Dist: rich>=13.9.4
24
+ Requires-Dist: tomlkit>=0.13.2
25
+ Requires-Dist: typer>=0.15.1
26
+ Description-Content-Type: text/markdown
27
+
28
+ # AutoPub
29
+
30
+ [![Build Status](https://img.shields.io/circleci/build/github/autopub/autopub)](https://circleci.com/gh/autopub/autopub) [![PyPI Version](https://img.shields.io/pypi/v/autopub)](https://pypi.org/project/autopub/)
31
+
32
+ AutoPub enables project maintainers to release new package versions to PyPI by merging pull requests.
33
+
34
+ ## Environment
35
+
36
+ AutoPub is intended for use with continuous integration (CI) systems such as [GitHub Actions][], [CircleCI][], or [Travis CI][]. Projects used with AutoPub are built via [build][] and published via [Twine][]. Contributions that add support for other CI and build systems are welcome.
37
+
38
+ ## Configuration
39
+
40
+ AutoPub settings can be configured via the `[tool.autopub]` table in the target project’s `pyproject.toml` file. Required settings include Git username and email address:
41
+
42
+ ```toml
43
+ [tool.autopub]
44
+ git-username = "Your Name"
45
+ git-email = "your_email@example.com"
46
+ ```
47
+
48
+ ## Release Files
49
+
50
+ Contributors should include a `RELEASE.md` file in their pull requests with two bits of information:
51
+
52
+ * Release type: major, minor, or patch
53
+ * Description of the changes, to be used as the changelog entry
54
+
55
+ Example:
56
+
57
+ Release type: patch
58
+
59
+ Add function to update version strings in multiple files.
60
+
61
+ ## Usage
62
+
63
+ The following `autopub` sub-commands can be used as steps in your CI flows:
64
+
65
+ * `autopub check`: Check whether release file exists.
66
+ * `autopub prepare`: Update version strings and add entry to changelog.
67
+ * `autopub build`: Build the project.
68
+ * `autopub commit`: Add, commit, and push incremented version and changelog changes.
69
+ * `autopub githubrelease`: Create a new release on GitHub.
70
+ * `autopub publish`: Publish a new release.
71
+
72
+ For systems such as Travis CI in which only one deployment step is permitted, there is a single command that runs the above steps in sequence:
73
+
74
+ * `autopub deploy`: Run `prepare`, `build`, `commit`, `githubrelease`, and `publish` in one invocation.
75
+
76
+
77
+ [GitHub Actions]: https://github.com/features/actions
78
+ [CircleCI]: https://circleci.com
79
+ [Travis CI]: https://travis-ci.org
80
+ [build]: https://pypa-build.readthedocs.io
81
+ [Twine]: https://twine.readthedocs.io/
@@ -0,0 +1,19 @@
1
+ autopub/__init__.py,sha256=IJquq8slI255qvTRiueUnF3cLYxHMWG30wRifMALAww,7253
2
+ autopub/exceptions.py,sha256=Drp6MDlx4cHtqzfAS7IcauRhmSaXnShXgSU7EuevIDM,1573
3
+ autopub/plugin_loader.py,sha256=wYJ3vVQXylTJ76oN7f36mxx_a37KMmxvR_mOxaX2u-0,1915
4
+ autopub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ autopub/types.py,sha256=gY1WR93XZVFS7vf5JMSmL_h5z7zO51-rtmZ6MYsh3so,1043
6
+ autopub/cli/__init__.py,sha256=opMVjzQKz1NnR00eCrYuSr9vuAAOfgxrsfobgnfOukc,3832
7
+ autopub/plugins/__init__.py,sha256=aJ-i7Q7j4uD_e5ifiAvcAsc9rywmCyGuLhdRqd9cafY,2289
8
+ autopub/plugins/bump_version.py,sha256=-tTGQR0v8K3Bto1Y8UcmkEs4WnExeF1QyHKHPUKgll8,1565
9
+ autopub/plugins/git.py,sha256=-4Fq_N_GJHctrXJMQ8xteEebSgdMrnVCunJiyytnOOw,1067
10
+ autopub/plugins/github.py,sha256=oQwWJUE2oUTQ-U615kbZ1Ce56Tp4JyxP3wbFlGT8D5Q,13645
11
+ autopub/plugins/pdm.py,sha256=Pczye06fKg8_HMJDkEfMXQyvao9rZ7sqzTHFd6lLEpU,532
12
+ autopub/plugins/poetry.py,sha256=d2LvW9RI7ZB3reBOXbcp1mqWmzQ06Uyg_T-MxTvlSBg,517
13
+ autopub/plugins/update_changelog.py,sha256=g_6flOP5wocZbjOaYSayWxobL3ld8f0wT78nFtAIkFc,1586
14
+ autopub/plugins/uv.py,sha256=goo8QxaD3FVJ1c3xOSmN1hikZTCUXN8jWNac1S5uDDY,1089
15
+ autopub-1.0.0a47.dist-info/METADATA,sha256=eCsRRaQRTnFfTuJnTVbVR2i0Jwo4ghyzgQD0UO-SILw,3200
16
+ autopub-1.0.0a47.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ autopub-1.0.0a47.dist-info/entry_points.txt,sha256=IRCGh_RE5fjYT7A0oM6qh0aGLdTjZqJWaRRhbYSaxh8,44
18
+ autopub-1.0.0a47.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
19
+ autopub-1.0.0a47.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ autopub = autopub.cli:app
@@ -1,24 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: autopub
3
- Version: 1.0.0a45
4
- Summary: Automatic package release upon pull request merge
5
- Home-page: https://github.com/autopub/autopub
6
- Author: Justin Mayer
7
- Author-email: entroP@gmail.com
8
- Requires-Python: >=3.9.0,<4.0
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Provides-Extra: github
16
- Requires-Dist: dunamai (>=1.23.0,<2.0.0)
17
- Requires-Dist: pydantic (>=2.10.5,<3.0.0)
18
- Requires-Dist: pygithub (>=2.5.0,<3.0.0)
19
- Requires-Dist: python-frontmatter (>=1.1.0,<2.0.0)
20
- Requires-Dist: rich (>=13.9.4,<14.0.0)
21
- Requires-Dist: tomlkit (>=0.13.2,<0.14.0)
22
- Requires-Dist: typer (>=0.15.1,<0.16.0)
23
- Project-URL: Issue Tracker, https://github.com/autopub/autopub/issues
24
- Project-URL: Repository, https://github.com/autopub/autopub
@@ -1,19 +0,0 @@
1
- autopub/__init__.py,sha256=JOFsdJMarqnRydwUibnWL8JlmijG66I340q4zdcRENs,7263
2
- autopub/cli/__init__.py,sha256=pIfIQaRPM8GZ1ANIWqWBZrRmaGjRGz-HiCUlPO0_q0I,3870
3
- autopub/exceptions.py,sha256=gNUbiG3_fVmNjhk2kyueQHPSifNgQf0Bl6IDNvkVhxQ,1534
4
- autopub/plugin_loader.py,sha256=2ysITgpHGUmcb1mP1Qvs-iBX2wZxmfP9obnebThwUMA,1809
5
- autopub/plugins/__init__.py,sha256=vpmk0u8nu_ex8eoEtpXJe-gpqww4OnMQaIfSDGx2XDw,2264
6
- autopub/plugins/bump_version.py,sha256=yOXhKHAGFb1DcmeBdh5RfwkOpEYeTqMlE69HgIyUB58,1628
7
- autopub/plugins/git.py,sha256=d0SMLc6hwuk0eymj8aHyu3_cEd-7x4fhkwu35wPPV4k,1054
8
- autopub/plugins/github.py,sha256=872I9Lm5eIORKtOSP5jpxMFqV7b4OBZ2yDoun0XflJ4,13799
9
- autopub/plugins/pdm.py,sha256=Pczye06fKg8_HMJDkEfMXQyvao9rZ7sqzTHFd6lLEpU,532
10
- autopub/plugins/poetry.py,sha256=d2LvW9RI7ZB3reBOXbcp1mqWmzQ06Uyg_T-MxTvlSBg,517
11
- autopub/plugins/update_changelog.py,sha256=g_6flOP5wocZbjOaYSayWxobL3ld8f0wT78nFtAIkFc,1586
12
- autopub/plugins/uv.py,sha256=goo8QxaD3FVJ1c3xOSmN1hikZTCUXN8jWNac1S5uDDY,1089
13
- autopub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- autopub/types.py,sha256=gY1WR93XZVFS7vf5JMSmL_h5z7zO51-rtmZ6MYsh3so,1043
15
- autopub-1.0.0a45.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
16
- autopub-1.0.0a45.dist-info/METADATA,sha256=p_CKTUpR11QpiGPOuBTshempKityDHTw-ydzsomyi4E,992
17
- autopub-1.0.0a45.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
18
- autopub-1.0.0a45.dist-info/entry_points.txt,sha256=oeTav5NgCxif6mcZ_HeVGgGv5LzS4DwdI01nr4bO1IM,43
19
- autopub-1.0.0a45.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- autopub=autopub.cli:app
3
-