diff --git a/README.md b/README.md index f1b3a49..0f3aaf0 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,13 @@ steps: python-version: "3.7" ``` -### Examples +> :information_source: python-lint-annotate expects a `requirements.txt` file in your project. +> See example to generate one with `pipenv`. +> Leave an empty one if needed. + +### More Examples * [Only lint changed files, and ignore missing docstrings](examples/actions-only_changed_files.yml) +* [Install requirements from pipenv and lint all files](examples/actions-pipenv_requirements.yml) ## Details @@ -58,18 +63,7 @@ Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested si they are by far most common now. Other python `3.x` versions should also work. Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. -The lintner versions are: - -```bash -pycodestyle==2.8.0 -pydocstyle==6.1.1 -pylint==2.12.1 -mypy==0.910 -black==21.11b1 -flake8==4.0.1 -vulture==2.3 -isort==5.10.1 -``` +The linter versions are defined in [requirements.txt](requirements.txt) ## IMPORTANT - test environment diff --git a/action.yml b/action.yml index 5ec2538..473906d 100644 --- a/action.yml +++ b/action.yml @@ -86,20 +86,20 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - - - run: python --version - shell: bash - name: Windows install dependencies if: ${{ runner.os == 'Windows' }} run: | - pip install -r ${{ github.action_path }}\requirements.txt + pip install -r requirements.txt # project's dependencies + pip install -r ${{ github.action_path }}\requirements.txt # linters echo "path_sep=" >> $GITHUB_ENV shell: pwsh - name: Posix install dependencies if: ${{ runner.os != 'Windows' }} - run: pip install -r ${{ github.action_path }}/requirements.txt + run: | + pip install -r requirements.txt # project's dependencies + pip install -r ${{ github.action_path }}/requirements.txt # linters shell: bash - name: Lint on Windows diff --git a/examples/actions-pipenv_requirements.yml b/examples/actions-pipenv_requirements.yml new file mode 100644 index 0000000..85ff586 --- /dev/null +++ b/examples/actions-pipenv_requirements.yml @@ -0,0 +1,20 @@ +name: Install requirements from pipenv and lint all files +on: + pull_request: + types: [ opened, reopened, synchronize, edited ] +jobs: + lint: + runs-on: ubuntu-latest + name: Lint + steps: + - name: Check out source repository + uses: actions/checkout@v3 + - name: Set up Python environment + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Generate requirements.txt file + run: | + pip install pipenv + pipenv requirements > requirements.txt + - uses: marian-code/python-lint-annotate@v3 diff --git a/requirements.txt b/requirements.txt index 73b61ff..3201eae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -black==21.11b1 +black~=22.3.0 flake8==4.0.1 isort==5.10.1 mypy~=0.961 pycodestyle==2.8.0 pydocstyle==6.1.1 pylint==2.12.1 -vulture==2.3 \ No newline at end of file +vulture==2.3