cpython

Alternative StdLib for Nim for Python targets

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:25

Tags

Installation

nimble install cpython
choosenim install cpython
git clone https://github.com/juancarlospaco/cpython

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
cpython - - - - - - -

Source

Repository https://github.com/juancarlospaco/cpython
Homepage https://github.com/juancarlospaco/cpython
Registry Source nimble_official

README

Alternative StdLib for Nim for Python targets

Documentation

  • :heavy_check_mark: atexit :arrow_right: https://juancarlospaco.github.io/cpython/atexit
  • :heavy_check_mark: base64 :arrow_right: https://juancarlospaco.github.io/cpython/base64
  • :heavy_check_mark: binascii :arrow_right: https://juancarlospaco.github.io/cpython/binascii
  • :heavy_check_mark: binhex :arrow_right: https://juancarlospaco.github.io/cpython/binhex
  • :heavy_check_mark: builtins :arrow_right: https://juancarlospaco.github.io/cpython/builtins
  • :heavy_check_mark: bz2 :arrow_right: https://juancarlospaco.github.io/cpython/bz2
  • :heavy_check_mark: cmath :arrow_right: https://juancarlospaco.github.io/cpython/cmath
  • :heavy_check_mark: codecs :arrow_right: https://juancarlospaco.github.io/cpython/codecs
  • :heavy_check_mark: codeop :arrow_right: https://juancarlospaco.github.io/cpython/codeop
  • :heavy_check_mark: colorsys :arrow_right: https://juancarlospaco.github.io/cpython/colorsys
  • :heavy_check_mark: compileall :arrow_right: https://juancarlospaco.github.io/cpython/compileall
  • :heavy_check_mark: copy :arrow_right: https://juancarlospaco.github.io/cpython/copy
  • :heavy_check_mark: crypt :arrow_right: https://juancarlospaco.github.io/cpython/crypt
  • :heavy_check_mark: curses :arrow_right: https://juancarlospaco.github.io/cpython/curses
  • :heavy_check_mark: decimal :arrow_right: https://juancarlospaco.github.io/cpython/decimal
  • :heavy_check_mark: dbd :arrow_right: https://juancarlospaco.github.io/cpython/dbd
  • :heavy_check_mark: dis :arrow_right: https://juancarlospaco.github.io/cpython/dis
  • :heavy_check_mark: doctest :arrow_right: https://juancarlospaco.github.io/cpython/doctest
  • :heavy_check_mark: ensurepip :arrow_right: https://juancarlospaco.github.io/cpython/ensurepip
  • :heavy_check_mark: errno :arrow_right: https://juancarlospaco.github.io/cpython/errno
  • :heavy_check_mark: faulthandler :arrow_right: https://juancarlospaco.github.io/cpython/faulthandler
  • :heavy_check_mark: fcntl :arrow_right: https://juancarlospaco.github.io/cpython/fcntl
  • :heavy_check_mark: filecmp :arrow_right: https://juancarlospaco.github.io/cpython/filecmp
  • :heavy_check_mark: fnmatch :arrow_right: https://juancarlospaco.github.io/cpython/fnmatch
  • :heavy_check_mark: gc :arrow_right: https://juancarlospaco.github.io/cpython/gc
  • :heavy_check_mark: getopt :arrow_right: https://juancarlospaco.github.io/cpython/getopt
  • :heavy_check_mark: getpass :arrow_right: https://juancarlospaco.github.io/cpython/getpass
  • :heavy_check_mark: gettext :arrow_right: https://juancarlospaco.github.io/cpython/gettext
  • :heavy_check_mark: glob :arrow_right: https://juancarlospaco.github.io/cpython/glob
  • :heavy_check_mark: grp :arrow_right: https://juancarlospaco.github.io/cpython/grp
  • :heavy_check_mark: gzip :arrow_right: https://juancarlospaco.github.io/cpython/gzip
  • :heavy_check_mark: hashlib :arrow_right: https://juancarlospaco.github.io/cpython/hashlib
  • :heavy_check_mark: hmac :arrow_right: https://juancarlospaco.github.io/cpython/hmac
  • :heavy_check_mark: html.entities :arrow_right: https://juancarlospaco.github.io/cpython/html_entities
  • :heavy_check_mark: imghdr :arrow_right: https://juancarlospaco.github.io/cpython/imghdr
  • :heavy_check_mark: imp :arrow_right: https://juancarlospaco.github.io/cpython/imp
  • :heavy_check_mark: importlib :arrow_right: https://juancarlospaco.github.io/cpython/importlib
  • :heavy_check_mark: keyword :arrow_right: https://juancarlospaco.github.io/cpython/keyword
  • :heavy_check_mark: linecache :arrow_right: https://juancarlospaco.github.io/cpython/linecache
  • :heavy_check_mark: logging :arrow_right: https://juancarlospaco.github.io/cpython/logging
  • :heavy_check_mark: lzma :arrow_right: https://juancarlospaco.github.io/cpython/lzma
  • :heavy_check_mark: marshal :arrow_right: https://juancarlospaco.github.io/cpython/marshal
  • :heavy_check_mark: math :arrow_right: https://juancarlospaco.github.io/cpython/math
  • :heavy_check_mark: mimetypes :arrow_right: https://juancarlospaco.github.io/cpython/mimetypes
  • :heavy_check_mark: ntpath :arrow_right: https://juancarlospaco.github.io/cpython/ntpath
  • :heavy_check_mark: nis :arrow_right: https://juancarlospaco.github.io/cpython/nis
  • :heavy_check_mark: operator :arrow_right: https://juancarlospaco.github.io/cpython/operator
  • :heavy_check_mark: os :arrow_right: https://juancarlospaco.github.io/cpython/os
  • :heavy_check_mark: pickle :arrow_right: https://juancarlospaco.github.io/cpython/pickle
  • :heavy_check_mark: pickletools :arrow_right: https://juancarlospaco.github.io/cpython/pickletools
  • :heavy_check_mark: pkgutil :arrow_right: https://juancarlospaco.github.io/cpython/pkgutil
  • :heavy_check_mark: posixpath :arrow_right: https://juancarlospaco.github.io/cpython/posixpath
  • :heavy_check_mark: pprint :arrow_right: https://juancarlospaco.github.io/cpython/pprint
  • :heavy_check_mark: pwd :arrow_right: https://juancarlospaco.github.io/cpython/pwd
  • :heavy_check_mark: py_compile :arrow_right: https://juancarlospaco.github.io/cpython/py_compile
  • :heavy_check_mark: quopri :arrow_right: https://juancarlospaco.github.io/cpython/quopri
  • :heavy_check_mark: random :arrow_right: https://juancarlospaco.github.io/cpython/random
  • :heavy_check_mark: re :arrow_right: https://juancarlospaco.github.io/cpython/re
  • :heavy_check_mark: readline :arrow_right: https://juancarlospaco.github.io/cpython/readline
  • :heavy_check_mark: reprlib :arrow_right: https://juancarlospaco.github.io/cpython/reprlib
  • :heavy_check_mark: resource :arrow_right: https://juancarlospaco.github.io/cpython/resource
  • :heavy_check_mark: runpy :arrow_right: https://juancarlospaco.github.io/cpython/runpy
  • :heavy_check_mark: secrets :arrow_right: https://juancarlospaco.github.io/cpython/secrets
  • :heavy_check_mark: shutil :arrow_right: https://juancarlospaco.github.io/cpython/shutil
  • :heavy_check_mark: signal :arrow_right: https://juancarlospaco.github.io/cpython/signal
  • :heavy_check_mark: site :arrow_right: https://juancarlospaco.github.io/cpython/site
  • :heavy_check_mark: sndhdr :arrow_right: https://juancarlospaco.github.io/cpython/sndhdr
  • :heavy_check_mark: spwd :arrow_right: https://juancarlospaco.github.io/cpython/spwd
  • :heavy_check_mark: statistics :arrow_right: https://juancarlospaco.github.io/cpython/statistics
  • :heavy_check_mark: struct :arrow_right: https://juancarlospaco.github.io/cpython/struct
  • :heavy_check_mark: ssl :arrow_right: https://juancarlospaco.github.io/cpython/ssl
  • :heavy_check_mark: subprocess :arrow_right: https://juancarlospaco.github.io/cpython/subprocess
  • :heavy_check_mark: sys :arrow_right: https://juancarlospaco.github.io/cpython/sys
  • :heavy_check_mark: sysconfig :arrow_right: https://juancarlospaco.github.io/cpython/sysconfig
  • :heavy_check_mark: syslog :arrow_right: https://juancarlospaco.github.io/cpython/syslog
  • :heavy_check_mark: tabnanny :arrow_right: https://juancarlospaco.github.io/cpython/tabnanny
  • :heavy_check_mark: tempfile :arrow_right: https://juancarlospaco.github.io/cpython/tempfile
  • :heavy_check_mark: termios :arrow_right: https://juancarlospaco.github.io/cpython/termios
  • :heavy_check_mark: textwrap :arrow_right: https://juancarlospaco.github.io/cpython/textwrap
  • :heavy_check_mark: timeit :arrow_right: https://juancarlospaco.github.io/cpython/timeit
  • :heavy_check_mark: token :arrow_right: https://juancarlospaco.github.io/cpython/token
  • :heavy_check_mark: tty :arrow_right: https://juancarlospaco.github.io/cpython/tty
  • :heavy_check_mark: turtle :arrow_right: https://juancarlospaco.github.io/cpython/turtle
  • :heavy_check_mark: typing :arrow_right: https://juancarlospaco.github.io/cpython/typing
  • :heavy_check_mark: unicodedata :arrow_right: https://juancarlospaco.github.io/cpython/unicodedata
  • :heavy_check_mark: uu :arrow_right: https://juancarlospaco.github.io/cpython/uu
  • :heavy_check_mark: uuid :arrow_right: https://juancarlospaco.github.io/cpython/uuid
  • :heavy_check_mark: venv :arrow_right: https://juancarlospaco.github.io/cpython/venv
  • :heavy_check_mark: warnings :arrow_right: https://juancarlospaco.github.io/cpython/warnings
  • :heavy_check_mark: webbrowser :arrow_right: https://juancarlospaco.github.io/cpython/webbrowser
  • :heavy_check_mark: winsound :arrow_right: https://juancarlospaco.github.io/cpython/winsound
  • :heavy_check_mark: zipapp :arrow_right: https://juancarlospaco.github.io/cpython/zipapp
  • :heavy_check_mark: zlib :arrow_right: https://juancarlospaco.github.io/cpython/zlib
  • :trollface: More supported modules soon...
  • For more documentation, use Python official documentation, works too.

