Skip to content

Conversation

dependabot[bot]
Copy link

@dependabot dependabot bot commented on behalf of github Jan 1, 2024

Bumps jaxtyping from 0.2.21 to 0.2.25.

Release notes

Sourced from jaxtyping's releases.

jaxtyping v0.2.25

This release is primarily a usability release, designed to help ensure the library is being used correctly.

  • The error messages from a failed typecheck have been improved, to explicitly highlight more information about which argument was wrong. :)
  • If the jaxtyping.jaxtyped(typechecker=...) argument is not passed, then a warning will be displayed. In practice, this will trigger:
    • if using the old double-decorator syntax (@jaxtyped @beartype def foo(...): ...) -- upgrade to the new @jaxtyped(typechecker=beartype) def foo(...): ... syntax and get better error messages! :)
    • If making the easy mistake of writing @jaxtyped(beartype) def foo(...): ... -- in this case it's actually the beartype call that is jaxtype'd, not foo.
  • Incorrect use of jaxtyping annotations will now raise an jaxtyping.AnnotationError rather than a mix of RuntimeErrors, NameErrors etc. For example isinstance(x, Float) is not correct (you should write something like Float[Array, "..."]) instead), and this will raise such an AnnotationError.
  • Introduced two config flags:
    • JAXTYPING_DISABLE=1 / jaxtyping.config.update("jaxtyping_disable", True): if enabled then all runtime type checking will be skipped.
    • JAXTYPING_REMOVE_TYPECHECKER_STACK=1 / jaxtyping.config.update("jaxtyping_remove_typechecker_stack", True): if enabled then type-checking errors will only show the jaxtyping.TypeCheckError, and won't include any extra stack trace from the underlying type-checker (beartype/typeguard). Some users have found that they preferred the conciseness over the extra information.

Full Changelog: patrick-kidger/jaxtyping@v0.2.24...v0.2.25

jaxtyping v0.2.24

New features

  • Error messages will now include useful shape information for debugging. (!!!) This closes the venerable #6, which is is one of the oldest feature requests for jaxtyping. This is enabled by using the following syntax, instead of the old double-decorator syntax:
    from jaxtyping import jaxtyped
    from beartype/typeguard import beartype/typechecked as typechecker
    @​jaxtyped(typechecker=typechecker)  # passing as keyword argument is important
    def foo(...):
    ...
    and moreover this is what install_import_hook now does. As an example of this done, consider this buggy code:

    import jax.numpy as jnp
    from jaxtyping import Array, Float, jaxtyped
    from beartype import beartype
    @jaxtyped(typechecker=beartype)
    def f(x: Float[Array, "foo bar"], y: Float[Array, "foo"]):
    ...
    f(jnp.zeros((3, 4)), jnp.zeros(5))

    will now produce the error message

    jaxtyping.TypeCheckError: Type-check error whilst checking the parameters of f.
    The problem arose whilst typechecking argument 'y'.
    Called with arguments: {'x': f32[3,4], 'y': f32[5]}
    Parameter annotations: (x: Float[Array, 'foo bar'], y: Float[Array, 'foo']).
    The current values for each jaxtyping axis annotation are as follows.
    foo=3
    bar=4
    

    Hurrah! I'm really glad to have this important quality-of-life improvement in. (#6, #138)

... (truncated)

Commits
  • 272be74 Bump version
  • 7df267e Upgrade to ruff-format
  • d43933f Updated to latest pyktdocs_tweaks
  • 1acc0d7 Improved error messages a little bit, in particular to highlight individual p...
  • 33cf4fc Simplified internals by removing jaxtyping_raise; jaxtyping_malformed.
  • e5cc75e Removed internal jaxtyped_fns registry that is no longer needed.
  • 125bc89 Added environment config flags.
  • 8e47c90 version bump
  • 2059789 Fix install_import_hook(..., None)
  • 850f4e7 Handle beartype doing isinstance(None, hint)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [jaxtyping](https://github.com/google/jaxtyping) from 0.2.21 to 0.2.25.
- [Release notes](https://github.com/google/jaxtyping/releases)
- [Commits](patrick-kidger/jaxtyping@v0.2.21...v0.2.25)

---
updated-dependencies:
- dependency-name: jaxtyping
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants