Skip to content

Feature req: -p (--package) arg supporting path to folder #9348

Closed
@jamesbraza

Description

@jamesbraza

I am making a feature request for mypy, not raising a bug.

Within one repository, here is a use case:

  • Package that follows native namespace packaging conventions.
  • In a separate directory: unit tests, which are grouped as a native namespace package as well.
    • This is done so others can pip install and import example use cases from the unit test files
  • One mypy config file, located in repo root
  • Both the package + unit tests are type checked via mypy
    • Note per this comment: for PEP 420 support, mypy should be invoked via mypy -p <folder>

Spoiler alert, this is my use case. I would like to run mypy from the repo root, which requires one to invoke mypy via something like:

mypy -p rel/path/to/package

However, currently, it seems package names don't support slashes. When I enter mypy -p tests/packagename, here's my output:

Package name 'tests/packagename' cannot have a slash in it.

TL;DR the feature request: enable mypy support of relative paths to packages when using -p PACKAGE.


Versions

mypy==0.782
Python==3.6.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions