chendl/compositional_test
1
1.PHONY: deps_table_update modified_only_fixup extra_style_checks quality style fixup fix-copies test test-examples2 3# make sure to test the local checkout in scripts and not the pre-installed one (don't use quotes!)4export PYTHONPATH = src5 6check_dirs := examples tests src utils7 8modified_only_fixup:9 $(eval modified_py_files := $(shell python utils/get_modified_files.py $(check_dirs)))10 @if test -n "$(modified_py_files)"; then \11 echo "Checking/fixing $(modified_py_files)"; \12 black $(modified_py_files); \13 ruff $(modified_py_files) --fix; \14 else \15 echo "No library .py files were modified"; \16 fi17 18# Update src/transformers/dependency_versions_table.py19 20deps_table_update:21 @python setup.py deps_table_update22 23deps_table_check_updated:24 @md5sum src/transformers/dependency_versions_table.py > md5sum.saved25 @python setup.py deps_table_update26 @md5sum -c --quiet md5sum.saved || (printf "\nError: the version dependency table is outdated.\nPlease run 'make fixup' or 'make style' and commit the changes.\n\n" && exit 1)27 @rm md5sum.saved28 29# autogenerating code30 31autogenerate_code: deps_table_update32 33# Check that the repo is in a good state34 35repo-consistency:36 python utils/check_copies.py37 python utils/check_table.py38 python utils/check_dummies.py39 python utils/check_repo.py40 python utils/check_inits.py41 python utils/check_config_docstrings.py42 python utils/check_config_attributes.py43 python utils/check_doctest_list.py44 python utils/update_metadata.py --check-only45 python utils/check_task_guides.py46 47# this target runs checks on all files48 49quality:50 black --check $(check_dirs) setup.py51 python utils/custom_init_isort.py --check_only52 python utils/sort_auto_mappings.py --check_only53 ruff $(check_dirs) setup.py54 doc-builder style src/transformers docs/source --max_len 119 --check_only --path_to_docs docs/source55 python utils/check_doc_toc.py56 57# Format source code automatically and check is there are any problems left that need manual fixing58 59extra_style_checks:60 python utils/custom_init_isort.py61 python utils/sort_auto_mappings.py62 doc-builder style src/transformers docs/source --max_len 119 --path_to_docs docs/source63 python utils/check_doc_toc.py --fix_and_overwrite64 65# this target runs checks on all files and potentially modifies some of them66 67style:68 black $(check_dirs) setup.py69 ruff $(check_dirs) setup.py --fix70 ${MAKE} autogenerate_code71 ${MAKE} extra_style_checks72 73# Super fast fix and check target that only works on relevant modified files since the branch was made74 75fixup: modified_only_fixup extra_style_checks autogenerate_code repo-consistency76 77# Make marked copies of snippets of codes conform to the original78 79fix-copies:80 python utils/check_copies.py --fix_and_overwrite81 python utils/check_table.py --fix_and_overwrite82 python utils/check_dummies.py --fix_and_overwrite83 python utils/check_task_guides.py --fix_and_overwrite84 85# Run tests for the library86 87test:88 python -m pytest -n auto --dist=loadfile -s -v ./tests/89 90# Run tests for examples91 92test-examples:93 python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/94 95# Run tests for SageMaker DLC release96 97test-sagemaker: # install sagemaker dependencies in advance with pip install .[sagemaker]98 TEST_SAGEMAKER=True python -m pytest -n auto -s -v ./tests/sagemaker99 100 101# Release stuff102 103pre-release:104 python utils/release.py105 106pre-patch:107 python utils/release.py --patch108 109post-release:110 python utils/release.py --post_release111 112post-patch:113 python utils/release.py --post_release --patch114 