Repository navigation
v4.0.1 #212
petereon
announced in
Announcements
v4.0.1
#212
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Breaking changes
Configis a per-call object,select(..., config=Config(...)), carryingconsoleandkeys(DefaultKeys→KeyBindings). Module-levelconsoleis removed. Using a removed global raisesRemovedInV4Error(orAttributeErrorwhen assigning on theConfig/KeyBindingsclass) with a message explaining the replacement.select,select_multiple,prompt,confirmandSpinneris positional (Spinner(DOTS, text="...")).KeyboardInterruptby default (Config.raise_on_interrupt=True). It used to returnNone, so a script carried on as if the user had chosen "nothing". Esc still returnsNone.strictdefaults toTrueonselect/select_multiple(Allow passing a custom Rich Console to select / select_multiple (or via Config) #157): emptyoptionsraisesValueErrorunlessstrict=Falseis passed.paginationflag removed.page_sizealone now controls paging:Nonefits the terminal and paginates only when needed, an integer always paginates with that many options per page. Before,page_sizewas silently ignored unlesspagination=Truewas passed too, andpagination=Falsecould not actually turn paging off.ctrl+ainstead ofa, soacan be typed into a filter. Select-all keeps existing ticks (filling up tomaximal_countin list order) and acts on visible options when filtering.Console(stderr=True, highlight=False)), restoring the 3.8.2 look.emojiis dropped andrich>=14.3.0is required. Cursor/tick widths now come fromrich.cells.cell_len, which matchesemojion every cursor/tick tried and is more accurate for CJK and combining characters, but only measures variation-selector/ZWJ emoji correctly from Rich 14.3 (which still supports Python 3.8).>=3.8is still declared, but only 3.10+ is tested in CI (noted in the README). The built wheel imports on 3.8, 3.9, 3.10 and 3.14.New features
title=onselect/select_multiple,instructions=on all elements (Nonehides it).selectandselect_multiple#74): pass a dict of section name to options. Indices are(section, index)tuples, enforced at runtime and by type checkers via@overload.filterable=Truenarrows options by typed text (case-insensitive, markup ignored), and shows a(matches/total)count next to the query (Allow passing a custom Rich Console to select / select_multiple (or via Config) #157).ValueErrornaming the entry, e.g.option at ('Veg', 1) is blank,section name '' is blank. Not gated bystrict.optionsraisesTypeErrorinstead of silently offering its letters.confirmraises on a blankyes_text/no_text(it used to crash withIndexError) and when both labels start with the same letter while the(Y/N)hint is shown.RuntimeError('Interactive terminal required')instead of an opaquetermios.error.Spinneris a context manager (with Spinner(...):also stops it if the body raises) and acceptsconsole=so it can share a console with the other elements.py.typedis now shipped (the wheel had none, so the overloads were invisible to downstream type checkers).prompt(..., target_type=int)is typedOptional[int]and its validator is checked against that type.optionsaccepts anySequence/Mapping; tuples and ranges already worked at runtime.__all__and__version__are declared.ValidationErrorandConversionErrorare nowValueErrorsubclasses. A failed validator can no longer be mistaken for a failed conversion, and a validator that raisesValueErroritself is no longer swallowed as one.Fixes
selectbut only 1 inselect_multiple, soselect_multiplerendered taller than the terminal and Rich'sLivecropped its page indicator and instructions (confirmed in a real pty). It is now derived from what is actually rendered (title/filter line, page indicator, instructions, the error line when min/max counts can produce one), identically for both, and section headers are bounded by what a page can hold. A property test asserts no render is taller than the terminal across heights, section counts, titles, filtering and error states.prompt()docstring pointed at a nonexistentrich.internalsmodule.Docs
docs/content/examples.md: rewritten Configuration section, new sections for title/instructions/sections, filtering, pagination, input validation and spinners, and a 3.x → 4.x migration table. The README spinner example uses the context manager.Tooling & CI
[tool.poetry]→ PEP 621[project],poetry.lock→uv.lock, build backendpoetry-core→uv_build. Releases now build and publish withuv build/uv publishinstead of Poetry +pypa/gh-action-pypi-publish.requirements-dev.txt/docs/requirements.txt(hand-pinned, unlocked, installed via two separate untrackedpip installs) folded into[dependency-groups]dev/docs, resolved and hash-locked together inuv.lock. Declared as[tool.uv] conflictssince they were never actually installed together (dev'swatchdog==6.0.0vs.novella'swatchdog<3.0.0).expycted,mock(tests use stdlibunittest.mock),radon,xenon,toml-sort,perflint, a duplicatepydoc-markdownpin, andtypes-emoji.ruff check/ruff formatreplacepflake8,black,isort, andflake8-simplify/-pie/-bandit/-cognitive-complexity/-expression-complexity/-quotes/-print/-eradicate. Fixed the 8 real findings ruff's rules turned up that flake8's narrowerselectlist and dead plugins never caught.relock-with-autocommit job replaced with a plainuv lock --check.astral-sh/setup-uv,JamesIves/github-pages-deploy-action), flagged by Sonar as a high-severity supply-chain risk (tag refs are mutable).docsgroup needsuv pip install --group docsrather thanuv sync: novella'spkg_resources-based plugin loader can't resolveuv's dist-info metadata for dotted distribution names (e.g.databind.json). Also needssetuptools<81(pkg_resourceswas removed in 81+).This discussion was created from the release v4.0.1.
All reactions