Python curses wheels for Windows
build-wheels.bat is original work.
Wheels built from this repository can be installed with this command:
pip install windows-curses
Starting with version 2.0, these wheels include a hack to make resizing work for Python applications that haven't been specifically adapted for PDCurses. See this commit. The description on PyPI has a longer explanation.
Note that this hack is not in Gohlke's wheels.
curses module is in the Python standard library, but is not available on
Windows. Trying to import
curses gives an import error for
is provided by
Modules/_cursesmodule.c in the CPython source code.
The wheels provided here are based on patches from
https://bugs.python.org/issue2889, which make minor modifications to
_cursesmodule.c to make it compatible with Windows and the
PDCurses curses implementation.
HAVE_* macros for features available in PDCurses and makes some minor
additional compatibility tweaks.
_cursesmodule.c is linked against PDCurses to produce a wheel
that provides the
_curses module on Windows and allows the standard
module to run.
The wheels are built with wide character support and force the encoding to
UTF8=y from the
nmake line in
build-wheels.bat to use the
default system encoding instead.
Clone the repository with the following command:
git clone --recurse-submodules https://github.com/zephyrproject-rtos/windows-curses.git
--recurse-submodulespulls in the required PDCurses Git submodule.
Install compilers compatible with the Python versions that you want to builds wheel for by following the instructions at https://wiki.python.org/moin/WindowsCompilers.
Visual Studio 2019 will work for Python 3.6-3.9.
Note: It is a good idea to install older compilers before newer ones. See the Troubleshooting section.
Install Python 3.6 or later to get the Python launcher for Windows.
Install any other Python versions you want to build wheels for.
Only the Python X.Y versions that have
pyXY\directories are supported.
setuptoolspackages for all Python versions. Taking Python 3.4 as an example, the following command will do it:
py -3.4 -m pip install --upgrade wheel setuptools
pyis the Python launcher, which makes it easy to run a particular Python version.
Open the Visual Studio Developer Command Prompt of the compiler required by the version of Python that you want to build a wheel for.
Use the 32-bit version (
x86 Native Tools Command Prompt for VS 2019) to build wheels for 32-bit Python versions, and the 64-bit version (e.g.
x64 Native Tools Command Prompt for VS 2019) to build wheels for 64-bit Python versions.
build-wheels.bat, passing it the Python version you're building a wheel for. For example, the following command will build a wheel for Python 3.6:
If you have both 32-bit and 64-bit versions of the same Python version installed and are building a 32-bit wheel, add "-32" to the version number, like in the following example:
If you are building multiple wheels for Python versions that are all compatible with the same compiler, you can list all of them in the same command:
build-wheels.bat 3.6 3.7
build-wheels.batfirst cleans and rebuilds PDCurses, and then builds and links the source code in
pyXY\for each of the specified Python versions, producing wheels as output in
Rebuilding the wheels for Python 3.6, 3.7, 3.8, and 3.9
x86 Native Tools Command Prompt for VS 2019:
build-wheels.bat 3.6-32 3.7-32 3.8-32 3.9-32
x64 Native Tools Command Prompt for VS 2019:
build-wheels.bat 3.6 3.7 3.8 3.9
This gives a set of wheels in
This building scheme above should be the safest one to use. In practice, many of the resulting wheels seem to be forwards- and backwards-compatible.
Uploading to PyPI
Don't forget to bump the version number in
setup.py before building new
wheels. Semantic versioning is intended.
Once the wheels are built, follow the instructions here to upload them to PyPI.
pip/PyPI will look at the wheel metadata and automatically install the right
version of the wheel.
Adding support for a new Python version
Create a new directory for the Python version, e.g.
Modules\_cursesmodule.cfrom the CPython source code to
Modules\clinic\_curses_panel.c.hfrom the CPython sources to
Modules\_cursesmodule.c from newer Python 3 versions is likely to be compatible with older Python 3 versions too. The Python 3.6 and 3.7 wheels are currently built from identical
_cursesmodule.c files (but not the Python 3.8 or 3.9 wheels).