Nim Pylib
Just write Python code in Nim!
import pylib
The mostly suggested style is
import pkg/pylib
However, omitting the pkg/ prefix shall be fine at most cases:
import pylib
import Python-like stdlib
Cheatsheet for rough alternative between pylib and Python
Nim pylib | Python |
---|---|
from pylib/Lib/LIB import nil | import LIB |
import pylib/Lib/LIB | from LIB import * |
from pylib/Lib/LIB import XXX | import LIB; from LIB import XXX |
---
Wondering how many libs are available in NimPylib?
Here are the Lib Docs.
Exports
-
write, close, read, read, close, readline, initBufAsPy, readline, write, open, readline, readline, truncate, truncate, raiseOsOrFileNotFoundError, read, close, readline, readline, read, write, raiseOsOrFileNotFoundError, open, read, seek, read, seek, None, NoneType, or, or, and, not, or, PyBool, ==, bool, toBool, toNimBool, ==, and, repr, pybool, not, and, $, True, is, False, ==, or, and, any, pybool, xor, all, []=, hash, PyDict, <=, []=, PyDictValueView, complex, difference, ==, contains, hash, hash, count, get, len, <=, +=, $, reversed, <=, popitem, checkLenientOps, difference_update, union, toNimComplex, slice, pow, -, clear, newPyFrozenSet, set, id, <=, ==, repr, zip, contains, &, print, values, ==, symmetric_difference, hash, +, input, sorted, <, hash, repr, map, items, contains, [], newPyListOfCap, reverse, slice, list, PyIterator, len, repr, range, iter, <=, complex, filter, +=, $, set, max, StopIteration, []=, |=, pyset, union, <=, hash, repr, pow, set, repr, getattr, pydiscard, newPyIterator, +, indices, contains, [], newPyList, delitem, pyset, pow, repr, items, [], imag=, [], /, symmetric_difference, repr, /, keys, **, *, newPyList, items, /=, union, sorted, iter, /, $, -, *=, pow, symmetric_difference, sort, union, *, complex, $, count, -, []=, clear, frozenset, newPyFrozenSet, ==, items, len, $, items, ==, pycomplex, -=, real=, []=, frozenset, PyDictItemView, <, update, PyRange, pop, <=, /, contains, None, issubset, remove, -, intersection_update, values, discard, getPtr, repr, list, range, complex, difference, pyset, contains, symmetric_difference, pow, filter, *=, frozenset, set, len, /, -, toNimSlice, list, ==, pow, frozenset, PyComplex, list, enumerate, setattr, enumerate, 'j, pow, SomePyDictView, isinstance, **, ^, toPyDict, ==, sort, []=, <, append, -, **, intersection, copy, PySlice1, hash, mitems, add, +, *, insert, issubclass, imag, get, PySlice, filter, **=, complex, len, <, repr, nimArrayAsList, |=, hash, set, +, repr, abs, repr, newPyList, sorted, clear, hasattr, union, intersection, map, -, $, items, -=, issuperset, <, pop, pairs, difference, pyset, setdefault, delitem, pysetLit, -, list, <, PyTComplex, extend, items, dict, |, *, $, intersection, min, pow, SomeSinglePyDictView, items, ==, NimHasBindOverloadSymBugForComplexPow, isdisjoint, iter, emptyPyDict, pycomplex, items, PyList, intersection, index, [], hash, conjugate, reversed, items, slice, next, set, PyDictKeyView, iter, PyFrozenSet, repr, getattr, range, keys, copy, items, update, @, *, PyDictView, []=, pop, reverse, SomeSet, &=, |, zip, frozenset, newPySet, filter, toPyDict, +=, symmetric_difference, newPySet, real, +, <, +, SomePySet, $, pop, PySet, ==, extend, setLen, intersection, difference, index, items, iter, hash, [], []=, *, pop, frozenset, +, pyset, difference, *, bit_length, is_integer, as_someinteger_ratio, int, as_integer_ratio, float, long, float, int, int, long, NimInt, add_from_bytes, int, fromhex, is_integer, long, long, hex, checked_as_integer_ratio, from_bytes, int, int, from_bytes, to_bytes, as_integer_ratio, int, to_bytes, float_fromhex, float, int, to_chars, float, bit_count, int, conjugate, nimint, /, **, <>, <>, <, **, **, <, %, ==, <=, ==, **, %, <=, **, >>=, divmod, //, ==, <<=, >>, %, **=, <<, //=, %=, osErrorMsgWithPath, SystemExit, tryOsOp, raiseFileExistsError, raiseExcWithPath2, RuntimeError, raiseFileNotFoundError, raiseErrnoWithPath, raiseExcWithPath, raiseErrno, FileNotFoundError, ArithmeticError, raiseFileNotFoundError, NotImplementedError, AttributeError, noWeirdTarget, TypeError, raiseErrnoWithPath, ZeroDivisionError, NotADirectoryError, UnicodeError, errnoMsg, pathsAsOne, newUnicodeDecodeError, raiseExcWithPath, raiseExcWithPath, osErrorMsgWithPath, UnicodeDecodeError, raiseErrno, FileExistsError, InJs, IsADirectoryError, raiseExcWithPath, isNotFound, newUnicodeDecodeError, removeprefix, endsWith, maketrans, substr, ==, str, ascii, NoneType, +=, partition, endsWith, startsWith, maketrans, +=, TranslateAction, ord, translate, str, bin, str, rf, u, TranslateTableVal, StringLike, split, strip, isspace, ==, str, endsWith, rstrip, isalpha, *, rindex, center, ==, Fr, split, contains, ascii, rstrip, replace, endsWith, contains, endsWith, format, toNimString, +, count, repr, lstrip, u, TranslateTableABC, runeAtPos, chr, +=, removesuffix, None, pyrepr, rsplit, capitalize, split, startsWith, startsWith, translate, format, split, center, title, replace, maketrans, [], count, ljust, toNimStr, repr, [], TranslateValType, [], TypedTranslateTableABC, toPyStr, PyStr, and, isupper, $, startsWith, isascii, index, rjust, hex, translate, reversed, rpartition, rsplit, runeLenAt, fr, str, count, chars, istitle, len, toPyStr, Rf, str, splitlines, expandtabs, toPyStr, splitlines, not, islower, runes, casefold, join, upper, ascii, contains, getChar, rfind, ljust, find, strip, oct, +, TranslateTable, lstrip, $, zfill, startsWith, StrTypedTranslateTable, rsplit, isascii, or, translate, byteLen, ord1, items, ascii, len, rjust, f, lower, <>, fspath, *, endsWith, b, b, maketrans, substr, PyBytes, rindex, ==, istitle, hex, endsWith, count, bytes, isupper, $, hex, +=, partition, startsWith, isascii, index, bytes, rjust, +=, ord, endsWith, substr, bytes, reversed, rpartition, getCharPtr, find, isspace, rb, Br, title, count, split, isdigit, contains, chars, count, endsWith, Rb, +, isalpha, *, bytes, rindex, center, @, startsWith, split, br, +, splitlines, removeprefix, expandtabs, splitlines, replace, not, islower, rstrip, hex, casefold, toNimString, +, count, join, repr, upper, split, contains, lstrip, getChar, strip, rfind, bytes, ljust, find, strip, hasChar, rstrip, +, lstrip, +=, zfill, rfind, startsWith, rsplit, capitalize, or, translate, byteLen, index, items, hex, count, startsWith, startsWith, endsWith, bytes, translate, split, fromhex, len, bytes, center, rsplit, removesuffix, replace, rjust, rsplit, [], count, +, ljust, lower, [], pybytes, translate, fspath, *, bytes, [], []=, hex, <, <=, maketrans, substr, PyBytes, rindex, ==, Br, endsWith, endsWith, getChar, startsWith, replace, <=, +=, partition, b, bytes, ljust, getCharPtr, ord, substr, insert, find, clear, rb, copy, bytearray, rstrip, split, strip, ==, isdigit, br, endsWith, toNimString, rstrip, isalpha, *, bytes, rindex, center, len, split, contains, +, removeprefix, +, replace, newPyByteArray, hex, istitle, toNimString, +, count, repr, lstrip, startsWith, [], count, endsWith, +=, pop, +=, bytearray, removesuffix, $, []=, capitalize, chars, <, hex, count, bytearray, extend, bytes, translate, split, toNimString, bytes, center, title, len, rsplit, [], count, append, delitem, pybytes, translate, [], [], items, isupper, $, startsWith, startsWith, isascii, index, [], rjust, hex, reversed, rpartition, getCharPtr, PyByteArray, isspace, rsplit, count, reverse, chars, count, Rb, newPyByteArray, @, startsWith, BytesLike, splitlines, expandtabs, splitlines, not, split, islower, ljust, casefold, join, fromhex, upper, b, contains, getChar, strip, rfind, bytes, +=, remove, find, bytearray, hasChar, ==, toPyBytes, +, lstrip, rfind, zfill, bytearray, bytearray, rsplit, or, translate, byteLen, index, items, endsWith, *=, []=, newPyByteArray, rjust, bytes, +, lower, fspath, *, bytes, bytes, async, define, def, lambda, unpack, pass, with, del, :=, class, tonim