declare-lab/tango2
92
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 scripts src tests 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); \14 else \15 echo "No library .py files were modified"; \16 fi17 18# Update src/diffusers/dependency_versions_table.py19 20deps_table_update:21 @python setup.py deps_table_update22 23deps_table_check_updated:24 @md5sum src/diffusers/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_dummies.py37 python utils/check_repo.py38 python utils/check_inits.py39 40# this target runs checks on all files41 42quality:43 black --check $(check_dirs)44 ruff $(check_dirs)45 doc-builder style src/diffusers docs/source --max_len 119 --check_only --path_to_docs docs/source46 python utils/check_doc_toc.py47 48# Format source code automatically and check is there are any problems left that need manual fixing49 50extra_style_checks:51 python utils/custom_init_isort.py52 doc-builder style src/diffusers docs/source --max_len 119 --path_to_docs docs/source53 python utils/check_doc_toc.py --fix_and_overwrite54 55# this target runs checks on all files and potentially modifies some of them56 57style:58 black $(check_dirs)59 ruff $(check_dirs) --fix60 ${MAKE} autogenerate_code61 ${MAKE} extra_style_checks62 63# Super fast fix and check target that only works on relevant modified files since the branch was made64 65fixup: modified_only_fixup extra_style_checks autogenerate_code repo-consistency66 67# Make marked copies of snippets of codes conform to the original68 69fix-copies:70 python utils/check_copies.py --fix_and_overwrite71 python utils/check_dummies.py --fix_and_overwrite72 73# Run tests for the library74 75test:76 python -m pytest -n auto --dist=loadfile -s -v ./tests/77 78# Run tests for examples79 80test-examples:81 python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/82 83 84# Release stuff85 86pre-release:87 python utils/release.py88 89pre-patch:90 python utils/release.py --patch91 92post-release:93 python utils/release.py --post_release94 95post-patch:96 python utils/release.py --post_release --patch97 