Skip to main content

PyWinpty: Pseudoterminals for Windows in Python

Project License - MIT pypi version conda version download count Downloads PyPI status Windows tests

Copyright © 2017–2022 Spyder Project Contributors Copyright © 2022– Edgar Andrés Margffoy Tuay

Overview

PyWinpty allows creating and communicating with Windows processes that receive input and print outputs via console input and output pipes. PyWinpty supports both the native ConPTY interface and the previous, fallback winpty library.

Dependencies

To compile pywinpty sources, you must have Rust installed. Optionally, you can also have Winpty's C header and library files available on your include path.

Installation

You can install this library by using conda or pip package managers, as it follows:

Using conda (Recommended):

conda install pywinpty

Using pip:

pip install pywinpty

Building from source

To build from sources, you will require both a working stable or nightly Rust toolchain with target x86_64-pc-windows-msvc, which can be installed using rustup.

Optionally, this library can be linked against winpty library, which you can install using conda-forge:

conda install winpty -c conda-forge

If you don't want to use conda, you will need to have the winpty binaries and headers available on your PATH.

Finally, pywinpty uses Maturin as the build backend, which can be installed using pip:

pip install maturin

To test your compilation environment settings, you can build pywinpty sources locally, by executing:

maturin develop

This package depends on the following Rust crates:

  • PyO3: Library used to produce Python bindings from Rust code.
  • WinPTY-rs: Create and spawn processes inside a pseudoterminal in Windows from Rust.
  • Maturin: Build system to build and publish Rust-based Python packages.

Package usage

Pywinpty offers a single python wrapper around winpty library functions. This implies that using a single object (winpty.PTY) it is possible to access to all functionality, as it follows:

# High level usage using `spawn`
from winpty import PtyProcess

proc = PtyProcess.spawn('python')
proc.write('print("hello, world!")\r\n')
proc.write('exit()\r\n')
while proc.isalive():
	print(proc.readline())

# Low level usage using the raw `PTY` object
from winpty import PTY

# Start a new winpty-agent process of size (cols, rows)
cols, rows = 80, 25
process = PTY(cols, rows)

# Spawn a new console process, e.g., CMD
process.spawn(br'C:\windows\system32\cmd.exe')

# Read console output (Unicode)
process.read()

# Write input to console (Unicode)
process.write(b'Text')

# Resize console size
new_cols, new_rows = 90, 30
process.set_size(new_cols, new_rows)

# Know if the process is alive
alive = process.isalive()

# End winpty-agent process
del process

Running tests

We use pytest to run tests as it follows (after calling maturin develop), the test suite depends on pytest-lazy-fixture, which can be installed via pip:

pip install pytest pytest-lazy-fixture flaky

All the tests can be executed using the following command

python runtests.py

Changelog

Visit our CHANGELOG file to learn more about our new features and improvements.

Contribution guidelines

We follow PEP8 and PEP257 for pure python packages and Rust to compile extensions. We use MyPy type annotations for all functions and classes declared on this package. Feel free to send a PR or create an issue if you have any problem/question.

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Metadata

Release files for pywinpty 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywinpty 3.1.1
File Size Uploaded Provenance Actions
pywinpty-3.1.1.tar.gz 36.4 kB Without provenance Details for pywinpty-3.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pywinpty 3.1.1
File Actions
pywinpty-3.1.1-cp315-cp315t-win_arm64.whl CPython 3.15 CPython 3.15 free-threading Windows ARM64 Details for pywinpty-3.1.1-cp315-cp315t-win_arm64.whl
pywinpty-3.1.1-cp315-cp315t-win_amd64.whl CPython 3.15 CPython 3.15 free-threading Windows x86-64 Details for pywinpty-3.1.1-cp315-cp315t-win_amd64.whl
pywinpty-3.1.1-cp315-cp315-win_arm64.whl CPython 3.15 CPython 3.15 Windows ARM64 Details for pywinpty-3.1.1-cp315-cp315-win_arm64.whl
pywinpty-3.1.1-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for pywinpty-3.1.1-cp315-cp315-win_amd64.whl
pywinpty-3.1.1-cp314-cp314t-win_arm64.whl CPython 3.14 CPython 3.14 free-threading Windows ARM64 Details for pywinpty-3.1.1-cp314-cp314t-win_arm64.whl
pywinpty-3.1.1-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details for pywinpty-3.1.1-cp314-cp314t-win_amd64.whl
pywinpty-3.1.1-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details for pywinpty-3.1.1-cp314-cp314-win_arm64.whl
pywinpty-3.1.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for pywinpty-3.1.1-cp314-cp314-win_amd64.whl
pywinpty-3.1.1-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details for pywinpty-3.1.1-cp313-cp313-win_arm64.whl
pywinpty-3.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pywinpty-3.1.1-cp313-cp313-win_amd64.whl
pywinpty-3.1.1-cp312-cp312-win_arm64.whl CPython 3.12 CPython 3.12 Windows ARM64 Details for pywinpty-3.1.1-cp312-cp312-win_arm64.whl
pywinpty-3.1.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pywinpty-3.1.1-cp312-cp312-win_amd64.whl
pywinpty-3.1.1-cp311-cp311-win_arm64.whl CPython 3.11 CPython 3.11 Windows ARM64 Details for pywinpty-3.1.1-cp311-cp311-win_arm64.whl
pywinpty-3.1.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pywinpty-3.1.1-cp311-cp311-win_amd64.whl
pywinpty-3.1.1-cp310-cp310-win_arm64.whl CPython 3.10 CPython 3.10 Windows ARM64 Details for pywinpty-3.1.1-cp310-cp310-win_arm64.whl
pywinpty-3.1.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for pywinpty-3.1.1-cp310-cp310-win_amd64.whl

