Skip to content

Commit 7d6d3d7

Browse files
committed
Drop dependency on attr
1 parent b13a383 commit 7d6d3d7

File tree

6 files changed

+33
-33
lines changed

6 files changed

+33
-33
lines changed

Changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Changelog
55
------------------
66

77
* Drop support for Python 3.6
8+
* Drop dependency on `attr`
89

910
6.6.1 (2021-12-17)
1011
------------------

poetry.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Issues = "https://github.com/dmerejkowsky/tbump/issues"
1818
# Note: keep this in sync with .github/workflows/tests.yml
1919
python = "^3.7"
2020

21-
attrs = ">= 20.0.0"
2221
docopt = "^0.6.2"
2322
cli-ui = ">=0.10.3"
2423
schema = "^0.7.1"

tbump/cli.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import sys
22
import textwrap
33
import urllib.parse
4+
from dataclasses import dataclass
45
from pathlib import Path
56
from typing import List, Optional
67

7-
import attr
88
import cli_ui as ui
99
import docopt
1010

@@ -47,13 +47,13 @@ def print_error(self) -> None:
4747
ui.error("Canceled by user")
4848

4949

50-
@attr.s
50+
@dataclass
5151
class BumpOptions:
52-
working_path: Path = attr.ib()
53-
new_version: str = attr.ib()
54-
interactive: bool = attr.ib(default=True)
55-
dry_run: bool = attr.ib(default=False)
56-
config_path: Optional[Path] = attr.ib(default=None)
52+
working_path: Path
53+
new_version: str
54+
interactive: bool = True
55+
dry_run: bool = False
56+
config_path: Optional[Path] = None
5757

5858

5959
def run(cmd: List[str]) -> None:

tbump/config.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import abc
22
import re
3+
from dataclasses import dataclass
34
from pathlib import Path
45
from typing import Dict, List, Optional, Pattern, Tuple, Union
56

6-
import attr
77
import cli_ui as ui
88
import schema
99
import tomlkit
@@ -13,32 +13,32 @@
1313
from tbump.hooks import HOOKS_CLASSES, Hook
1414

1515

16-
@attr.s
16+
@dataclass
1717
class File:
18-
src: str = attr.ib()
19-
search: Optional[str] = attr.ib(default=None)
20-
version_template: Optional[str] = attr.ib(default=None)
18+
src: str
19+
search: Optional[str] = None
20+
version_template: Optional[str] = None
2121

2222

23-
@attr.s
23+
@dataclass
2424
class Field:
25-
name: str = attr.ib()
26-
default: Optional[Union[str, int]] = attr.ib(default=None)
25+
name: str
26+
default: Optional[Union[str, int]] = None
2727

2828

29-
@attr.s
29+
@dataclass
3030
class Config:
31-
current_version: str = attr.ib()
32-
version_regex: Pattern[str] = attr.ib()
31+
current_version: str
32+
version_regex: Pattern[str]
3333

34-
git_tag_template: str = attr.ib()
35-
git_message_template: str = attr.ib()
34+
git_tag_template: str
35+
git_message_template: str
3636

37-
files: List[File] = attr.ib()
38-
hooks: List[Hook] = attr.ib()
39-
fields: List[Field] = attr.ib()
37+
files: List[File]
38+
hooks: List[Hook]
39+
fields: List[Field]
4040

41-
github_url: Optional[str] = attr.ib()
41+
github_url: Optional[str]
4242

4343

4444
class ConfigFile(metaclass=abc.ABCMeta):

tbump/file_bumper.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import glob
22
import re
3+
from dataclasses import dataclass
34
from pathlib import Path
45
from typing import Dict, List, Optional, Pattern
56

6-
import attr
77
import cli_ui as ui
88

99
from tbump.action import Action
1010
from tbump.config import ConfigFile, Field, File, get_config_file
1111
from tbump.error import Error
1212

1313

14-
@attr.s
14+
@dataclass
1515
class ChangeRequest:
16-
src: str = attr.ib()
17-
old_string: str = attr.ib()
18-
new_string: str = attr.ib()
19-
search: Optional[str] = attr.ib(default=None)
16+
src: str
17+
old_string: str
18+
new_string: str
19+
search: Optional[str] = None
2020

2121

2222
class Patch(Action):

0 commit comments

Comments
 (0)