Skip to content

Commit

Permalink
Add support for Windows
Browse files Browse the repository at this point in the history
Also add Python 3.12.

Closes #46
  • Loading branch information
brettcannon committed Oct 12, 2023
1 parent 7085e42 commit 408de40
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos"]
os: ["ubuntu", "macos", "windows"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ API

Analogous to calling :py:func:`venv.create` as
``venv.create(..., symlinks=True, with_pip=False)``.

.. note:: Not available on Windows.
2 changes: 2 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CLI
====

.. note:: Not available on Windows.

.. include:: help.txt
:literal:
4 changes: 3 additions & 1 deletion microvenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

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

if sys.platform != "win32":
from ._create import create as create

# https://docs.python.org/3/library/venv.html#how-venvs-work
IN_VIRTUAL_ENV = sys.prefix != sys.base_prefix
Expand Down
2 changes: 0 additions & 2 deletions microvenv/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ from typing import TypedDict

IN_VIRTUAL_ENV: bool

DEFAULT_ENV_DIR: str

class ActivationError(Exception): ...

def parse_config(env_dir: str | PathLike[str]) -> dict[str, str]: ...
Expand Down
10 changes: 6 additions & 4 deletions microvenv/_create.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from os import PathLike
import sys
from typing import Iterable

DEFAULT_ENV_DIR: str

def create(
env_dir: str | PathLike[str] = ..., *, scm_ignore_files=Iterable[str]
) -> None: ...
def main() -> None: ...
if sys.platform != "win32":
def create(
env_dir: str | PathLike[str] = ..., *, scm_ignore_files=Iterable[str]
) -> None: ...
def main() -> None: ...
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import nox # type: ignore


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
def test(session):
session.install(".[test]")
session.run("pytest")
Expand Down
4 changes: 4 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import os
import subprocess
import sys

import pytest

import microvenv

if sys.platform == "win32":
pytest.skip("Windows is not supported.", allow_module_level=True)


@pytest.fixture
def CLI(executable):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import microvenv
import microvenv._create

if sys.platform == "win32":
pytest.skip("Windows is not supported.", allow_module_level=True)


@pytest.fixture
def base_executable():
Expand Down

0 comments on commit 408de40

Please sign in to comment.