Skip to content

Fix broken examples and wrong docstrings in documentation, deprecate old aliases CLong/Long.#948

Draft
Carreau wants to merge 2 commits into
ipython:mainfrom
Carreau:f3
Draft

Fix broken examples and wrong docstrings in documentation, deprecate old aliases CLong/Long.#948
Carreau wants to merge 2 commits into
ipython:mainfrom
Carreau:f3

Conversation

@Carreau

@Carreau Carreau commented Jul 13, 2026

Copy link
Copy Markdown
Member

Broken examples (all raised when run as written):

  • config.rst: the sample Configurable uses Integer but imports Int
    (NameError)
  • migration.rst: the observe_compat example read change['value'], a key
    that does not exist in change dicts (KeyError); use change['new']
  • examples/myapp.py: the docstring described a 'shortname' tag feature
    that does not exist anywhere in traitlets (the tag was inert
    metadata); describe Application.aliases, the real mechanism, and
    drop the inert tag

Wrong or incomplete docstrings:

  • api.rst claimed old_value is None when a dynamic-default trait is set
    before first read; it is actually the trait type's static default
    (or Undefined). Also fix a doubled word.
  • trait_types.rst still described Python 2 int/long behavior for
    Integer/Int/Long despite the package requiring Python 3
  • import_item's Returns section claimed it returns a module; for
    dotted names it returns the named attribute, which can be any object
  • ArgParseConfigLoader.init carried a copy-pasted Returns section
    describing a Config object; init returns nothing
  • UseEnum's example dropped a stale Python 3.4/enum34 backport comment

--

I need to gather stats, but I think maybe we should not deprecate Int.

Carreau and others added 2 commits July 13, 2026 09:53
Broken examples (all raised when run as written):

- config.rst: the sample Configurable uses Integer but imports Int
  (NameError)
- migration.rst: the observe_compat example read change['value'], a key
  that does not exist in change dicts (KeyError); use change['new']
- examples/myapp.py: the docstring described a 'shortname' tag feature
  that does not exist anywhere in traitlets (the tag was inert
  metadata); describe Application.aliases, the real mechanism, and
  drop the inert tag

Wrong or incomplete docstrings:

- api.rst claimed old_value is None when a dynamic-default trait is set
  before first read; it is actually the trait type's static default
  (or Undefined). Also fix a doubled word.
- trait_types.rst still described Python 2 int/long behavior for
  Integer/Int/Long despite the package requiring Python 3
- import_item's Returns section claimed it returns a module; for
  dotted names it returns the named attribute, which can be any object
- ArgParseConfigLoader.__init__ carried a copy-pasted Returns section
  describing a Config object; __init__ returns nothing
- UseEnum's example dropped a stale Python 3.4/enum34 backport comment
Int and Long were separate traits back when Python 2 distinguished int
and long; they are now just integers. Make Integer the canonical class
and turn Int, Long (and the casting CLong) into deprecated subclasses
that emit a DeprecationWarning on use, steering users to Integer / CInt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Carreau Carreau marked this pull request as draft July 13, 2026 08:38
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.

2 participants