{"id":16604626,"url":"https://github.com/andfoy/pywinpty","last_synced_at":"2025-04-04T22:03:11.111Z","repository":{"id":21535216,"uuid":"93204296","full_name":"andfoy/pywinpty","owner":"andfoy","description":"Pseudoterminals for Windows in Python","archived":false,"fork":false,"pushed_at":"2025-03-31T02:12:48.000Z","size":687,"stargazers_count":124,"open_issues_count":23,"forks_count":28,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-02T02:54:31.341Z","etag":null,"topics":["bindings","conda","conpty","console","pty","python","pywinpty","rust","windows","winpty","winpty-library","wrapper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andfoy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-02T21:13:42.000Z","updated_at":"2025-03-22T16:13:55.000Z","dependencies_parsed_at":"2023-01-14T13:10:53.585Z","dependency_job_id":"8799d7b3-6309-47d2-b40b-042c60b3d4ef","html_url":"https://github.com/andfoy/pywinpty","commit_stats":{"total_commits":650,"total_committers":15,"mean_commits":"43.333333333333336","dds":"0.27538461538461534","last_synced_commit":"694ad0b498b23b3386d1e30296f82a734c014fe3"},"previous_names":["spyder-ide/pywinpty"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andfoy%2Fpywinpty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andfoy%2Fpywinpty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andfoy%2Fpywinpty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andfoy%2Fpywinpty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andfoy","download_url":"https://codeload.github.com/andfoy/pywinpty/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256104,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","conda","conpty","console","pty","python","pywinpty","rust","windows","winpty","winpty-library","wrapper"],"created_at":"2024-10-12T00:58:32.443Z","updated_at":"2025-04-04T22:03:11.096Z","avatar_url":"https://github.com/andfoy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyWinpty: Pseudoterminals for Windows in Python\n\n[![Project License - MIT](https://img.shields.io/pypi/l/pywinpty.svg)](./LICENSE.txt)\n[![pypi version](https://img.shields.io/pypi/v/pywinpty.svg)](https://pypi.org/project/pywinpty/)\n[![conda version](https://img.shields.io/conda/vn/conda-forge/pywinpty.svg)](https://www.anaconda.com/download/)\n[![download count](https://img.shields.io/conda/dn/conda-forge/pywinpty.svg)](https://www.anaconda.com/download/)\n[![Downloads](https://pepy.tech/badge/pywinpty)](https://pepy.tech/project/pywinpty)\n[![PyPI status](https://img.shields.io/pypi/status/pywinpty.svg)](https://github.com/spyder-ide/pywinpty)\n[![Windows tests](https://github.com/andfoy/pywinpty/actions/workflows/windows_build.yml/badge.svg)](https://github.com/andfoy/pywinpty/actions/workflows/windows_build.yml)\n\n*Copyright © 2017–2022 Spyder Project Contributors*\n*Copyright © 2022– Edgar Andrés Margffoy Tuay*\n\n\n## Overview\n\nPyWinpty 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](https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/) interface and the previous, fallback [winpty](https://github.com/rprichard/winpty) library.\n\n\n## Dependencies\nTo compile pywinpty sources, you must have [Rust](https://rustup.rs/) installed.\nOptionally, you can also have Winpty's C header and library files available on your include path.\n\n\n## Installation\nYou can install this library by using conda or pip package managers, as it follows:\n\nUsing conda (Recommended):\n```bash\nconda install pywinpty\n```\n\nUsing pip:\n```bash\npip install pywinpty\n```\n\n## Building from source\n\nTo build from sources, you will require both a working stable or nightly Rust toolchain with\ntarget `x86_64-pc-windows-msvc`, which can be installed using [rustup](https://rustup.rs/).\n\nOptionally, this library can be linked against winpty library, which you can install using conda-forge:\n\n```batch\nconda install winpty -c conda-forge\n```\n\nIf you don't want to use conda, you will need to have the winpty binaries and headers available on your PATH.\n\nFinally, pywinpty uses [Maturin](https://github.com/PyO3/maturin) as the build backend, which can be installed using `pip`:\n\n```batch\npip install maturin\n```\n\nTo test your compilation environment settings, you can build pywinpty sources locally, by\nexecuting:\n\n```bash\nmaturin develop\n```\n\nThis package depends on the following Rust crates:\n\n* [PyO3](https://github.com/PyO3/pyo3): Library used to produce Python bindings from Rust code.\n* [WinPTY-rs](https://github.com/andfoy/winpty-rs): Create and spawn processes inside a pseudoterminal in Windows from Rust.\n* [Maturin](https://github.com/PyO3/maturin): Build system to build and publish Rust-based Python packages.\n\n## Package usage\nPywinpty offers a single python wrapper around winpty library functions.\nThis implies that using a single object (``winpty.PTY``) it is possible to access to all functionality, as it follows:\n\n```python\n# High level usage using `spawn`\nfrom winpty import PtyProcess\n\nproc = PtyProcess.spawn('python')\nproc.write('print(\"hello, world!\")\\r\\n')\nproc.write('exit()\\r\\n')\nwhile proc.isalive():\n\tprint(proc.readline())\n\n# Low level usage using the raw `PTY` object\nfrom winpty import PTY\n\n# Start a new winpty-agent process of size (cols, rows)\ncols, rows = 80, 25\nprocess = PTY(cols, rows)\n\n# Spawn a new console process, e.g., CMD\nprocess.spawn(br'C:\\windows\\system32\\cmd.exe')\n\n# Read console output (Unicode)\nprocess.read()\n\n# Write input to console (Unicode)\nprocess.write(b'Text')\n\n# Resize console size\nnew_cols, new_rows = 90, 30\nprocess.set_size(new_cols, new_rows)\n\n# Know if the process is alive\nalive = process.isalive()\n\n# End winpty-agent process\ndel process\n```\n\n## Running tests\nWe use pytest to run tests as it follows (after calling ``maturin develop``), the test suite depends\non pytest-lazy-fixture, which can be installed via pip:\n\n```batch\npip install pytest pytest-lazy-fixture flaky\n```\n\nAll the tests can be exceuted using the following command\n\n```bash\npython runtests.py\n```\n\n\n## Changelog\nVisit our [CHANGELOG](CHANGELOG.md) file to learn more about our new features and improvements.\n\n\n## Contribution guidelines\nWe 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandfoy%2Fpywinpty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandfoy%2Fpywinpty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandfoy%2Fpywinpty/lists"}