-
Notifications
You must be signed in to change notification settings - Fork 20
Add Makefile, separate core and development requirements #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e3ccf50
Separate core and development requirements
namasl 926d271
Add Makefile
namasl 1025cc7
Update Makefile
wangchen615 8f4f0dc
Update Makefile
wangchen615 a00a272
Ensure recipe ends if virtual environment already exists
namasl f674bd5
Merge branch 'main' into make
wangchen615 404c0fd
Add development requirements to Dockerfile
namasl 1574476
Merge branch 'main' into make
wangchen615 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| SHELL := /usr/bin/env bash | ||
| VENV := .venv | ||
|
|
||
| ##@ General | ||
|
|
||
| # The help target prints out all targets with their descriptions organized | ||
| # beneath their categories. The categories are represented by '##@' and the | ||
| # target descriptions by '##'. The awk command is responsible for reading the | ||
| # entire set of makefiles included in this invocation, looking for lines of the | ||
| # file as xyz: ## something, and then pretty-format the target and help. Then, | ||
| # if there's a line with ##@ something, that gets pretty-printed as a category. | ||
| # More info on the usage of ANSI control characters for terminal formatting: | ||
| # https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters | ||
| # More info on the awk command: | ||
| # http://linuxcommand.org/lc3_adv_awk.php | ||
|
|
||
| .PHONY: help | ||
| help: ## Print help | ||
| @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
|
||
| .PHONY: install | ||
| install: ## Install core requirements | ||
| @echo "Installing core requirements..." | ||
| pip install -r requirements.txt | ||
|
|
||
| .PHONY: venv | ||
| venv: ## Create a Python virtual environment with core requirements | ||
| @echo "Creating virtual environment..." | ||
| @if [ ! -d $(VENV) ]; then \ | ||
| python3 -m venv $(VENV); \ | ||
| source $(VENV)/bin/activate; \ | ||
| pip install --upgrade pip; \ | ||
| else \ | ||
| echo "Virtual environment already exists, no action needed."; \ | ||
| exit 1; \ | ||
| fi | ||
| @echo "Installing core dependencies..." | ||
| @source $(VENV)/bin/activate; pip install -r requirements.txt; pip install -e .; | ||
| @printf "\nRun \033[35msource $(VENV)/bin/activate\033[0m to activate the virtual environment\n" | ||
|
|
||
| ##@ Development | ||
|
|
||
| .PHONY: format | ||
| format: ## Autoformat code | ||
| @echo "Formatting Python code..." | ||
| ruff format ./fmperf | ||
| ruff format ./examples | ||
| @echo "Sorting requirements..." | ||
| @for req in $$(ls requirements*.txt); do sort -f $$req -o $$req; done | ||
|
|
||
| .PHONY: lint | ||
| lint: ## Perform linting | ||
| black --check ./fmperf | ||
| black --check ./examples | ||
|
|
||
| .PHONY: type-check | ||
| type-check: ## Perform type checking | ||
| @echo "Running type checking with mypy..." | ||
| mypy --strict ./fmperf | ||
| mypy --strict ./examples | ||
|
|
||
| .PHONY: test | ||
| test: ## Run tests | ||
| pytest fmperf/tests/ | ||
|
|
||
| .PHONY: install-dev | ||
| install-dev: ## Install development requirements | ||
| @echo "Installing development requirements..." | ||
| pip install -r requirements-dev.txt | ||
|
|
||
| .PHONY: install-all | ||
| install-all: install install-dev ## Install core and development requirements | ||
|
|
||
| .PHONY: venv-dev | ||
| venv-dev: venv ## Create a Python virtual environment with core and dev requirements | ||
| @echo "Installing dev dependencies..." | ||
| @source $(VENV)/bin/activate; pip install -r requirements-dev.txt | ||
| @printf "\nRun \033[35msource $(VENV)/bin/activate\033[0m to activate the virtual environment\n" | ||
|
|
||
| .PHONY: clean | ||
| clean: ## Remove cache, backup, and temporary files | ||
| @echo "Running cleanup" | ||
| find fmperf/ -depth -name '__pycache__' -exec rm -vrf {} \; | ||
| rm -vrf fmperf.egg-info | ||
| find -depth -name '.pytest_cache' -exec rm -vrf {} \; | ||
| find -depth -name '.ipynb_checkpoints' -exec rm -vrf {} \; | ||
| ruff clean | ||
| rm -rf .mypy_cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| black~=24.0 | ||
| mypy>=1.14.1 | ||
| pytest | ||
| ruff>=0.9.4 | ||
| wheel | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,7 @@ | ||
| durations | ||
| kubernetes==24.2.0 | ||
| black~=24.0 | ||
| pandas | ||
| pyyaml | ||
| pytest | ||
| wheel | ||
| scikit-learn | ||
| durations | ||
| transformers | ||
| sentencepiece | ||
| transformers |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.