UPBGE

UPBGE API is supported out of the box, new UPBGE features will be integrated.

3D Games, GUI with OpenGL and shaders, audio, video, and more...

Are you Gamedev?, Pull Requests welcome!.

Design

  • 1 Dependency only.
  • 1 Nim module per 1 Python module.
  • Module files are <200 lines each of pure Nim code.
  • Arbitrary precision big Decimals with all the operators for Nim.
  • Compatible with ARC and ORC deterministic memory nanagement.
  • Enforces real strong inferred static typing with UFCS for Python.
  • Same API as Python StdLib, same function names, same argument names (Names starting and ending with double underscore are not legal in Nim).
  • Use the vanilla official Python StdLib that you already know by memory.
  • Same module filenames as Python StdLib, same imports as Python StdLib.
  • Documentation online, but also any Python documentation should work too.
  • Simple code using template, easy to hack for new users, KISS & DRY.
  • Stuff deprecated/removed in Python before year 2020 will not be supported.
  • We do not deprecate stuff, even if Python deprecate/remove it, it will keep working for Nim.
  • Each file is completely self-contained standalone, you can copy just 1 file on your project and use it.
  • If Python removes a module from StdLib you must obtain the .py file somehow, but the .nim remains.
  • It does not use anything from Nim standard library, very future-proof (uses Nimpy for Python-Nim interop, but other than that they are thin wrappers, with minimal dependency on StdLib).
  • Package version == Python version.
  • Pet the turtle.

