python-attrs / python-attrs/cattrs

Schema generation

Open
#397 10 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
159
Avg merge
12h 21m
Merged PRs (30d)
6

Description

Hi @Tinche! I really love the combination of attrs and cattrs; it is a great way to organize code! After having shot myself in the foot several times with pydantic, I switched to (c)attrs in most of my projects. However, there is one part where pydantic still has an edge – or at least I couldn't find an immediate solution with (c)attrs – which is generating schemas (JSON or similar) from class definitions.

Perhaps this hasn't been in scope so far, but I think this would be a natural task for cattrs, no? At least I know that other people seem interested in this as well. A quick search yields:

Do you think this is something that should become part of the roadmap?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing cattrs' existing scope and the referenced attrs-jsonschema package, then compare the linked discussion about schema generation. Before implementation, clarify whether schema generation belongs in cattrs and agree on supported schema formats, class definitions, and acceptance criteria; done cannot be defined from the current issue alone.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.