linkedin / linkedin/pygradle

Support for mypy

Open
#181 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
603
Forks
142
PR merge metrics
No merged PRs in 30d

Description

I have a Python 3 project which uses type annotations. I wanted to be able to run mypy over my code as a standard code quality check. @ethankhall and @zvezdan helped me add some code to my build.gradle file to make this happen, and I've been happy with it so far. I'm not sure of the best way to integrated this into pygradle by default, so for now I'll open this ticket and include the code inline.

class MyPy extends com.linkedin.gradle.python.tasks.AbstractPythonMainSourceDefaultTask {
    void preExecution() {
        args(pythonDetails.virtualEnvironment.findExecutable('mypy').absolutePath)
        args('--ignore-missing-imports', 'src')
    }
    void processResults(org.gradle.process.ExecResult results) {
    }
}

// We want the check task to always run mypy too.
task mypy(type: MyPy)
check.dependsOn(mypy)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the inline build.gradle example and inspect how pygradle currently defines Python tasks and the standard check task. Determine how mypy should be integrated by default without requiring project-local task code. Done means a documented default integration runs mypy as part of the standard check workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.