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.2

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.2
File Size Uploaded Provenance Actions
pywinpty-3.1.2.tar.gz 38.4 kB Without provenance Details for pywinpty-3.1.2.tar.gz

Built distributions (wheels)

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

Total release size: 23.6 MB

Release files / pywinpty-3.1.2.tar.gz

Download URL pywinpty-3.1.2.tar.gz
Size 38.4 kB
Tags Source
SHA-256 checksum
How to use checksums
03e2d2abe7c0df64db354233c83479b2b43d9fdd1badceea994259ca3819b203
BLAKE2b-256 checksum
How to use checksums
0c2292b945dd2975275eb21e938524f265bc55a0f2c009de64c2cce6c7f1abc1
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.2-cp315-cp315t-win_arm64.whl

Download URL pywinpty-3.1.2-cp315-cp315t-win_arm64.whl
Size 830.7 kB
Tags CPython 3.15 CPython 3.15 free-threading Windows ARM64
SHA-256 checksum
How to use checksums
0a40537712279ed74d5884b1af9037add1ed4b2e2339e9152268b582abad3a57
BLAKE2b-256 checksum
How to use checksums
1562f1109ffb61549598f519bdf802bf1b3123736d059940b192d1d088c68ede
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.2-cp315-cp315t-win_amd64.whl

Download URL pywinpty-3.1.2-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
ed5c5ca288001590fbf1d5a52c6389f0f6ae7e4751bdc8b2f8f9c7249f266f9b
BLAKE2b-256 checksum
How to use checksums
0a3776b4b8e9b1101659ba2363b80597309505a93238233ec101dc2b84488c8f
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.2-cp315-cp315-win_arm64.whl

Download URL pywinpty-3.1.2-cp315-cp315-win_arm64.whl
Size 830.9 kB
Tags CPython 3.15 Windows ARM64
SHA-256 checksum
How to use checksums
7af19f25e769f0c70f5920ce0964c508abdfe01e676cf05d5ed935848d8c782e
BLAKE2b-256 checksum
How to use checksums
83fb50e01614512e79abd5af65cc380d6d470062794a5ae4fb49fb683d661d09
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.2-cp315-cp315-win_amd64.whl

Download URL pywinpty-3.1.2-cp315-cp315-win_amd64.whl
Size 2.1 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
b8c47556fbf19595898dd75f45763072ff1160b080eefabeae8cc43c5acbd720
BLAKE2b-256 checksum
How to use checksums
f7f9f1dee749c60f19cb4cfb89b5dac5b13ca9689091e8f13498d4d7649c30c8
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.2-cp314-cp314t-win_arm64.whl

Download URL pywinpty-3.1.2-cp314-cp314t-win_arm64.whl
Size 830.6 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows ARM64
SHA-256 checksum
How to use checksums
30235f396856fbc03c9bb181b4e27bf50f7b355e432e5731729063d920a09867
BLAKE2b-256 checksum
How to use checksums
a11784bbe1a907417ae4971394f2ef48b62ac738f01e5bd61f0b0ba84838c37b
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.2-cp314-cp314t-win_amd64.whl

Download URL pywinpty-3.1.2-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
fe0abcffd095642c78ba7c6abf4cc8129dce9568e97a1c9194eea23383d0de29
BLAKE2b-256 checksum
How to use checksums
d6f7c6f81de3c60a93cb8357c4f86a5539d914539a46507f16b8abc3090d1aaa
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.2-cp314-cp314-win_arm64.whl

Download URL pywinpty-3.1.2-cp314-cp314-win_arm64.whl
Size 830.7 kB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
81d83678211cc6f8cd2954e98a8a18d8e5de1e0666900a1df8da70f33572d34d
BLAKE2b-256 checksum
How to use checksums
416901fb5ce4e563ff60d8093812a5e70a3234362b38f77edeb2f1d89057b73c
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.2-cp314-cp314-win_amd64.whl

