Skip to content

Commit cba18cc

Browse files
refactoring
1 parent 40d791e commit cba18cc

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

Makefile

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,42 @@ publish-test: build ## Publish to TestPyPI
130130
@echo "$(GREEN)Published to TestPyPI!$(NC)"
131131
@echo "Install with: pip install -i https://test.pypi.org/simple/ code2logic"
132132

133-
publish: build ## Publish to PyPI (production)
133+
134+
git-clean: ## Ensure git working tree is clean
135+
@if [ "$(FORCE)" = "1" ]; then \
136+
echo "FORCE=1 set: skipping git clean check."; \
137+
exit 0; \
138+
fi
139+
@git diff --quiet || (echo "Working tree has unstaged changes. Commit or stash before publishing."; exit 1)
140+
@git diff --cached --quiet || (echo "Index has staged but uncommitted changes. Commit before publishing."; exit 1)
141+
142+
check-bumpver: ## Ensure bumpver is installed
143+
@$(PYTHON) -c "import bumpver" >/dev/null 2>&1 || (echo "Missing bumpver. Install dev deps: pip install -e '.[dev]'"; exit 1)
144+
145+
146+
bump-patch: check-bumpver ## Bump patch version (updates pyproject.toml and code2logic/__init__.py)
147+
$(PYTHON) -m bumpver update --patch
148+
149+
150+
bump-minor: check-bumpver ## Bump minor version
151+
$(PYTHON) -m bumpver update --minor
152+
153+
154+
bump-major: check-bumpver ## Bump major version
155+
$(PYTHON) -m bumpver update --major
156+
157+
publish: bump-patch build ## Publish to PyPI (production)
134158
@echo "$(YELLOW)Publishing to PyPI...$(NC)"
135159
$(PYTHON) -m twine upload dist/*
136160
@echo "$(GREEN)Published to PyPI!$(NC)"
137161
@echo "Install with: pip install code2logic"
138162

163+
publish-dirty: bump-patch build ## Publish to PyPI without git-clean (dangerous)
164+
@echo "$(YELLOW)Publishing to PyPI (skipping git clean check)...$(NC)"
165+
$(PYTHON) -m twine upload dist/*
166+
@echo "$(GREEN)Published to PyPI!$(NC)"
167+
@echo "Install with: pip install code2logic"
168+
139169
# ============================================================================
140170
# Docker
141171
# ============================================================================

pyproject.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ dev = [
9999
"pre-commit>=3.0",
100100
"build>=1.0.0",
101101
"twine>=4.0.0",
102+
"bumpver>=2023.1129",
102103
]
103104

104105
# Documentation
@@ -202,4 +203,17 @@ module = [
202203
"nltk",
203204
"spacy",
204205
]
205-
ignore_missing_imports = true
206+
ignore_missing_imports = true
207+
208+
[tool.bumpver]
209+
current_version = "1.0.1"
210+
version_pattern = "MAJOR.MINOR.PATCH"
211+
commit = false
212+
tag = false
213+
214+
[tool.bumpver.file_patterns]
215+
"pyproject.toml" = [
216+
"version = \"{version}\"",
217+
"current_version = \"{version}\"",
218+
]
219+
"code2logic/__init__.py" = ["__version__ = \"{version}\""]

0 commit comments

Comments
 (0)