Total release size: 23.5 MB

Release files / pywinpty-3.1.1.tar.gz

Download URL pywinpty-3.1.1.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
11a5be70f45597ce8fc154e38399a95db4864adce98a0b53a843711fdbb9e7ba
BLAKE2b-256 checksum
How to use checksums
c027ce402aa02b9150bb8f75e56dfa540ee907991404879d8ad8d195502869c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / pywinpty-3.1.1-cp315-cp315t-win_arm64.whl

Download URL pywinpty-3.1.1-cp315-cp315t-win_arm64.whl
Size 828.3 kB
Tags CPython 3.15 CPython 3.15 free-threading Windows ARM64
SHA-256 checksum
How to use checksums
549b6927488017258718387e17cb361f622ae3faf988e79875392dd1151e3aca
BLAKE2b-256 checksum
How to use checksums
ed304f0373d5cbb2640a4c9bce6505bd28efc8ef33de0a8ba24aabaa1396c48a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / pywinpty-3.1.1-cp315-cp315t-win_amd64.whl

Download URL pywinpty-3.1.1-cp315-cp315t-win_amd64.whl
Size 2.1 MB
Tags CPython 3.15 CPython 3.15 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
34d7a543e4932e19c078ef03f69947a1ffddd9c08a137f56dbe662486782bf31
BLAKE2b-256 checksum
How to use checksums
59816edfccc995fc4c3cda81a6eb0f40bdad25fa0c0c3c4a32b89099b9167d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / pywinpty-3.1.1-cp315-cp315-win_arm64.whl

Download URL pywinpty-3.1.1-cp315-cp315-win_arm64.whl
Size 828.3 kB
Tags CPython 3.15 Windows ARM64
SHA-256 checksum
How to use checksums
015283ea268d53bdcafdbf38edc007d8b9e33be52700c63167cf8c2ca0498f50
BLAKE2b-256 checksum
How to use checksums
4590ae33a7901877a1c3f7dba4ca7b6390b29705a080f210e7b7099e8ce52c2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / pywinpty-3.1.1-cp315-cp315-win_amd64.whl

Download URL pywinpty-3.1.1-cp315-cp315-win_amd64.whl
Size 2.1 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
c483457c162fdeb59bcb3e17df9a6ea0146e5c6c1768b9b73f7a5f5c3929ba69
BLAKE2b-256 checksum
How to use checksums
d41ed8c69f9a098f22a7cf5bd25cce5cfc5dedd97d5772f5d92d71e406cd5fd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / pywinpty-3.1.1-cp314-cp314t-win_arm64.whl

Download URL pywinpty-3.1.1-cp314-cp314t-win_arm64.whl
Size 828.1 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows ARM64
SHA-256 checksum
How to use checksums
c017b5868b1d9975770f41b8e115c7be06e9dcc2385f10ba62780559249f5f98
BLAKE2b-256 checksum
How to use checksums
6ab5befe62c1d7db9f9a373307bd4444603dad7223fc0cee7d99bb7b69b60db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pywinpty-3.1.1-cp314-cp314t-win_amd64.whl

Download URL pywinpty-3.1.1-cp314-cp314t-win_amd64.whl
Size 2.1 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
4b2aa07e260dabe37cc454821ed2755d35ea13015c5e127f7d087e18dd2a5650
BLAKE2b-256 checksum
How to use checksums
c1bcb9731bcb92f7482311fe6fb49ef586d5de15bbf1599f500637a4f19c5ec5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / pywinpty-3.1.1-cp314-cp314-win_arm64.whl

