Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ jobs:
with:
python-version: "3.10"

- name: Install linting dependencies
run: |
pip install black flake8

- name: Run linters
uses: wearerequired/lint-action@v2
- name: Set up Poetry
uses: snok/install-poetry@v1
with:
auto_fix: true
black: true
black_auto_fix: true
flake8: true
flake8_auto_fix: false
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- uses: isort/isort-action@v1.0.0
- name: Install dependencies
run: poetry install

- name: Run linters
run: |
poetry run isort --check-only pycheckwatt/
poetry run black --check pycheckwatt/
poetry run flake8 pycheckwatt/
5 changes: 1 addition & 4 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ RUN pip install --no-cache-dir poetry
COPY pyproject.toml poetry.lock ./

RUN poetry config virtualenvs.create false \
&& poetry install --only main --no-root --no-interaction --no-ansi

# Dev dependencies
RUN pip install black flake8
&& poetry install --no-root --no-interaction --no-ansi

ENV PYTHONPATH="${PYTHONPATH}:/app"

Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,20 @@ For developers who prefer not to install Python locally, a Docker-based developm

Inside the container local code changes are automatically synced and you can run standard Python development commands.

### Development Tools

You can run various development tools locally using Docker Compose without installing Python or the tools on your system:

```bash
# Run isort to check import sorting
docker compose -f docker-compose.dev.yml run --rm --build pycheckwatt-dev poetry run isort --check-only --diff .

# Run black to format code
docker compose -f docker-compose.dev.yml run --rm --build pycheckwatt-dev poetry run black --check --diff .

# Run flake8 for linting
docker compose -f docker-compose.dev.yml run --rm --build pycheckwatt-dev poetry run flake8 .
```


# Acknowledgements
Expand Down
Loading
Loading