• Stars
    star
    155
  • Rank 234,536 (Top 5 %)
  • Language
    C
  • License
    Other
  • Created about 6 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Windows Curses Python module

Python curses wheels for Windows

Latest Version Supported Python Implementations

This is the repository for the windows-curses wheels on PyPI. The wheels are based on the wheels on Christoph Gohlke's page.

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

Maintainers Wanted

This project is not actively maintained and is looking for maintainers.

If you are interested, please let us know by either creating an issue here or messaging in the #windows-support channel on Zephyr Discord.

Background

The curses module is in the Python standard library, but is not available on Windows. Trying to import curses gives an import error for _curses, which 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. setup.py defines HAVE_* macros for features available in PDCurses and makes some minor additional compatibility tweaks.

The patched _cursesmodule.c is linked against PDCurses to produce a wheel that provides the _curses module on Windows and allows the standard curses module to run.

Unicode support

The wheels are built with wide character support and force the encoding to UTF-8. Remove UTF8=y from the nmake line in build-wheels.bat to use the default system encoding instead.

Build instructions

  1. Clone the repository with the following command:

    git clone --recurse-submodules https://github.com/zephyrproject-rtos/windows-curses.git
    

    --recurse-submodules pulls in the required PDCurses Git submodule.

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

    Visual Studio 2022 will work for Python 3.10-3.11.

  3. Install Python 3.6 or later to get the Python launcher for Windows.

  4. Install any other Python versions you want to build wheels for.

    Only the Python X.Y versions that have pyXY\ directories are supported.

  5. Install/upgrade the wheel and setuptools packages for all Python versions. Taking Python 3.6 as an example, the following command will do it:

    py -3.6 -m pip install --upgrade wheel setuptools
    

    py is the Python launcher, which makes it easy to run a particular Python version.

  6. 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 2022) to build wheels for 32-bit Python versions, and the 64-bit version (e.g. x64 Native Tools Command Prompt for VS 2022) to build wheels for 64-bit Python versions.

  7. Run 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:

    build-wheels.bat 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:

    build-wheels.bat 3.6-32
    

    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.bat first 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 dist\.

Rebuilding the wheels for Python 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11

In x86 Native Tools Command Prompt for VS 2022:

build-wheels.bat 3.6-32 3.7-32 3.8-32 3.9-32 3.10-32 3.11-32

In x64 Native Tools Command Prompt for VS 2022:

build-wheels.bat 3.6 3.7 3.8 3.9 3.10 3.11

This gives a set of wheels in dist\.

Compatibility note

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.

Making a new release

  1. Bump the version number in setup.py according to the Semantic versioning.

  2. Create a Git tag for the release:

    git tag -s -m "windows-curses 1.2.3" v1.2.3
    git push upstream v1.2.3
    

    For pre-releases, add aNUMBER after the release name (e.g. v1.2.3a1, v1.2.3a2, ...).

  3. Create a GitHub release from the tag.

    The name of the GitHub release should match the name of the release tag (e.g. v1.2.3) and its body should contain a brief release note.

Once a GitHub release is created, the GitHub Actions CI will automatically build and upload the wheels to the PyPI.

Uploading to PyPI

NOTE: The process of uploading wheels for releases is automated using the GitHub Actions and manual uploads should not be necessary under normal circumstances.

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

  1. Create a new directory for the Python version, e.g. py39\

  2. Copy Modules\_cursesmodule.c from the CPython source code to py39\_cursesmodule.c

  3. Apply the PDCurses compatibility patch from this commit and the resizing hack from this commit to the new py39\_cursesmodule.c.

  4. Copy Modules\_curses_panel.c, Modules\clinic\_cursesmodule.c.h, and Modules\clinic\_curses_panel.c.h from the CPython sources to py39\_curses_panel.c, py39\clinic\_cursesmodule.c.h and py39\clinic\_curses_panel.c.h, respectively

  5. Add the build specifications for the new Python version in .github/workflows/ci.yml.