Download URL pywinpty-3.1.1-cp314-cp314-win_arm64.whl
Size 828.1 kB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
4a0d47afe0e3642a2d04775e157de5dad1d63853905816994e4b0db2083476f4
BLAKE2b-256 checksum
How to use checksums
32ab29bf21e0160cbd86bddb99515f4a74bafc5046691b3831144fbff1a4e43b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pywinpty-3.1.1-cp314-cp314-win_amd64.whl

Download URL pywinpty-3.1.1-cp314-cp314-win_amd64.whl
Size 2.1 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
c737cefc5e535a3b6825b653a8d5267ca71820057a7e5414bed4bc0bbfc78874
BLAKE2b-256 checksum
How to use checksums
679a34b0dd29691b9293af3164af99e01b035d8a2d35dea533b558b9eb6d1593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / pywinpty-3.1.1-cp313-cp313-win_arm64.whl

Download URL pywinpty-3.1.1-cp313-cp313-win_arm64.whl
Size 828.2 kB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
936f80af9a8a29c875cebcea72a1717c285a37dc2989a3390506f094ffac361d
BLAKE2b-256 checksum
How to use checksums
e841bb857a0847fa3ce837ee070f211ce0ee7f1be171870329b5d4a6e06afccc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0

Release files / pywinpty-3.1.1-cp313-cp313-win_amd64.whl

Download URL pywinpty-3.1.1-cp313-cp313-win_amd64.whl
Size 2.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ab527152d3eae13466f88d762f7335cae580b4afe1729b44ca9cb2919c7d1ebf
BLAKE2b-256 checksum
How to use checksums
7c597f17cae608748e93deab8ff6eae737b5f6d13c548759edf394c244d7ada2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / pywinpty-3.1.1-cp312-cp312-win_arm64.whl

Download URL pywinpty-3.1.1-cp312-cp312-win_arm64.whl
Size 828.6 kB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
4486c84321d68030f5aa1556425aa0d4168520ae9c5260739bb74f8dfb5533fc
BLAKE2b-256 checksum
How to use checksums
5d9483ff744093505bb48eeac44cdb6ddf6b2cd386842dc68ad910ffb3b08100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / pywinpty-3.1.1-cp312-cp312-win_amd64.whl

Download URL pywinpty-3.1.1-cp312-cp312-win_amd64.whl
Size 2.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f06a4778e1b7f7b05abf3e22af38cdda0295a9106675d2d2a03c43351ef05868
BLAKE2b-256 checksum
How to use checksums
a84d8185fe80a32d7805c30c1b2dcb5bdb8de3f1568de86c8bc673dd631e2a9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / pywinpty-3.1.1-cp311-cp311-win_arm64.whl

Download URL pywinpty-3.1.1-cp311-cp311-win_arm64.whl
Size 831.2 kB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
6304ce6155f654b2a21b2214ff6a695cc290b9239e138d3ce08a0193c873ec44
BLAKE2b-256 checksum
How to use checksums
e8c5184fe06817518fa3a3487fd164819c2da02405a481f8377d20e918d12179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / pywinpty-3.1.1-cp311-cp311-win_amd64.whl

Download URL pywinpty-3.1.1-cp311-cp311-win_amd64.whl
Size 2.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
16456b0ae9566c88377af74eaa9a444686695d64e94af2ed80980a777d06de32
BLAKE2b-256 checksum
How to use checksums
713277ea2dbb5e28787bd15498ce65b72c35f2d6a6ac47906b9b8793265695b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pywinpty-3.1.1-cp310-cp310-win_arm64.whl

Download URL pywinpty-3.1.1-cp310-cp310-win_arm64.whl
Size 831.3 kB
Tags CPython 3.10 Windows ARM64
SHA-256 checksum
How to use checksums
b00a377cc4b4dc925af0706a84e19e0bd57a0a0cd1bac6f69e102b8707b29236
BLAKE2b-256 checksum
How to use checksums
91bf21f69eb90b92f836d96f79dfaeb4f0d90b74f770c03e76974ca70b1ad265
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.0

Release files / pywinpty-3.1.1-cp310-cp310-win_amd64.whl

Download URL pywinpty-3.1.1-cp310-cp310-win_amd64.whl
Size 2.1 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
632e17c53e817e264f80ebc5f252a55cf4369c85324dbd66b838841b0d651e55
BLAKE2b-256 checksum
How to use checksums
33110bf1d98a7d1f099171b3fc0a0583894bbca9fff554c673600746b90addc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for pywinpty 3.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.1.1 This release

17 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page