Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

👌 A `needs_defaults_removed` file costs a full field conversion for every restored default (140 per record on a 20k-need import)

Open
#2,256 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
performance

Research direction

Start with FieldSchema.convert_or_type_check at needs_schema.py:471 and the generate_need default step, then trace how the needs_external_needs reader restores defaults under ub_needs_exchange. Check records(apply_schema_defaults=False) and decide between the two approaches the issue offers. Done means restored defaults no longer hit convert_or_type_check, and the call count for a needs_defaults_removed import drops from about 140 per need, with existing schema-default tests still passing.

Written by the indexing model from the issue text.

Description

enhancement pkg: sphinx-needs

When a needs.json was written with needs_json_remove_defaults = True, the reader restores every schema default into every record (ub_needs_exchange, contract §7) and generate_need then converts every restored value through FieldSchema.convert_or_type_check as if it had been authored.

Measured at master 3210ac5c (2026-10-14), loading ubCode's 20 847-need export (138 extra fields + 54 link types in its needs_schema, needs_defaults_removed: true) through needs_external_needs: 2 926 187 convert_or_type_check calls, about 140 per need, 6.6 s profiled (needs_schema.py:471; convert_directive_option 2 884 493 calls, 5.5 s), inside a 21.8 s build. A default has already passed the schema when it was declared, so converting it again per record buys nothing.

Proposal: ask the reader for the records without the defaults (records(apply_schema_defaults=False) exists) and let generate_need's own default step fill them, or mark restored defaults so the conversion is skipped.

Dominant language
Python
Stars
309
Forks
103
Avg merge
10h 41m
Merged PRs (30d)
128

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from useblocks/sphinx-needs

All issues in useblocks/sphinx-needs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.