In practise, 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).

For Python 3.10 and 3.11 it is necessary to adapt _cursesmodule.c and clinic\_cursesmodule.c.h files to new Python API (decribed more here https://devguide.python.org/c-api). It demands removing two headers files as described in this commit.

More Repositories

1

zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
C
9,864
star
2

west

West, Zephyr's meta-tool
Python
203
star
3

example-application

Example out-of-tree application that is also a module
C
196
star
4

sdk-ng

Zephyr SDK (Toolchains, Development Tools)
C
165
star
5

docker-image

Docker image suitable for Zephyr development and CI
Shell
130
star
6

zscilib

An open-source scientific computing library for embedded systems running Zephyr OS or standalone.
C
123
star
7

hal_stm32

C
91
star
8

liblc3codec

LC3 codec implementation
C++
59
star
9

lvgl

C
56
star
10

meta-zephyr-sdk

Zephyr SDK (obsolete)
C
45
star
11

hal_espressif

HAL and SDK for ESP32 and other hardware from Espressif
C
41
star
12

gsoc-2022-arduino-core

Arduino Core Zephyr Module (GSoC 2022 Project)
C++
40
star
13

net-tools

Network tools for testing with Qemu
C
29
star
14

hal_nxp

HAL module for NXP SoCs
C
29
star
15

openthread

openthread module for Zephyr, not a mirror of the official openthread repository
C++
28
star
16

mcumgr

Upstream repo is https://github.com/apache/mynewt-mcumgr
C
27
star
17

openocd

OpenOCD with Zephyr patches for building Zephyr SDK
C
26
star
18

trusted-firmware-m

Zephyr repository tracking https://git.trustedfirmware.org/trusted-firmware-m.git/
C
26
star
19

rtos-benchmark

RTOS Benchmark
C
25
star
20

hal_nordic

C
22
star
21

jlink-zephyr

J-Link Zephyr RTOS plugin
C
22
star
22

loramac-node

Zephyr repository tracking https://github.com/Lora-net/LoRaMac-node
C
19
star
23

mbedtls

mbedtls module for Zephyr, this is not a mirror of the official mbedtls repository.
C
16
star
24

eclipse-plugin

Zephyr Eclipse Plugin
Java
15
star
25

python-devicetree

Python devicetree library
Python
14
star
26

littlefs

littlefs module for Zephyr, not a mirror of the official littlefs repository
C
13
star
27

hal_st

C
12
star
28

zephyr-testing

Test Repo, Do not clone! Use zephyr repo instead
C
12
star
29

hal_atmel

C
11
star
30

twister

[DEPRICATED] Project won't be continued.
Python
10
star
31

fatfs

This implementation of file system is developed by ELM Chan
C
10
star
32

gsoc-2022-thrift

Thrift Zephyr Module (GSoC 2022 Project)
C++
10
star
33

canopennode

Zephyr repository tracking https://github.com/CANopenNode/CANopenNode
C
9
star
34

hal_infineon

HAL for Infineon ICs
C
9
star
35

ci-tools

CI Tools and Scripts (obsolete)
Python
9
star
36

open-amp

open-amp module for zephyr, this is not an official mirror of the open-amp repo
C
9
star
37

infrastructure-old

Zephyr Infrastructure Issue Tracker (obsolete)
8
star
38

libmetal

The libmetal module specific for use with Zephyr. This is not a mirror of the official libmetal repo.
C
8
star
39

cmsis

Zephyr repository tracking https://github.com/ARM-software/CMSIS_5
C
8
star
40

reqmgmt

Python
7
star
41

hal_ti

C
7
star
42

hal_silabs

C
7
star
43

action-zephyr-setup

GitHub Action to set up Zephyr build environment
7
star
44

qm

Quality Management and QA/Verification plans and reports
Perl
7
star
45

chre

Context Hub Runtime Environment (CHRE)
C++
6
star
46

segger

C
6
star
47

test_results

Consolidated test results
Python
6
star
48

hal_gigadevice

HAL for GigaDevice devices
C
6
star
49

ci-dockerfiles

The content of this repository has moved to https://github.com/zephyrproject-rtos/docker-image
6
star
50

oss-eu-2022-zephyr-app

Application for the OSS EU 2022 Zephyr Mini-Summit
C
6
star
51

action-manifest

Python
6
star
52

mipi-sys-t

C
6
star
53

hal_microchip

HAL module for Microchip devices
C
5
star
54

nffs

C
4
star
55

hal_xtensa

Zephyr repository tracking https://github.com/foss-xtensa/xtensa-hal
C
4
star
56

uoscore-uedhoc

Zephyr downstream of https://github.com/eriptic/uoscore-uedhoc
C
3
star
57

hal_renesas

HAL for Renesas devices
C
3
star
58

optiga-trust

Zephyr repository tracking Infineon's Optiga Trust X and M frameworks
3
star
59

hal_wurthelektronik

HAL for Wรผrth Elektronik devices
C
3
star
60

nrf_hw_models

Mirror of https://github.com/BabbleSim/ext_NRF_hw_models/ (PRs or issues should be filed there)
C
3
star
61

hal_altera

C
3
star
62

hal_ethos_u

HAL for Arm Ethos-U NPUs
C++
3
star
63

hal_nuvoton

HAL module for Nuvoton ICs
C
2
star
64

tf-m-tests

Zephyr repository tracking https://git.trustedfirmware.org/TF-M/tf-m-tests.git
C
2
star
65

action_scancode

Python
2
star
66

git2cl

Perl
2
star
67

system-dt-playground

Temp repo for sharing activities around system devicetree and Zephyr
C
2
star
68

proposals

Zephyr Enhancement Proposals and Blue Prints
2
star
69

hal_unisoc

C
2
star
70

docker-scancode

Docker image with scanode for Github actions
Dockerfile
2
star
71

tinycrypt

Zephyr repository tracking https://github.com/intel/tinycrypt
C
2
star
72

newlib-cygwin

Newlib source for building Zephyr SDK
C
2
star
73

hal_nrfx

DEPRECATED repository. Do **not** change or delete.
C
2
star
74

hal_quicklogic

HAL for QuickLogic devices
C
1
star
75

hardware_test_results

A repo for collecting test results and for managing validation reports.
Python
1
star
76

hal_cypress

HAL module for Cypress devices
C
1
star
77

docker-image-testing

For testing purpose only.
Shell
1
star
78

hal_qmsi

C
1
star
79

esp-idf

C
1
star
80

sdk-ng-testing

For testing purposes only.
C
1
star
81

.github

Special repository for GitHub public organisation profile
1
star
82

swg-scripts

Security Working Group Scripts
Rust
1
star
83

ci-test

This repository is obsolete
Shell
1
star
84

libjaylink

C
1
star
85

tests_influx_grafana

Used for footprint tracking
Python
1
star
86

edtt

Mirror of https://github.com/EDTTool/EDTT (PRs or issues should be filed there)
Python
1
star
87

docker-ci-internal

Private Docker image for Zephyr CI (inactive, for testing only)
Dockerfile
1
star
88

babblesim-manifest

Automated replica of https://github.com/BabbleSim/bsim_west. Send PR or issues there.
1
star
89

infrastructure

Zephyr Project Infrastructure Management
HCL
1
star
90

crosstool-ng-old

Zephyr fork of crosstool-NG - for building Zephyr GNU toolchains (obsolete)
Shell
1
star
91

docker-sdk-build

Docker image for building the Zephyr SDK
Dockerfile
1
star
92

hal_telink

HAL for Telink devices
C
1
star
93

docs-theme

Zephyr Project Documentation Theme
CSS
1
star
94

hal_hpmicro

HPMicro HAL
C
1
star
95

actions_sandbox

A sandbox for testing GH Actions
1
star
96

hal_openisa

C
1
star
97

hal_ambiq

HAL for Ambiq devices
C
1
star