Skip to content

Commit d45ffcd

Browse files
committed
Update Makefile to use ruff for formatting and linting; remove black dependency. Modify pyproject.toml to change changelog link and update ruff configuration for improved linting and formatting options.
1 parent 2b5ce2b commit d45ffcd

File tree

2 files changed

+46
-26
lines changed

2 files changed

+46
-26
lines changed

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ clean-test: ## remove test and coverage artifacts
4747
rm -fr htmlcov/
4848
rm -fr .pytest_cache
4949

50-
lint: ## check style with ruff
50+
lint: ## check style and lint with ruff
5151
uv pip run ruff check bbox_visualizer demo tests examples
5252

53-
format: ## format code with black
54-
uv pip run black bbox_visualizer demo tests examples
53+
format: ## format code with ruff
54+
uv pip run ruff format bbox_visualizer demo tests examples
5555

5656
test: ## run tests with pytest
5757
uv pip run pytest
@@ -81,3 +81,16 @@ install: clean ## install the package to the active Python's site-packages
8181

8282
dev-install: clean ## install the package in development mode with all extras
8383
uv pip install -e ".[dev]"
84+
85+
bump-version: ## Bump version in both files (Usage: make bump-version NEW_VERSION=0.2.1)
86+
@if [ "$(NEW_VERSION)" = "" ]; then \
87+
echo "Please provide NEW_VERSION (e.g. make bump-version NEW_VERSION=0.2.1)"; \
88+
exit 1; \
89+
fi
90+
sed -i '' 's/version = "[0-9.]*"/version = "$(NEW_VERSION)"/' pyproject.toml
91+
sed -i '' 's/__version__ = "[0-9.]*"/__version__ = "$(NEW_VERSION)"/' bbox_visualizer/_version.py
92+
git add pyproject.toml bbox_visualizer/_version.py
93+
git commit -m "Bump version to $(NEW_VERSION)"
94+
git tag v$(NEW_VERSION)
95+
git push origin v$(NEW_VERSION)
96+
git push origin

pyproject.toml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ dev = [
3939
"twine>=4.0.2",
4040
"pytest>=7.4.0",
4141
"pytest-cov>=6.0.0",
42-
"black>=24.1.1",
4342
"ruff>=0.2.1",
4443
]
4544

@@ -55,7 +54,7 @@ docs = [
5554
Homepage = "https://github.com/shoumikchow/bbox-visualizer"
5655
Repository = "https://github.com/shoumikchow/bbox-visualizer"
5756
Documentation = "https://bbox-visualizer.readthedocs.io"
58-
Changelog = "https://github.com/shoumikchow/bbox-visualizer/blob/main/HISTORY.md"
57+
Changelog = "https://github.com/shoumikchow/bbox-visualizer/releases"
5958

6059
[tool.hatch.build.targets.wheel]
6160
packages = ["bbox_visualizer"]
@@ -64,7 +63,6 @@ packages = ["bbox_visualizer"]
6463
include = [
6564
"LICENSE",
6665
"README.md",
67-
"HISTORY.md",
6866
"AUTHORS.md",
6967
"CODE_OF_CONDUCT.md",
7068
"CONTRIBUTING.md",
@@ -90,22 +88,9 @@ exclude = [
9088
addopts = "--cov=bbox_visualizer"
9189
testpaths = ["tests"]
9290

93-
[tool.black]
94-
line-length = 88
95-
target-version = ["py38", "py39", "py310", "py311", "py312"]
96-
include = '\.pyi?$'
97-
extend-exclude = '''
98-
# A regex preceded with ^/ will apply only to files and directories
99-
# in the root of the project.
100-
^/docs/
101-
'''
102-
10391
[tool.ruff]
104-
# Enable pycodestyle ('E'), Pyflakes ('F'),
105-
# flake8-bugbear ('B'), isort ('I')
106-
select = ["E", "F", "B", "I"]
107-
ignore = ["E501"] # Line length is handled by black
108-
line-length = 88 # Match black's line length
92+
# General settings that apply to all Ruff functionality
93+
line-length = 88
10994
target-version = "py38"
11095
exclude = [
11196
"docs/*",
@@ -114,14 +99,36 @@ exclude = [
11499
".venv",
115100
]
116101

117-
# Allow autofix behavior for specific rules
102+
[tool.ruff.format]
103+
quote-style = "double"
104+
indent-style = "space"
105+
skip-magic-trailing-comma = false
106+
line-ending = "auto"
107+
118108
[tool.ruff.lint]
119-
fixable = ["I001"] # Import sorting
109+
# All the rules that were previously enabled plus additional useful ones
110+
select = [
111+
"E", # pycodestyle
112+
"F", # Pyflakes
113+
"B", # flake8-bugbear
114+
"I", # isort
115+
"W", # pycodestyle warnings
116+
"C90", # mccabe
117+
"N", # pep8-naming
118+
"UP", # pyupgrade
119+
"RUF", # Ruff-specific rules
120+
]
121+
ignore = [
122+
"E501", # Line length is handled by formatter
123+
"N802", # Function name should be lowercase
124+
"N806", # Variable name should be lowercase
125+
"N816", # Variable in global scope should not be mixedCase
126+
]
127+
fixable = ["ALL"]
120128
unfixable = []
121129

122130
# Ignore `E402` (import violations) in all `__init__.py` files
123-
[tool.ruff.per-file-ignores]
124-
"__init__.py" = ["E402"]
131+
per-file-ignores = { "__init__.py" = ["E402"] }
125132

126-
[tool.ruff.isort]
133+
[tool.ruff.lint.isort]
127134
known-first-party = ["bbox_visualizer"]

0 commit comments

Comments
 (0)