Skip to content

Commit 87d52d3

Browse files
TiansuYuTiansu Yusungwy
authored
fix: improve makefile (#1091)
* fix: improve makefile * fix: pin poetry version * Apply suggestions from code review Co-authored-by: Sung Yun <[email protected]> --------- Co-authored-by: Tiansu Yu <tiansu.yu@icloud> Co-authored-by: Sung Yun <[email protected]>
1 parent 0e6ce1d commit 87d52d3

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

Makefile

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,37 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
install-poetry:
19-
pip install poetry==1.8.3
2018

21-
install-dependencies:
22-
poetry install -E pyarrow -E hive -E s3fs -E glue -E adlfs -E duckdb -E ray -E sql-postgres -E gcsfs -E sql-sqlite -E daft
19+
help: ## Display this help
20+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
21+
22+
install-poetry: ## Install poetry if the user has not done that yet.
23+
@if ! command -v poetry &> /dev/null; then \
24+
echo "Poetry could not be found. Installing..."; \
25+
pip install --user poetry==1.8.3; \
26+
else \
27+
echo "Poetry is already installed."; \
28+
fi
29+
30+
install-dependencies: ## Install dependencies including dev and all extras
31+
poetry install --all-extras
2332

2433
install: | install-poetry install-dependencies
2534

26-
check-license:
35+
check-license: ## Check license headers
2736
./dev/check-license
2837

29-
lint:
38+
lint: ## lint
3039
poetry run pre-commit run --all-files
3140

32-
test:
41+
test: ## Run all unit tests, can add arguments with PYTEST_ARGS="-vv"
3342
poetry run pytest tests/ -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}
3443

35-
test-s3:
44+
test-s3: # Run tests marked with s3, can add arguments with PYTEST_ARGS="-vv"
3645
sh ./dev/run-minio.sh
3746
poetry run pytest tests/ -m s3 ${PYTEST_ARGS}
3847

39-
test-integration:
48+
test-integration: ## Run all integration tests, can add arguments with PYTEST_ARGS="-vv"
4049
docker compose -f dev/docker-compose-integration.yml kill
4150
docker compose -f dev/docker-compose-integration.yml rm -f
4251
docker compose -f dev/docker-compose-integration.yml up -d
@@ -50,18 +59,18 @@ test-integration-rebuild:
5059
docker compose -f dev/docker-compose-integration.yml rm -f
5160
docker compose -f dev/docker-compose-integration.yml build --no-cache
5261

53-
test-adlfs:
62+
test-adlfs: ## Run tests marked with adlfs, can add arguments with PYTEST_ARGS="-vv"
5463
sh ./dev/run-azurite.sh
5564
poetry run pytest tests/ -m adlfs ${PYTEST_ARGS}
5665

57-
test-gcs:
66+
test-gcs: ## Run tests marked with gcs, can add arguments with PYTEST_ARGS="-vv"
5867
sh ./dev/run-gcs-server.sh
5968
poetry run pytest tests/ -m gcs ${PYTEST_ARGS}
6069

61-
test-coverage-unit:
70+
test-coverage-unit: # Run test with coverage for unit tests, can add arguments with PYTEST_ARGS="-vv"
6271
poetry run coverage run --source=pyiceberg/ --data-file=.coverage.unit -m pytest tests/ -v -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}
6372

64-
test-coverage-integration:
73+
test-coverage-integration: # Run test with coverage for integration tests, can add arguments with PYTEST_ARGS="-vv"
6574
docker compose -f dev/docker-compose-integration.yml kill
6675
docker compose -f dev/docker-compose-integration.yml rm -f
6776
docker compose -f dev/docker-compose-integration.yml up -d
@@ -72,14 +81,14 @@ test-coverage-integration:
7281
docker compose -f dev/docker-compose-integration.yml exec -T spark-iceberg ipython ./provision.py
7382
poetry run coverage run --source=pyiceberg/ --data-file=.coverage.integration -m pytest tests/ -v -m integration ${PYTEST_ARGS}
7483

75-
test-coverage: | test-coverage-unit test-coverage-integration
84+
test-coverage: | test-coverage-unit test-coverage-integration ## Run all tests with coverage including unit and integration tests
7685
poetry run coverage combine .coverage.unit .coverage.integration
7786
poetry run coverage report -m --fail-under=90
7887
poetry run coverage html
7988
poetry run coverage xml
8089

8190

82-
clean:
91+
clean: ## Clean up the project Python working environment
8392
@echo "Cleaning up Cython and Python cached files"
8493
@rm -rf build dist *.egg-info
8594
@find . -name "*.so" -exec echo Deleting {} \; -delete

0 commit comments

Comments
 (0)