From 270e835f6efb1e4876199ccf4c4b137cf77e3f66 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Fri, 30 Jan 2026 11:25:30 -0700 Subject: [PATCH] chore: swap makefile for justfile --- .github/workflows/ci.yml | 23 +++++++----- .github/workflows/release.yml | 5 ++- Makefile | 71 ----------------------------------- README.md | 18 ++++----- justfile | 67 +++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 Makefile create mode 100644 justfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6991699..6a02db3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,14 +10,15 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install Dependencies - run: make install + run: just install - name: Lint - run: make lint + run: just lint run-tests: runs-on: ubuntu-latest strategy: @@ -25,14 +26,15 @@ jobs: # vcrpy is not compatible with Python 3.14 yet so we cannot test against it pythonversion: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 - uses: actions/setup-python@v6 with: python-version: ${{ matrix.pythonversion }} - name: Install Dependencies - run: make install + run: just install - name: Run Tests - run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make coverage + run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just coverage - name: Coveralls if: github.ref == 'refs/heads/master' uses: coverallsapp/github-action@master @@ -40,19 +42,20 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: './coverage.lcov' - name: Run security analysis - run: make scan + run: just scan docs: if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Install Dependencies - run: make install + run: just install - name: Generate Docs - run: make docs + run: just docs - name: Deploy Docs uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e458e3af..5da7208b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,12 +9,13 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 - uses: actions/setup-python@v6 with: python-version: '3.14' - name: Build package - run: make install build + run: just install build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/Makefile b/Makefile deleted file mode 100644 index cc1b8526..00000000 --- a/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -PYTHON_BINARY := python3 -VIRTUAL_ENV := venv -VIRTUAL_BIN := $(VIRTUAL_ENV)/bin -PROJECT_NAME := easypost -TEST_DIR := tests - -## help - Display help about make targets for this Makefile -help: - @cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t - -## build - Builds the project in preparation for release -build: - $(VIRTUAL_BIN)/python -m build - -## clean - Clean the project -clean: - rm -rf $(VIRTUAL_ENV) dist/ *.egg-info/ .*cache htmlcov *.lcov .coverage - find . -name '*.pyc' -delete - -## coverage - Test the project and generate an HTML coverage report -coverage: - $(VIRTUAL_BIN)/pytest --cov=$(PROJECT_NAME) --cov-branch --cov-report=html --cov-report=lcov --cov-report=term-missing --cov-fail-under=87 - -## docs - Generates docs for the library -docs: - $(VIRTUAL_BIN)/pdoc $(PROJECT_NAME) -o docs - -## init-examples-submodule - Initialize the examples submodule -init-examples-submodule: - git submodule init - git submodule update - -## install - Install the project locally -install: | init-examples-submodule - $(PYTHON_BINARY) -m venv $(VIRTUAL_ENV) - $(VIRTUAL_BIN)/pip install -e ."[dev]" - -## update-examples-submodule - Update the examples submodule -update-examples-submodule: - git submodule init - git submodule update --remote - -## lint - Lints the project -lint: - $(VIRTUAL_BIN)/ruff check $(PROJECT_NAME)/ $(TEST_DIR)/ - $(VIRTUAL_BIN)/ruff format --check $(PROJECT_NAME)/ $(TEST_DIR)/ - -## lint-fix - Fixes lint issues -lint-fix: - $(VIRTUAL_BIN)/ruff check --fix $(PROJECT_NAME)/ $(TEST_DIR)/ - $(VIRTUAL_BIN)/ruff format $(PROJECT_NAME)/ $(TEST_DIR)/ - -## mypy - Run mypy type checking on the project -mypy: - $(VIRTUAL_BIN)/mypy $(PROJECT_NAME)/ $(TEST_DIR)/ --install-types --non-interactive - -## release - Cuts a release for the project on GitHub (requires GitHub CLI) -# tag = The associated tag title of the release -# target = Target branch or full commit SHA -release: - gh release create ${tag} dist/* --target ${target} - -## scan - Scans the project for security issues with Bandit -scan: - $(VIRTUAL_BIN)/bandit -r $(PROJECT_NAME) - -## test - Test the project -test: - $(VIRTUAL_BIN)/pytest - -.PHONY: help build clean coverage docs install lint lint-fix mypy release scan test diff --git a/README.md b/README.md index 33e562e9..0ef1eab1 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ You can also unsubscribe your functions in a similar manner by using the `unsubs API documentation can be found at: . -Library documentation can be found on the web at: or by building them locally via the `make docs` command. +Library documentation can be found on the web at: or by building them locally via the `just docs` command. Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md). @@ -98,24 +98,24 @@ For additional support, see our [org-wide support policy](https://github.com/Eas ```bash # Install dependencies -make install +just install # Lint project -make lint -make lint-fix +just lint +just lint-fix # Run tests -EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make test -EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make coverage +EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... just test +EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... just coverage # Run security analysis -make scan +just scan # Generate library documentation -make docs +just docs # Update submodules -make update-examples-submodule +just update-examples-submodule ``` ### Testing diff --git a/justfile b/justfile new file mode 100644 index 00000000..7386c265 --- /dev/null +++ b/justfile @@ -0,0 +1,67 @@ +PYTHON_BINARY := "python3" +VIRTUAL_ENV := "venv" +VIRTUAL_BIN := VIRTUAL_ENV / "bin" +PROJECT_NAME := "easypost" +TEST_DIR := "tests" + +# Build the project for release +build: + {{VIRTUAL_BIN}}/python -m build + +# Clean the project +clean: + rm -rf {{VIRTUAL_ENV}} dist/ *.egg-info/ .*cache htmlcov *.lcov .coverage + find . -name '*.pyc' -delete + +# Test with coverage and generate HTML report +coverage: + {{VIRTUAL_BIN}}/pytest --cov={{PROJECT_NAME}} --cov-branch --cov-report=html --cov-report=lcov --cov-report=term-missing --cov-fail-under=87 + +# Generate docs + +docs: + {{VIRTUAL_BIN}}/pdoc {{PROJECT_NAME}} -o docs + +# Initialize the examples submodule +init-examples-submodule: + git submodule init + git submodule update + +# Install the project locally (dev mode) +install: init-examples-submodule + {{PYTHON_BINARY}} -m venv {{VIRTUAL_ENV}} + {{VIRTUAL_BIN}}/pip install -e ."[dev]" + +# Update the examples submodule +update-examples-submodule: + git submodule init + git submodule update --remote + +# Lint the project +lint: + {{VIRTUAL_BIN}}/ruff check {{PROJECT_NAME}}/ {{TEST_DIR}}/ + {{VIRTUAL_BIN}}/ruff format --check {{PROJECT_NAME}}/ {{TEST_DIR}}/ + +# Fix lint issues +lint-fix: + {{VIRTUAL_BIN}}/ruff check --fix {{PROJECT_NAME}}/ {{TEST_DIR}}/ + {{VIRTUAL_BIN}}/ruff format {{PROJECT_NAME}}/ {{TEST_DIR}}/ + +# Run mypy type checking +mypy: + {{VIRTUAL_BIN}}/mypy {{PROJECT_NAME}}/ {{TEST_DIR}}/ --install-types --non-interactive + +# Cuts a release for the project on GitHub (requires GitHub CLI) +# tag = The associated tag title of the release +# target = Target branch or full commit SHA +release tag target: + gh release create {{tag}} dist/* --target {{target}} + +# Scan for security issues with Bandit +scan: + {{VIRTUAL_BIN}}/bandit -r {{PROJECT_NAME}} + +# Run tests + +test: + {{VIRTUAL_BIN}}/pytest