Skip to content

Commit

Permalink
Migrate to pip-tools and Hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Dec 25, 2022
1 parent eefb165 commit 726eb10
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 572 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
poetry-version: [ "1.3.1" ]
os: [ ubuntu-18.04, macos-latest, windows-latest ]
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: extractions/setup-just@v1
Expand All @@ -23,10 +22,6 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: just install
- name: Run checks
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,23 @@ on:

env:
PYTHON_VERSION: "3.7"
POETRY_VERSION: "1.3.1"

jobs:
release:
runs-on: "ubuntu-18.04"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install Hatch
run: python3 -m pip install hatch
- name: Install dependencies
run: poetry build
run: hatch build
- name: Publish to PyPi
if: "startsWith(github.ref, 'refs/tags/')"
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.RUFF_LSP_TOKEN }}
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.RUFF_LSP_TOKEN }}
run: |
pip install --upgrade twine
twine upload --skip-existing dist/*
hatch publish
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,12 @@ the following settings are supported:

## Development

Install [`just`](https://github.com/casey/just).

`ruff-lsp` uses Poetry for environment management and packaging. To get started, clone the
repository, install Poetry, and run `poetry install` (or `just install`).

To automatically format the codebase, run: `just fmt`.

To run lint and type checks, run: `just check`.

To run tests, run: `just test`.
- Install [`just`](https://github.com/casey/just), or see the `justfile` for corresponding commands.
- Create and activate a virtual environment (e.g., `python -m venv .venv && source .venv/bin/activate`).
- Install development dependencies (`just install`).
- To automatically format the codebase, run: `just fmt`.
- To run lint and type checks, run: `just check`.
- To run tests, run: `just test`.

## License

Expand Down
18 changes: 10 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
default: fmt check

lock:
poetry lock
pip-compile --resolver=backtracking -o requirements.txt pyproject.toml
pip-compile --resolver=backtracking --extra dev -o requirements-dev.txt pyproject.toml

install:
poetry install
pip install -r requirements.txt
pip install -r requirements-dev.txt

fmt:
poetry run ruff --fix ./ruff_lsp ./tests
poetry run black ./ruff_lsp ./tests
ruff --fix ./ruff_lsp ./tests
black ./ruff_lsp ./tests

check:
poetry run ruff ./ruff_lsp ./tests
poetry run black --check ./ruff_lsp ./tests
poetry run mypy ./ruff_lsp ./tests
ruff ./ruff_lsp ./tests
black --check ./ruff_lsp ./tests
mypy ./ruff_lsp ./tests

test:
poetry run python -m unittest
python -m unittest
Loading

0 comments on commit 726eb10

Please sign in to comment.