Requisites

  • Python ( >2.7 works but unsupported, >3.5 minimal, >=3.10 recommended ).

Install

nimble install cpython

OR

nimble install https://github.com/juancarlospaco/cpython.git

Doing JavaScript or Web Dev ?

Why?

The idea comes from the community of "Nim en Espanol" Telegram group (Spanish).

Also...

  • Whole new StdLib becomes usable for Nim, without Nim having to spend resources.
  • Showcase easy interoperability of Nim (CTypes is harder, Python is verbose, etc).
  • Arbitrary precision big Decimals for Nim.
  • Others do it too (Scala/Kotlin uses Java StbLib, Swift uses Objective-C StdLib, etc).
  • Python does it too, Python is written in C therefore using C StdLib.
  • Make others work improving libs that you can use in Nim.
  • A place to pile up "Nim-ified" Python stuff.

See also

💰➡️🍕

Bitcoin BTC **BEP20 Binance Smart Chain Network BSC**
0xb78c4cf63274bb22f83481986157d234105ac17e
**BTC Bitcoin Network**
1Pnf45MgGgY32X4KDNJbutnpx96E4FxqVi
**Lightning Network**
juancarlospaco@bitrefill.me
Ethereum ETH Dai DAI Uniswap UNI Axie Infinity AXS Smooth Love Potion SLP Uniswap UNI USDC **BEP20 Binance Smart Chain Network BSC**
0xb78c4cf63274bb22f83481986157d234105ac17e
**ERC20 Ethereum Network**
0xb78c4cf63274bb22f83481986157d234105ac17e
Tether USDT **BEP20 Binance Smart Chain Network BSC**
0xb78c4cf63274bb22f83481986157d234105ac17e
**ERC20 Ethereum Network**
0xb78c4cf63274bb22f83481986157d234105ac17e
**TRC20 Tron Network**
TWGft53WgWvH2mnqR8ZUXq1GD8M4gZ4Yfu
Solana SOL **BEP20 Binance Smart Chain Network BSC**
0xb78c4cf63274bb22f83481986157d234105ac17e
**SOL Solana Network**
FKaPSd8kTUpH7Q76d77toy1jjPGpZSxR4xbhQHyCMSGq
Cardano ADA **BEP20 Binance Smart Chain Network BSC**
0xb78c4cf63274bb22f83481986157d234105ac17e
**ADA Cardano Network**
DdzFFzCqrht9Y1r4Yx7ouqG9yJNWeXFt69xavLdaeXdu4cQi2yXgNWagzh52o9k9YRh3ussHnBnDrg7v7W2hSXWXfBhbo2ooUKRFMieM
Sandbox SAND Decentraland MANA **ERC20 Ethereum Network**
0xb78c4cf63274bb22f83481986157d234105ac17e
Algorand ALGO **ALGO Algorand Network**
WM54DHVZQIQDVTHMPOH6FEZ4U2AU3OBPGAFTHSCYWMFE7ETKCUUOYAW24Q
Polkadot DOT **DOT Network**
13GdxHQbQA1K6i7Ctf781nQkhQhoVhGgUnrjn9EvcJnYWCEd
**BEP20 Binance Smart Chain Network BSC**
0xb78c4cf63274bb22f83481986157d234105ac17e
Binance [https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3](https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3 "Send via Binance Pay")

