Skip to content

Commit

Permalink
Add type annotations (#50)
Browse files Browse the repository at this point in the history
Closes #42
  • Loading branch information
brettcannon authored Sep 21, 2023
1 parent 7f32e40 commit cf60109
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.x"
- run: pipx run nox -s lint
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
},
"[toml]": {
"editor.defaultFormatter": "tamasfe.even-better-toml"
},
}
}
2 changes: 0 additions & 2 deletions microvenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import pathlib
import sys

from . import _create

# Exported as part of the public API.
from ._create import create as create

Expand Down
12 changes: 12 additions & 0 deletions microvenv/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from os import PathLike
from typing import TypedDict

IN_VIRTUAL_ENV: bool

def parse_config(env_dir: str | PathLike[str]) -> dict[str, str]: ...

class _ActivationEnvVars(TypedDict):
PATH: str
VIRTUAL_ENV: str

def activation(env_vars: dict[str, str] = ...) -> _ActivationEnvVars: ...
7 changes: 7 additions & 0 deletions microvenv/_create.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from os import PathLike
from typing import Iterable

def create(
env_dir: str | PathLike[str] = ..., *, scm_ignore_files=Iterable[str]
) -> None: ...
def main() -> None: ...
Empty file added microvenv/py.typed
Empty file.
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ def lint(session):
session.install(".[lint]")
session.run("ruff", "check", ".")
session.run("black", "--check", ".")
session.run("mypy", ".")
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ classifiers = [
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

[project.optional-dependencies]
test = ["pytest"]
lint = ["black", "ruff"]
lint = ["black", "mypy", "ruff"]

[project.urls]
Changelog = "https://github.com/brettcannon/microvenv/releases"
Source = "https://github.com/brettcannon/microvenv"


[tool.mypy]
ignore_missing_imports = true

0 comments on commit cf60109

Please sign in to comment.