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, not, or, PyBool, ==, bool, toBool, toNimBool, ==, and, repr, pybool, not, and, $, True, is, False, ==, or, any, pybool, xor, all, enumerate, SomeSet, difference, setattr, <=, isdisjoint, enumerate, PyDictValueView, 'j, ==, contains, pow, SomePyDictView, -=, isinstance, hash, symmetric_difference, ^, repr, toPyDict, ==, sort, len, []=, <, +=, None, -, PyDict, items, popitem, +=, difference_update, items, $, difference, []=, toNimComplex, intersection, slice, hash, pow, set, complex, clear, filter, ==, ==, id, PySlice1, <=, ==, newPyList, zip, contains, set, mitems, add, +, get, *, insert, issubclass, imag, -, ==, union, hash, filter, symmetric_difference, /, set, +, PySlice, symmetric_difference, len, sorted, ==, repr, repr, map, items, nimArrayAsList, |=, -, ==, +, count, abs, repr, repr, sorted, difference, [], newPyListOfCap, hasattr, reverse, slice, intersection, list, PyIterator, -, |, $, range, items, iter, -=, pop, frozenset, <, zip, filter, +=, $, delitem, pyset, newPyFrozenSet, max, StopIteration, []=, |=, reversed, pyset, <, list, []=, <, hash, set, $, extend, real, -, newPyList, getattr, discard, newPyIterator, +, |, indices, contains, $, [], intersection, repr, repr, min, [], pyset, hash, repr, hash, items, [], [], repr, /, repr, *, /, keys, symmetric_difference, items, ==, SomeSinglePyDictView, iter, emptyPyDict, pycomplex, difference, items, /=, []=, sorted, PyList, /, $, clear, intersection, index, *=, *, hash, union, repr, conjugate, pow, symmetric_difference, sort, reversed, copy, items, pydiscard, slice, next, get, newPyFrozenSet, SomePySet, PyDictKeyView, complex, map, count, clear, []=, -, iter, frozenset, len, setdefault, []=, $, pycomplex, len, range, pop, hash, items, keys, copy, PyComplex, iter, @, *, union, PyFrozenSet, PyDictView, pysetLit, reverse, pop, set, frozenset, PyDictItemView, values, <=, dict, difference, update, pop, items, frozenset, newPySet, <=, /, contains, filter, toPyDict, $, items, append, issubset, remove, -, intersection_update, newPySet, values, ==, +, input, getPtr, newPyList, +, list, range, &=, pop, PySet, delitem, union, extend, pyset, setLen, contains, intersection, ==, index, items, iter, set, *=, union, [], update, frozenset, []=, len, *, contains, hash, PyRange, frozenset, getattr, -, +, toNimSlice, list, pyset, *, &, issuperset, *, hash, print, list, from_bytes, int, NimInt, as_integer_ratio, conjugate, int, long, to_bytes, float, float, long, int, float, int, int, int, bit_length, long, long, nimint, /, <<, %, <>, ArithmeticError, <, **, ZeroDivisionError, **, <, %, ==, <=, ==, <>, <=, **, >>=, divmod, //, ==, <<=, >>, %, **=, **, //=, %=, 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, 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, +=, getCharPtr, ord, substr, bytes, find, clear, rb, copy, bytearray, rstrip, split, strip, ==, br, endsWith, rstrip, isalpha, *, bytes, rindex, center, len, split, contains, +, removeprefix, +, replace, newPyByteArray, hex, istitle, toNimString, +, count, repr, lstrip, startsWith, [], count, endsWith, ljust, zfill, +=, bytearray, removesuffix, $, []=, capitalize, chars, <, hex, count, bytearray, extend, bytes, translate, split, toNimString, bytes, center, title, newPyByteArray, 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, len, @, 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, pop, bytearray, bytearray, rsplit, or, translate, byteLen, index, items, endsWith, *=, []=, newPyByteArray, rjust, bytes, +, lower, fspath, *, bytes, insert, async, define, def, lambda, unpack, pass, with, del, :=, class, tonim