Download URL pywinpty-3.1.2-cp314-cp314-win_amd64.whl
Size 2.1 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
980af688956fe78c87882682732e6eea45aa0b8d10a9628812e95878264d5204
BLAKE2b-256 checksum
How to use checksums
0dc6c6c174b6ef198de4057ea6ec5a653ae42e7f1505d84f34dad824e833b066
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.2-cp313-cp313-win_arm64.whl

Download URL pywinpty-3.1.2-cp313-cp313-win_arm64.whl
Size 830.6 kB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
804e90d912ba17a246972209c6ae0358ef7c9fe958c2e5388183521113e9131e
BLAKE2b-256 checksum
How to use checksums
db8694b3adadfea3304a8105ff8462024bfd9dd47af4915464ca4d25950773b1
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.2-cp313-cp313-win_amd64.whl

Download URL pywinpty-3.1.2-cp313-cp313-win_amd64.whl
Size 2.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d968dc4300b497f048318387781ed9931dc0038815f25b4f642a1749448769cb
BLAKE2b-256 checksum
How to use checksums
4445d6fbce17940d8ed00d59d5fb5add752996a17e8018914f69fffc8a23209b
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.2-cp312-cp312-win_arm64.whl

Download URL pywinpty-3.1.2-cp312-cp312-win_arm64.whl
Size 831.1 kB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
50e6504a1d616542036221e3ae38363600b6839f958142c1950a661c938b3a1e
BLAKE2b-256 checksum
How to use checksums
2e695721b80a1963887e539dc60eb46ea2e0f5edd6adb268b5dfa7bd15be46c6
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.2-cp312-cp312-win_amd64.whl

Download URL pywinpty-3.1.2-cp312-cp312-win_amd64.whl
Size 2.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
220e30a8cccd7f0be3356d4e3e56fdcda2ae45edc1de526b440c4031fe9308da
BLAKE2b-256 checksum
How to use checksums
cedde5ee2cc1295fc76ad8cd26ae4ec001358edbc9d4c4e7a465c136133d38cf
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.2-cp311-cp311-win_arm64.whl

Download URL pywinpty-3.1.2-cp311-cp311-win_arm64.whl
Size 833.5 kB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
0cd10bc1a08dbb92c8d951f042c93510394862e08a7d1e5d5a3514f798cfdb0e
BLAKE2b-256 checksum
How to use checksums
511c334a3a97c715bf5427e5c0ead0ff07d4d02d352c39aa1a7b5bd7122069c4
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.2-cp311-cp311-win_amd64.whl

Download URL pywinpty-3.1.2-cp311-cp311-win_amd64.whl
Size 2.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
a58997fa8519694725dca4a297aa7bebada3675263742cfb12fbc5eb09d466e7
BLAKE2b-256 checksum
How to use checksums
95518888f89c6bfe07fd8be731d3de26a3ca52d06c7a5094168ff39f3e004637
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.2-cp310-cp310-win_arm64.whl

Download URL pywinpty-3.1.2-cp310-cp310-win_arm64.whl
Size 833.4 kB
Tags CPython 3.10 Windows ARM64
SHA-256 checksum
How to use checksums
6b351d5853e0899179f1e82a53c5ebd0d6ea8dca023f1b7f7082f2837002018a
BLAKE2b-256 checksum
How to use checksums
6d0b0272bfbcec4bf0242b66eb4118392c4c98b7a52ececb639ad79e1132fc58
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.2-cp310-cp310-win_amd64.whl

Download URL pywinpty-3.1.2-cp310-cp310-win_amd64.whl
Size 2.1 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
197cb43a5a1c6ed5836907fdcb3f008883386bcdaa05ae0cfdf4848b3624e237
BLAKE2b-256 checksum
How to use checksums
eff819ad3038bca2ffc0cc54b143a05542b873523ad4b249d7e52f753c9ef3be
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.2

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.2 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