Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dataclass docs #155

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Update dataclass docs #155

merged 3 commits into from
Jan 5, 2024

Conversation

patrick-kidger
Copy link
Owner

@jeertmans -- updated the dataclass docs as suggested in #154. In practice I'm recommending equinox.Module rather than chex.dataclass, as it's a bit safer for most purposes + it's part of the same tech stack as jaxtyping / etc.

@jeertmans
Copy link
Contributor

Nice @patrick-kidger! Didn't know the equinox module could help to create JAX-compatible dataclasses. A few options exact (chex, flax, jax-dataclass, and thus equinox), and it is quite hard to decide which one is the "best" (at least the one recommended by JAX authors), but this is not the questions here :-)

Few suggestions:

  • as pointed in my comment chore(docs): fix typos in docstrings #154 (comment) in recommend doctests, but you already answered that, so you can ignore ^^';;
  • I see you are not using Sphinx but Mkdocs, but a direct to equinox.Module could be nice. But that may also be harder to maintain if the link can be broken (intersphinx mapping helps to prevent that, I don't know about Mkdocs).

Otherwise looks great!

@patrick-kidger
Copy link
Owner Author

I'm biased, unsurprisingly, but Equinox is definitely my favourite choice of dataclass. :) It fixes a lot of the edge cases and adds a few features that the others miss: inheritance, bound methods, docstrings, pretty printing, abstract base classes, field converters, ...
Fewer footguns and greater usability are a big part of why I try to mention it where relevant, in place of any of the others.

(You mentioned Chex originally -- between eqx.debug.assert_max_traces and jaxtyping itself, I confess I don't actually Chex any more these days.)

I believe there is a intersphinx-equivalent for the mkdocs stack, but I've not tried digging into it! I think the link should be stable enough that I'm happy to add it directly though; I'll make that tweak now.

Thank you for the feedback!

@jeertmans
Copy link
Contributor

Thanks for the reply! I'll take a look at Equinox then and check if that can replace Chex or not for the use I have.

@patrick-kidger patrick-kidger merged commit eb9a23d into main Jan 5, 2024
4 checks passed
@patrick-kidger patrick-kidger deleted the dataclass-docs branch January 5, 2024 13:17
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