Skip to content

Commit

Permalink
Get mypy passing under Windows (#58)
Browse files Browse the repository at this point in the history
Closes #56
  • Loading branch information
brettcannon authored Oct 18, 2023
1 parent d32ca9d commit 7cdcf90
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu", "macos", "windows"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand All @@ -20,7 +20,10 @@ jobs:
# Set up as a separate job for a very small amount of parallelism and to
# avoid running multiple times under each OS like we do for testing.
lint:
runs-on: "ubuntu-latest"
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "windows"] # Due to having different APIs.

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions microvenv/__main__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import sys

if sys.platform == "win32":
print("Microvenv's CLI is not supported on Windows", file=sys.stderr)
sys.exit(1)

from ._create import main

if __name__ == "__main__":
if sys.platform == "win32":
print("Microvenv's CLI is not supported on Windows", file=sys.stderr)
sys.exit(1)

main()
Empty file added microvenv/__main__.pyi
Empty file.
10 changes: 4 additions & 6 deletions microvenv/_create.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from os import PathLike
import sys
from typing import Iterable

DEFAULT_ENV_DIR: str

if sys.platform != "win32":
def create(
env_dir: str | PathLike[str] = ..., *, scm_ignore_files=Iterable[str]
) -> None: ...
def main() -> None: ...
def create(
env_dir: str | PathLike[str] = ..., *, scm_ignore_files=Iterable[str]
) -> None: ...
def main() -> None: ...
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ build-backend = "hatchling.build"

[project]
name = "microvenv"
version = "2023.4"
version = "2023.5"
description = "A minimal re-implementation of Python's venv module plus utilities"
keywords = ["virtual environments", "venv"]
readme = "README.md"
license = { file = "LICENSE" }
maintainers = [{ name = "Brett Cannon", email = "[email protected]" }]
authors = [{ name = "Brett Cannon", email = "[email protected]" }]
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
Expand Down
5 changes: 4 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def executable():
@pytest.fixture(scope="session")
def full_venv(tmp_path_factory):
"""Create a virtual environment via venv."""
symlinks = sys.platform != "win32"
venv_path = tmp_path_factory.mktemp("venvs") / "full_venv"
venv.create(venv_path, symlinks=True, with_pip=False, system_site_packages=False)
venv.create(
venv_path, symlinks=symlinks, with_pip=False, system_site_packages=False
)
return venv_path

0 comments on commit 7cdcf90

Please sign in to comment.