Skip to content

feat: export NotSet sentinel and is_not_set() helper - #91

Merged
thorwhalen merged 2 commits into
masterfrom
export-notset-sentinel
Sep 22, 2026
Merged

thorwhalen merged 2 commits into
masterfrom
export-notset-sentinel

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

What

Step 1 of the re-land plan in #48 (additive only):

  • i2.NotSet: the existing i2.deco.NotSet sentinel, now exported from the package root (same object; it pickles back to itself, so identity checks stay valid).
  • i2.is_not_set(x): returns x is NotSet. Signature consumers use it as is_not_set(param.default) to treat a NotSet default like inspect.Parameter.empty ("required, no default").

No existing behaviour changes. FuncFactory's signature is untouched: #88 is not re-applied, and the #89 guard test test_func_factory_signature_keeps_required_params_required still passes.

Refs #48 (not closing: steps 2 and 3 remain, see the issue).

Why

front and py2http need to recognise the sentinel before #88 can be re-applied. Their follow-up PRs will import is_not_set from i2, with a fallback for older i2.

Gate

  • pytest --doctest-modules i2 (py3.12): 764 passed, 2 xfailed (master: 762 passed, 2 xfailed; +2 = new test and new doctest)
  • black --check -S on the changed files: clean
  • Dependents: no fleet package star-imports i2 or defines is_not_set, so the new root names cannot shadow anything. Test suites of front, py2http, meshed, streamlitfront, dagapp, opyratorfront, ju, slang, config2py, know, extrude run against this branch: see the comment below.
  • Hosted CI: see checks.

🤖 Generated with Claude Code

thorwhalen and others added 2 commits September 22, 2026 15:15
Additive only: `i2.NotSet` (the existing `i2.deco.NotSet`) and a new
`i2.is_not_set(x)` predicate are exported so signature consumers (front,
py2http, ...) can recognise the sentinel as "required / no default" before
FuncFactory ever puts it in a signature. No existing behaviour changes.

Refs #48

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@thorwhalen

Copy link
Copy Markdown
Member Author

Dependents run against this branch (py3.12, pytest --doctest-modules <pkg> [tests], scrap/examples/docsrc ignored), compared with the same run against the released i2 (== master):

package master i2 this branch
front 63 passed 63 passed
opyratorfront 2 passed 2 passed
meshed 1 failed, 170 passed, 1 skipped same (the failure is test_hybrid_dag: extrude/http2py not installed)
py2http 2 collection errors same (pre-existing: simple_run_process_test.py calls mk_request_func_from_openapi_spec with a stale signature)
streamlitfront 2 collection errors same (pre-existing, environment)
dagapp no tests collected same

Also green on their own default test config: config2py (97 passed), ju (11), extrude (1), streamlitfront (1). know could not be installed here (pyaudio needs system portaudio), slang's conftest fails on a pytest hook mismatch, both unrelated to i2.

Independent refute-review (sub-agent): no breakage found. Checked __doc__ on the instance, doctest collection, pickle/copy/deepcopy identity (also inside a deep-copied inspect.Signature), name clashes in dependents, and the i2.deco.NotSet fallback path (present since 2023). Its one low finding, that NotSet is falsy, is now in the docstring. It also noted, for the later re-apply of #88 and not for this PR: i2's own Sig.required_names counts a NotSet-defaulted param as optional, so that change needs its own tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant