Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ repos:
- id: check-api-reference
name: check-api-reference
pass_filenames: false
entry: python -m utils.check_api_reference
language: python
additional_dependencies: [polars]
language: system
entry: make check-api-reference
- id: imports-are-banned
name: import are banned (use `get_pandas` instead of `import pandas`)
entry: python utils/import_check.py
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ typing: ## Run typing checks
$(VENV_BIN)/uv pip install -U --pre duckdb
$(VENV_BIN)/uv pip install -e . --group typing
$(VENV_BIN)/mypy

.PHONY: check-api-reference
check-api-reference:
$(VENV_BIN)/uv pip install ".[polars]"
$(VENV_BIN)/python utils/check_api_reference.py
18 changes: 4 additions & 14 deletions utils/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
out = subprocess.run(["git", "fetch", "upstream", "--tags"])
if out.returncode != 0:
print(
"Something went wrong with the release process, please check the Narwhals Wiki and try again."
"Something went wrong with the release process, please check the Narwhals Wiki for "
"at https://github.com/narwhals-dev/narwhals/wiki#release-process and try again."
)
print(out)
sys.exit(1)
Expand Down Expand Up @@ -42,19 +43,8 @@

how = sys.argv[1]

with open("pyproject.toml", encoding="utf-8") as f:
content = f.read()
old_version = re.search(r'version = "(.*)"', content).group(1) # pyright: ignore[reportOptionalMemberAccess]
version = old_version.split(".")
if how == "patch":
version = ".".join(version[:-1] + [str(int(version[-1]) + 1)])
elif how == "minor":
version = ".".join(version[:-2] + [str(int(version[-2]) + 1), "0"])
elif how == "major":
version = ".".join([str(int(version[0]) + 1), "0", "0"])
content = content.replace(f'version = "{old_version}"', f'version = "{version}"')
with open("pyproject.toml", "w", encoding="utf-8") as f:
f.write(content)
subprocess.run(["uv", "version", "--bump", how])
version = subprocess.run(["uv", "version", "--short"], capture_output=True).stdout.decode("utf-8")

subprocess.run(["git", "commit", "-a", "-m", f"release: Bump version to {version}"])
subprocess.run(["git", "tag", "-a", f"v{version}", "-m", f"v{version}"])
Expand Down
Loading