Skip to content

Releases: nimpylib/pylib

Windows support; PyOSError added; sys.audit; more os api...

27 Apr 15:32
Compare
Choose a tag to compare

v0.9.10 - 2025-04-27

Full Changelog: v0.9.9...v0.9.10

This version is tested against Windows. And:

  • PyOSError is added over Nim's OSError
  • sys.audit is introduced
  • more os api...

Bug Fixes

  • py:
    • io.flush raises OSError on SIGXFSZ. (5f26625)
    • audit funcs; .... (1ad6d96)
    • with for os.ScandirIterator; add follow_symlinks for DirEntry.stat. (85ee4ec)
    • OSError([arg]): works. (ac0d459)
    • stat_result lacks st_file_attributes,st_reparse_tag on Windows. (42acad3)
    • os.makedirs exist_ok was exists_ok. (e48a60a)
  • bool:
    • echo x where x has no $ resulted in pybool called. (9a8d0dc)
    • bypass(NIM-BUG), fixup! feat(bool): pybool cvt works for Option, bool-able: T is SomeNumber not compile. (3da7e86)
  • pyconfig:
    • X87_double_rounding was reverted. (e0f0749)
    • c_defined reverted;getrandom never declared. (87326ec)
  • windows:
    • CC crash on dtoa:fixup: fix(builtins): round(float[, n]) not to-even (ref #52). (d26c786)
    • oserr: raiseExcWithPath used wrong error code. (538277f)

Lib

  • unittest:
    • fixup: skipIf,skipUnless that returns a proc not compile.... (ec62e98, 6c51835)
  • resource:
    • not compile on Linux(lack RUSAGE_BOTH,RUSAGE_THREAD). (c54fa07)
    • getpagesize not compile; prlimit,setrlimit not work for non tuple types. (bad24cc)
  • signal:
  • stat:
    • stat.S_IMODE not compile for Mode. (4625dcc)
  • stat,os.chmod,os.symlink:
    • not compile on Windows. (c626c08)
  • os:
    • fixup: 'feat(Lib/os): chmod' errmap not compile on Termux. (cd4faa9)
    • Windows: unlink not compile. (a331a89)
  • shutils:
    • SameFileError not of PyOSError. (e8d93be)
  • time:
    • sleep: add audit; fix 1 ms offset. (4531bb9)

JS

  • Lib/os:
    • getpid() not work on js. (ac405b0)
    • not compiles for stat,unlink,chmods,scandir. (2e76c43)
  • oserr/errmap: not compile. (48d0fc3)
  • os: just import causes not compile. (7fc1a2e)
  • bypass(NIM-BUG): nim 2.2.4/2.3.1 disallows NonVarDestructor when js. (b3c8121)
  • denoAttrs:deno detect was reverted, import* not support str as arg. (3153a57)

Feature additions

builtins

  • ops: bitops for ints. (2025f40)
  • bool: pybool cvt works for Option, bool-able. (e9eaf8c)

Lib

inner

  • pyconfig: builtin_available,check_func_runtime. (ac14e44)
  • version: wrapPySince, templWrapExportSincePy. (d040f7a)
  • Python/config_read_env. (5d0659d)
  • sugar:
    • raise OSError now raises PyOSError over Nim's.... (7a1586b)
    • support except (E,...) [as x]. (86fbbad)

impr

  • Lib/signal: use AC_CHECK_FUNCS. (8e69446)

refine

  • Lib: use wrapExportSincePy if possible. (a0011fa)
  • win: dedup IO_REPARSE_TAG_SYMLINK,IO_REPARSE_TAG_MOUNT_POINT. (2b26c30)

refactor

  • Lib/shutil: split to shutil_impl; add n_shutil. (2544eea)

v0.9.9: patches for v0.9.8, prepare for next release

20 Apr 23:21
Compare
Choose a tag to compare

Full Changelog: v0.9.8...v0.9.9

break

  • oserr: unexport pathsAsOne, new tryOsOp accepts 2 or 0 paths (3f1f114)
  • slice: toNimSlice is no longer a cvt; cvt toPySlice from PySlice1. (c9518e8)

Bug Fixes

  • Lib/sys:
    • float_repr_style not export (21b7f79)
  • sugar:
    • @a.b, @a.b(1) not compile (0fb9426, 1927cef)
    • generic class rewrite was wrong; class O(a.c)/O(a[t]) not compile. (f6c2824)
  • list:
    • slice used in get,setitem with negative value causes RangeDefect. (4d33844)
    • fix setitem discarded longer values. (cd9ed64)
  • builtins.slice: toNimSlice's assert not work. (903c1cd)
  • initVal_with_handle_signal:
  • fixup! refact(os_impl): Py_get_osfhandle_noraise to util/get_osfhandle. (0f51997)

JS

  • pyerrors.oserr: new catchJsErrAndSetErrno; add defval for raiseErrno,raiseErrnoWithPath (6534a35)
  • importDenoOrNodeMod;2-arg importDenoOrProcess. (8f22a68)
  • os.utime not work: "fs is not defined". (47eca90)
  • fixup(d7541b8): catchJsErrAsCode (used error which is cstring). (694eae8)

Fixes for inconsistence with Python

  • Lib/os
    • readlink raises not just FileNotFoundEror,OSError... (c7976a5)
    • makedirs: if existsts_ok, exception might be raised. (90c9610)
  • n_tempfile:
    • js: mktemp raised OSError over FileNotFoundError. (f576b68)

inner

Feature additions

builtins

Lib

  • stat (4c8e84e)
  • unittest:
    • TestCase: addCleanup,tearDown,setUp,run. (3314d92)

inner

  • test: support.os_helper.TESTFN (2c8406a)
  • pyconfig: util.from_c_int_expr,AC_CHECK_FUNC[S] (6534a35, be5332b)
  • js:
    • jsutils/consts from_js_const (ae1671e)

doc

CI

  • testC,testJs: run iff src/,tests/,./.nimble, !feat- branch. (2788f60)

impr

  • js: os.{open,close}: use importNode over "require...". (f361005)

refine

refactor

  • refact: mv os_impl/private/platform_util root's private (1d5e2a8)
  • Lib/unittest: split to unittest/case_py (4853b49)
  • Lib/sys: split into sys_impl/; add n_sys (34f0cb9)
  • Lib/os_impl: dedup MS_WINDOWS, InJs (6534a35)

Purge warning

v0.9.8: Lib/signal,resource, os.wait*

03 Apr 05:32
Compare
Choose a tag to compare

Full Changelog: v0.9.7...v0.9.8

break

  • chore(nimpatch): now when eqver, patch still added

Bug Fixes

  • Lib/os not compile:
    • getpid
    • iter for os.DirEntry
  • Lib/string
    • Template.substitute(dict): not work
    • capwords: with sep had trailing sep
  • macos: defined(macosx) shall be always used
  • dtoa,pyconfig/floats not compile on arm
  • x**y when x is not int not complie

JS

  • Lib/os not compile
    • getxtime
    • os_impl.waits
    • getpid: due to Error: invalid pragma: importDenoOrProcess
    • scandir

Fixes for inconsistence with Python

  • overwrite Nim's SIGINT handler when not defined pylibUseNimIntHandler
  • builtins now contains pyerrors
  • str(tuple): now call str on each item
  • sugar:
    • now rewrite func(k=v)'s v, (e, ...)'s e
  • sys.hexversion no release and serial; sys.version_info.releaselevel was string over str
  • Lib/string Template.substitute:
    • now raises as py
    • no longer uses std/strutils.%
    • Template is now a ref object
  • chore(nimpatch): nansign: nan might be negative

inner

  • addPatch,platformAvailWhen repr bool expr only shows "true"/"false"

Feature additions

builtins

  • round(int, int)
  • NameError
  • KeyboardInterrupt

Lib

  • signal
  • resource
  • unittest:
    • skipTest
    • assertFalse
    • assert{[Not]{IsInstance,In},IsNot,{Greater,Less}[Equal]}
    • assertRaises(TypeError,...) skipIf,skipUnless
  • os:
    • O_* consts
    • wait* func, W* consts
  • sys.float_repr_style
  • n_string
  • string: Template.is_valid,get_identifiers

inner

  • Lib/enum_impl: intEnum, enumType
  • pyconfig.util from_c_int
  • Python/pylifecycle signal
  • errno_impl.errnoUtils.setErrnoRaw
  • oserr: newErrnoT new raiseErrnoErrT
  • refact(os_impl): Py_get_osfhandle_noraise to util/get_osfhandle

doc

  • comptime/log1p: add origin impl's url
  • format: fix warnings
  • mustRewriteExtern: condExpr underscore; fix wrong rewrite of strlitQuote
  • readme: update old url, use rel url if possible

CI

  • min max
  • Lib/string: more for Template
  • mv to testaments/:
    • titers,titer_next,tlist
    • tfloat.nim
    • tdict,tset
  • round: more for float

impr

  • faster int(char)
  • numTypes.floats: use faster isfinite from isX

refine

  • repr,$: dict,list,set: merge similar code to strIter

Purge warning

  • unused:
    • due to cond branch
    • pyconfig/util.handle_option_bool, jsoserr.jsOs
    • tests/tdecorator.nim
    • itertools: imported but not used sequtils

v0.9.7: more builtins, libs; support triple py sugar

02 Mar 10:40
Compare
Choose a tag to compare

Full Changelog: v0.9.5...v0.9.7

break

  • nitertools -> n_itertools; use openArray over seq

Bug Fixes

  • sorted not compile for ptr list, etc and for generics seq
  • complex(int,int) not compile
  • datetime.timedelta not compile
  • Lib/errno cannot be compiled in Windows (931a9f5)
  • except claude with no exception type (e.g. except:) crashes compiler
  • Lib/platform: machine() result fixed for some arch; closes #48
  • pass expr was supported instead of pass (:use discard expr instead)
  • zip: support no-seq args and any number of args over only 2; allow non-static strict
  • triple strlit won't be escape-translated
  • except with no exc type (e.g. except:) not compile

Fixes for inconsistence with Python

  • zip: not compile Iterable[T] (T differs each other)
  • builtins.round(float[, n]) not to-even
  • str(Inf) -> Infinity when JS (#44)
  • int(char) err msg differs py's
  • pass expr was supported instead of pass (:use discard expr instead)
  • zip: support no-seq args and any number of args over only 2; allow non-static strict
  • triple strlit won't be escape-translated
  • except with no exc type (e.g. except:) not compile

Feature additions

Lib

  • collections.abc: include iters, collections, asyncs, generators
  • bisect and n_bisect
  • random (all func besides randint,seed,choice,Random)
  • itertools.accumulate
  • os.urandom, os.getrandom
  • builtins

builtins

  • print: allow `end` along with endl for keyword
  • allow items(tuple)
  • max/min supports iterable & keywords
  • format
  • dir
  • literal will be automatically interpreted as Py list/set/dict/str
  • support __getitem__, __setitem__ and __delitem__ syntax (e.g. ls[1:3])
  • strlitCat in def (e.g. "asds" "sad")

in def (func body)

  • support equal sign minus like x=-1/x==-1
  • literal will be automatically interpreted as Py list/set/dict/str
  • support __getitem__, __setitem__ and __delitem__ syntax (e.g. ls[1:3])
  • strlitCat in def (e.g. "asds" "sad")

EXT

  • @ for Sequence
  • bytes: init from openArray[uint8] or Iterable[SomeInteger]
  • nextImpl

inner

  • Objects/obmalloc.nim: pyalloc pyfree
  • /pyconfig:
    • pycore/pymath
    • c_defined, py_getrandom
  • os_impl.platformAvailWhen
  • doc(pylib.nim): add version info in doc output

Patches for Nim-compatibility

  • newUninit for nim before 2.1.1

CI

  • update actions/cache@v2 to v4
  • mv tfloat.nim tests tests/testament
  • add tests/testament
  • doc will be deployed to docs.nimpylib.org

impr

  • faster int(char)
  • numTypes.floats: use faster isfinite from isX
  • tonim: no list will be initialized when unpacking an array
  • print: sep,endl's default value is now char over string

v0.9.5: better math & more libs, generics `def`

27 Dec 10:44
Compare
Choose a tag to compare

Full Changelog: v0.9.3...v0.9.5

Lib

This release fixes some bugs in Lib/math since last release.

Meanwhile, more libs like inspect, errno are added too.

Syntax Added (sugar)

  • generics def
  • raise ... from ... statement

v0.9.3: whole math lib equipped

29 Sep 19:40
Compare
Choose a tag to compare

Changelog since latest minor version: changelog_0_9_3.md

(TLNR, really a lot of work...) Full Changelog since 0.6.0: v0.6.0...v0.9.3

This is released with all CPython Lib/math functions implemented,

and as extensions:

  • some functions also support float32
  • almost all can run under non-C like platforms (JavaScript, NimScript) and even nimvm (compile-time)