Stars

:star: @juancarlospaco :star: @aguspiza :star: @AndrielFR :star: @S0Sbrigade8 :star: @aphkyle :star: @jhgalino :star: @YanMu2020 :star: @matkuki :star: @Traumatism :star: @foxoman
:star: @whee
:star: @bakarilevy
:star: @Ryu1845
:star: @babaloveyou
:star: @jdbernard
:star: @cyraxjoe
:star: @zendbit
:star: @vovavili
:star: @xujin8
:star: @Geksan
:star: @shxdow
:star: @singularperturbation
:star: @adokitkat
:star: @luisacosta828
:star: @ByK95
:star: @daweedkob
:star: @Quantum-Codes
:star: @qununc
:star: @AriesFoxgirl
:star: @Braden-Preston
:star: @AriesFoxgirl
:star: @mahmoudimus
:star: @terretta
:star: @AndrewGPU
:star: @themorya
:star: @zimitz
:star: @tommo
:star: @rlipsc
:star: @jyapayne
:star: @barseghyanartur
:star: @tiberiuichim
:star: @yuchunzhou
:star: @lf-araujo
:star: @pietroppeter
:star: @arkanoid87
:star: @jgdevop
:star: @onoe-serika
:star: @shizhaojingszj
:star: @W1M0R
:star: @genbtc
:star: @buster-blue
:star: @Megamegamium
:star: @1MarcosDev
:star: @lightcax
:star: @termermc
:star: @catsmells
:star: @maleyva1
:star: @all-an
:star: @janflyborg
:star: @smeggingsmegger
:star: @ArikRahman
:star: @KolyaRS
:star: @jinczing
:star: @jason-chandler
:star: @lolgab
:star: @melMass
:star: @xgr
:star: @majj
:star: @dseeni
:star: @jmgomez
:star: @shaoxie1986
:star: @wjl12
:star: @cammclain
:star: @Optimax125
:star: @hanok2
:star: @KhazAkar
:star: @rxx
:star: @FI-Mihej
:star: @davidvfx07
:star: @gnusec
:star: @ziggertonziggy
:star: @neroist
:star: @Bimzzzzz
:star: @tuanductran
:star: @Zira3l137
:star: @ranjian0
:star: @drewbitt
:star: @taylourchristian
:star: @seruman
:star: @corv89
:star: @pkulev
:star: @marioboi3112
:star: @planetis-m
:star: @shaneish
:star: @trinhminhtriet
:star: @jtonsing
:star: @kalaverin
:star: @svaite
:star: @hasansezertasan
:star: @moncefdhk999
:star: @jeansossmeier
:star: @seanstrom
:star: @Miqueas
:star: @fmalina
:star: @Dregacorp
:star: @kylesinlynn
:star: @nilslindemann
:star: @vvsagar
:star: @a07087263-cmyk
:star: @dkapt
:star: @prospero78
:star: @slegrand45
:star: @toffeeframe