-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (82 loc) · 2.89 KB
/
Makefile
File metadata and controls
96 lines (82 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.PHONY: lint test requirements all build publish-test publish-pypi release
all: lint test
lint:
uv run ruff check . --exclude "*.ipynb"
test:
uv run pytest test/
requirements:
uv pip compile pyproject.toml --no-reuse-hashes --output-file=requirements.txt
format:
uv run ruff format .
push: format requirements
@bash -c '{ \
set -e; \
git add .; \
read -p "Enter commit message: " msg; \
echo "DEBUG: Entered message: [$${msg}]"; \
if [ -z "$$(echo $${msg} | tr -d "[:space:]")" ]; then \
echo "Commit message cannot be blank or whitespace."; exit 1; \
fi; \
uv run pre-commit run --all-files || { \
echo "Pre-commit hooks failed. Files have been fixed. Please re-run make push."; \
exit 1; \
}; \
git add .; \
git commit -m "$${msg}"; \
git push; \
}'
build: format test
@echo "Building package..."
rm -rf dist/
uv run python -m build
@echo "Checking package..."
uv run twine check dist/*
@echo "Build complete! Distribution files in dist/"
publish-test: build
@echo "Uploading to TestPyPI..."
uv run twine upload --repository testpypi dist/* --username __token__ --password "$${PYPI_API_TOKEN}"
@echo "Published to TestPyPI!"
@echo "Install with: pip install --index-url https://test.pypi.org/simple/ langchain-document-parser"
publish-pypi: build
@echo "WARNING: Publishing to production PyPI!"
@read -p "Are you sure? (yes/N): " confirm; \
if [ "$${confirm}" != "yes" ]; then \
echo "Publish cancelled."; exit 1; \
fi
@echo "Uploading to PyPI..."
uv run twine upload dist/* --username __token__ --password "$${PYPI_API_TOKEN}"
@echo "Published to PyPI!"
@echo "Install with: pip install automated-document-parser"
docs:
@echo "Building documentation..."
cd docs && $(MAKE) clean
cd docs && $(MAKE) html
@cp docs/.nojekyll docs/_build/html/
@echo "Documentation built successfully!"
@echo "Open docs/_build/html/index.html in your browser"
docs-clean:
@echo "Cleaning documentation build..."
cd docs && $(MAKE) clean
@echo "Documentation cleaned!"
docs-serve:
@echo "Starting documentation server..."
@echo "Open http://localhost:8000 in your browser"
cd docs/_build/html && python -m http.server 8000
release: format test
@echo "Creating release from pyproject.toml version..."
@VERSION=$$(uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])"); \
echo "Version: $$VERSION"; \
read -p "Create and push tag v$$VERSION? (yes/N): " confirm; \
if [ "$$confirm" != "yes" ]; then \
echo "Release cancelled."; exit 1; \
fi; \
if git rev-parse "v$$VERSION" >/dev/null 2>&1; then \
echo "Error: Tag v$$VERSION already exists!"; \
exit 1; \
fi; \
echo "Creating tag v$$VERSION..."; \
git tag -a "v$$VERSION" -m "Release version $$VERSION"; \
echo "Pushing tag to origin..."; \
git push origin "v$$VERSION"; \
echo "Tag v$$VERSION created and pushed!"; \
echo "GitHub Actions will now build and publish the release."