fast-dev-cli 0.9.5__tar.gz → 0.9.6__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 (27) hide show
  1. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/PKG-INFO +3 -2
  2. fast_dev_cli-0.9.6/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/fast_dev_cli/cli.py +21 -2
  4. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/pyproject.toml +3 -2
  5. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_bump.py +20 -1
  6. fast_dev_cli-0.9.5/fast_dev_cli/__init__.py +0 -1
  7. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/LICENSE +0 -0
  8. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/README.md +0 -0
  9. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/fast_dev_cli/__main__.py +0 -0
  10. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/fast_dev_cli/py.typed +0 -0
  11. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/pdm_build.py +0 -0
  12. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/scripts/check.sh +0 -0
  13. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/scripts/format.sh +0 -0
  14. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/scripts/test.sh +0 -0
  15. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/__init__.py +0 -0
  16. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/conftest.py +0 -0
  17. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_fast_test.py +0 -0
  18. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_functions.py +0 -0
  19. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_lint.py +0 -0
  20. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_poetry_version_plugin.py +0 -0
  21. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_runserver.py +0 -0
  22. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_sync.py +0 -0
  23. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_tag.py +0 -0
  24. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_upgrade.py +0 -0
  25. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_upload.py +0 -0
  26. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/test_version.py +0 -0
  27. {fast_dev_cli-0.9.5 → fast_dev_cli-0.9.6}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.9.5
3
+ Version: 0.9.6
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -25,8 +25,9 @@ Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
25
25
  Requires-Dist: coverage<8,>=7.5.1
26
26
  Requires-Dist: ruff<0.7,>=0.4.4
27
27
  Requires-Dist: mypy<2,>=1.10.0
28
- Requires-Dist: bumpversion2<2,>=1.4.0
28
+ Requires-Dist: bumpversion2<2,>=1.4.2
29
29
  Requires-Dist: pytest<9,>=8.2.0
30
+ Requires-Dist: emoji<3,>=2.12.1
30
31
  Requires-Dist: ipython<9,>=8.24.0; extra == "all"
31
32
  Requires-Dist: pytest-mock<4,>=3.14.0; extra == "all"
32
33
  Provides-Extra: all
@@ -0,0 +1 @@
1
+ __version__ = "0.9.6"
@@ -3,12 +3,14 @@ from __future__ import annotations
3
3
  import importlib.metadata as importlib_metadata
4
4
  import os
5
5
  import re
6
+ import shlex
6
7
  import subprocess # nosec:B404
7
8
  import sys
8
9
  from functools import cached_property
9
10
  from pathlib import Path
10
11
  from typing import Literal, Optional, Type
11
12
 
13
+ import emoji
12
14
  import typer
13
15
  from typer import Exit, Option, echo, secho
14
16
  from typer.models import OptionInfo
@@ -74,7 +76,7 @@ def check_call(cmd: str) -> bool:
74
76
 
75
77
  def capture_cmd_output(command: list[str] | str, **kw) -> str:
76
78
  if isinstance(command, str) and not kw.get("shell"):
77
- command = command.split()
79
+ command = shlex.split(command)
78
80
  r = _run_shell(command, capture_output=True, **kw)
79
81
  return r.stdout.strip().decode()
80
82
 
@@ -146,6 +148,20 @@ class BumpUp(DryRun):
146
148
  self.filename = filename
147
149
  super().__init__(dry=dry)
148
150
 
151
+ @staticmethod
152
+ def get_last_commit_message() -> str:
153
+ cmd = 'git show --pretty=format:"%s" -s HEAD'
154
+ return capture_cmd_output(cmd)
155
+
156
+ @classmethod
157
+ def should_add_emoji(cls) -> bool:
158
+ """
159
+ If last commit message is startswith emoji,
160
+ add a ⬆️ flag at the prefix of bump up commit message.
161
+ """
162
+ out = cls.get_last_commit_message()
163
+ return emoji.is_emoji(out[0])
164
+
149
165
  @staticmethod
150
166
  def parse_filename() -> str:
151
167
  toml_text = Project.load_toml_text()
@@ -209,7 +225,10 @@ class BumpUp(DryRun):
209
225
  if self.commit:
210
226
  if part != "patch":
211
227
  cmd += " --tag"
212
- cmd += " --commit && git push && git push --tags && git log -1"
228
+ cmd += " --commit"
229
+ if self.should_add_emoji():
230
+ cmd += " --commit-emoji=1"
231
+ cmd += " && git push && git push --tags && git log -1"
213
232
  else:
214
233
  cmd += " --allow-dirty"
215
234
  return cmd
@@ -36,10 +36,11 @@ dependencies = [
36
36
  "coverage >=7.5.1,<8",
37
37
  "ruff >=0.4.4,<0.7",
38
38
  "mypy >=1.10.0,<2",
39
- "bumpversion2 >=1.4.0,<2",
39
+ "bumpversion2 >=1.4.2,<2",
40
40
  "pytest >=8.2.0,<9",
41
+ "emoji >=2.12.1,<3",
41
42
  ]
42
- version = "0.9.5"
43
+ version = "0.9.6"
43
44
 
44
45
  [project.urls]
45
46
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -34,9 +34,13 @@ def test_enum():
34
34
  assert A.ABCD == "ABCD"
35
35
 
36
36
 
37
- def _bump_commands(version: str, filename=TOML_FILE) -> tuple[str, str, str]:
37
+ def _bump_commands(
38
+ version: str, filename=TOML_FILE, emoji=False
39
+ ) -> tuple[str, str, str]:
38
40
  cmd = rf'bumpversion --parse "(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)" --current-version="{version}"'
39
41
  suffix = " --commit && git push && git push --tags && git log -1"
42
+ if emoji:
43
+ suffix = suffix.replace("--commit", "--commit --commit-emoji=1")
40
44
  patch_without_commit = cmd + f" patch {filename} --allow-dirty"
41
45
  patch_with_commit = cmd + f" patch {filename}" + suffix
42
46
  minor_with_commit = cmd + f" minor {filename} --tag" + suffix
@@ -130,3 +134,18 @@ def test_bump_with_poetry(mocker, tmp_poetry_project, tmp_path):
130
134
  Project.get_work_dir(TOML_FILE)
131
135
  assert Project.get_work_dir(allow_cwd=True) == Path.cwd()
132
136
  assert work_dir == work_dir2 == tmp_path
137
+
138
+
139
+ def test_bump_with_emoji(mocker):
140
+ mocker.patch("fast_dev_cli.cli.Project.manage_by_poetry", return_value=True)
141
+ version = get_current_version()
142
+ patch_without_commit, patch_with_commit, minor_with_commit = _bump_commands(
143
+ version, emoji=True
144
+ )
145
+ mocker.patch(
146
+ "fast_dev_cli.cli.BumpUp.get_last_commit_message",
147
+ return_value="📝 Update release notes",
148
+ )
149
+ assert BumpUp(part="patch", commit=False, dry=True).gen() == patch_without_commit
150
+ assert BumpUp(part="patch", commit=True, dry=True).gen() == patch_with_commit
151
+ assert BumpUp(part="minor", commit=True, dry=True).gen() == minor_with_commit
@@ -1 +0,0 @@
1
- __version__ = "0.9.5"
File without changes
File without changes
File without changes