Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typing to public API #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ showcontent = false
directory = "removal"
name = "Removals and Deprecations"
showcontent = true


[tool.mypy]
files = "src"
mypy_path = "src"
namespace_packages = true

[[tool.mypy.overrides]]
module = [
"shellingham.nt" # Mypy complains that ctypes has no windll on non-Windows machines
]
ignore_errors = true
12 changes: 11 additions & 1 deletion src/shellingham/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import importlib
import os

Expand All @@ -6,7 +8,15 @@
__version__ = "1.5.4"


def detect_shell(pid=None, max_depth=10):
__all__ = [
"ShellDetectionFailure",
"detect_shell",
]


def detect_shell(
pid: int | None = None, max_depth: int = 10
) -> tuple[int, int]:
name = os.name
try:
impl = importlib.import_module(".{}".format(name), __name__)
Expand Down
Empty file added src/shellingham/py.typed
Empty file.
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ deps =

commands =
pytest


[testenv:typing]
deps =
mypy
commands =
mypy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to also add mypy to CI?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since CI runs tox, wouldn't this be run in CI anyway?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won’t because you did not add it to envlist

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that means that tests are also not being run (and looking at CI logs, that is the case)

Loading