Skip to content
Merged
Changes from all 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
30 changes: 29 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Makefile for l9format-python project

VERSION := $(shell poetry version -s)

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SED := $(shell command -v gsed 2>/dev/null)
Expand Down Expand Up @@ -94,8 +96,34 @@ check-trailing-whitespace: ## Check for trailing whitespaces in source files
install: ## Install dependencies with Poetry
poetry install

.PHONY: build
build: clean-dist ## Build package for distribution
poetry build

.PHONY: publish-dry-run
publish-dry-run: build ## Dry-run: show what would be published
@echo "Would publish l9format v$(VERSION)"
@echo "Would create tag: v$(VERSION)"
@echo "Would create GitHub release: v$(VERSION)"
@echo "Package contents:"
@ls -lh dist/
poetry publish --dry-run
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publish-dry-run depends on build, but poetry publish --dry-run will typically build again unless --no-build is provided. Consider adding --no-build here to avoid redundant builds and ensure the dry-run output reflects the artifacts currently in dist/.

Suggested change
poetry publish --dry-run
poetry publish --dry-run --no-build

Copilot uses AI. Check for mistakes.

.PHONY: publish
publish: build ## Publish to PyPI, tag and create GitHub release
poetry publish
git tag -a "v$(VERSION)" -m "Release v$(VERSION)"
git push origin "v$(VERSION)"
gh release create "v$(VERSION)" dist/* \
Comment on lines +114 to +117
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, poetry publish happens before any checks that the git tag can be created/pushed or that gh is authenticated. If the tag already exists (or gh release create fails), you can end up with a PyPI release without the corresponding tag/GitHub release. Consider adding preflight checks (e.g., fail if tag v$(VERSION) exists, ensure clean working tree, verify gh auth status) before publishing so failures happen before the irreversible step.

Copilot uses AI. Check for mistakes.
--title "v$(VERSION)" \
--notes "Release v$(VERSION)"
Comment on lines +112 to +119
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publish depends on build, but poetry publish will typically rebuild unless --no-build is used. Adding --no-build makes the target faster and ensures the PyPI upload and the dist/* artifacts attached to the GitHub release are based on the same already-built output.

Copilot uses AI. Check for mistakes.

.PHONY: clean-dist
clean-dist: ## Clean distribution artifacts
rm -rf dist/

.PHONY: clean
clean: ## Clean build artifacts and caches
clean: clean-dist ## Clean build artifacts and caches
rm -rf __pycache__ .pytest_cache .mypy_cache .ruff_cache
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true