Replace or vendor jstyleson (unmaintained), and load extractors lazily
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend, performance
Direzione di ricerca
Read extruct/__init__.py and trace its extractor imports and extract() entry point; the issue gives python -X importtime -c "import extruct.w3cmicrodata" as a baseline. Separately inspect extruct.jsonld and its jstyleson dependency. Done when extractor imports follow the requested syntaxes and the JSON-LD path no longer depends on the unmaintained package; the issue does not name tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
1. jstyleson is unmaintained and sits on the JSON-LD path. extruct.jsonld imports jstyleson, whose last release is 0.0.2 (June 2016), with no commits since 2021 and only an sdist. Its fix for modern setuptools (linjackson78/jstyleson#8) has been open since October 2024, and #241 shows pip install extruct failing because of it. In #241 you mentioned vendoring, replacing or forking it — is that still the plan? Every user of extract() depends on it, including those who only want JSON-LD, so it can't be avoided by choosing syntaxes. If it helps, its job (JSON with comments and trailing commas) is small enough to vendor in a few dozen lines, or could be handled by stripping comments before json.loads.
2. Load extractors lazily. extract() takes syntaxes=, but importing any part of the package loads every extractor, since extruct/__init__.py imports them all. With extruct 0.18.0 on Python 3.13, python -X importtime -c "import extruct.w3cmicrodata" (median of 3):
| Module | Cumulative import |
|---|---|
extruct total |
~155 ms |
w3cmicrodata + jsonld themselves |
~3 ms |
mf2py (incl. bs4, soupsieve) |
~70 ms |
pyRdfa |
~30 ms |
Exposing the extractors through a module-level __getattr__ (PEP 562), and importing each one inside extract() only for the syntaxes requested, would keep the public API unchanged while letting syntaxes=["json-ld", "microdata"] skip mf2py and pyRdfa entirely.
Happy to help with a PR for either.
- Lingua principale
- Python
- Stelle
- 986
- Fork
- 127
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di scrapinghub/extruct
-
Migrate to pytestForse già presa @Rotzbua l’ha presa 135 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
scrapinghub/extruct#252 ·
-
Tests fail with windowsForse già presa @Rotzbua l’ha presa 136 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
scrapinghub/extruct#251 ·
-
Install on modern pip and setuptools is failingForse già presa @Rotzbua l’ha presa 163 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
scrapinghub/extruct#241 · 5 commenti ·
-
Fix the Build Status badgeForse già presa @Rotzbua l’ha presa 163 giorni fa. Apertabug docs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 56/100
scrapinghub/extruct#236 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
scrapinghub/extruct#211 · 1 commento ·
Tutte le issue di scrapinghub/extruct
Issue simili
-
[19.0] pos_sale: settling an order with a 0 down payment line crashes (reading 'reward_id') and leaves a wrong amount dueForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 79/100
developmentseed/titiler-covjson#164 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
awslabs/visual-asset-management-system#2164 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
MakazhanAlpamys/Soup#3589 ·
I maintainer di solito rispondono entro 1 giorno
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno