jpetrucciani / mypy-check

github action for python's mypy type checker tool
MIT License
33 stars 14 forks source link

How to pip install dev requirements ? #26

Closed AdrienLemaire closed 2 years ago

AdrienLemaire commented 2 years ago

Hi,

My mypy packages are in a requirements-dev.txt file, not in the production requirements.txt file. How can I get them installed in the action's docker container ?

Github Action error:

Run jpetrucciani/mypy-check@0.930 /usr/bin/docker run --name cd98f654223d9de5b48b0b4c798b3adf5e8ab_300b3f --label 4cd98f --workdir /github/workspace --rm -e INPUT_PATH -e INPUT_MYPY_FLAGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/project-v4/project-v4":"/github/workspace" 4cd98f:654423d9de6b48b0a4c798b3ade5e8ab "backend" "--config-file backend/pyproject.toml"

  • output_file=/tmp/mypy.out
  • mypy --version mypy 0.930
  • mypy --config-file backend/pyproject.toml --show-column-numbers --hide-error-context backend
  • tee /tmp/mypy.out backend/pyproject.toml:1:1: error: Error importing plugin "mypy_django_plugin.main": No module named 'mypy_django_plugin' Found 1 error in 1 file (errors prevented further checking)
  • exit_code=2
  • python /github.py /tmp/mypy.out
  • exit 2

My workflow:

---
name: Mypy Check

on:
  pull_request:
    paths:
      - 'backend/**/*.py'
    types: ['opened', 'synchronize', 'reopened', 'ready_for_review']

jobs:
  mypy:
    if: github.event.pull_request.draft == false
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Code
      uses: actions/checkout@v3
    -  run: pip install -r backend/requirements-dev.txt  # NOT INSTALLED IN THE mypy-check environment!
    - uses: jpetrucciani/mypy-check@0.930
      with:
        path: "backend"
        mypy_flags: '--config-file backend/pyproject.toml'
jpetrucciani commented 2 years ago

The latest release (or @master) should now support requirements and requirements_file as options!

- uses: jpetrucciani/mypy-check@master
  with:
    requirements_file: requirements.dev.txt