Meta tags:
description= Consider using stubgen-pyx for automatic Cython stub generation;
Headings (most frequently used words):
uh, oh, saved, searches, editor, edit, navigation, footer, search, code, repositories, users, issues, pull, requests, provide, feedback, consider, using, stubgen, pyx, for, automatic, cython, stub, generation, 13920, title, select, reply, menu, use, to, filter, your, results, more, quickly, jon, edward, feb, 2026, overview, problem, statement, proposed, solution, expected, outcomes, additional, notes, replies, comments, key, benefits, implementation, approach, proof, of, concept, configuration, example,
Text of the page (most frequently used words):
the (73), def (32), self (31), and (28), key (27), this (22), list (21), cython (21), match (21), none (20), for (20), str (20), any (19), bool (19), matcher (19), int (17), with (16), spacy (16), false (16), pyx (15), code (14), #stubgen (14), github (13), all (13), from (13), pattern (13), patterns (12), vocab (12), token (12), type (11), doc (11), tuple (11), security (10), reload (10), optional (10), was (9), error (9), import (9), source (9), span (9), on_match (9), you (8), reacted (8), emoji (8), loading (8), support (8), fuzzy_compare (8), rule (8), union (8), times (8), can (7), not (7), there (7), while (7), please (7), page (7), stubs (7), callable (7), __call__ (7), as_spans (7), add (7), files (6), api (6), fuzzy (6), __init__ (6), operators (6), class (6), set (6), returns (6), greedy (6), more (6), rules (6), pyi (6), your (6), enterprise (6), view (6), features (5), sign (5), documentation (5), python (5), ide (5), result (5), file (5), validate (5), regex (5), start (5), with_alignments (5), true (5), whether (5), callback (5), require (5), number (5), stub (5), search (5), docs (4), community (4), navigation (4), create (4), new (4), saved (4), must (4), feedback (4), https (4), jon (4), edward (4), changes (4), generated (4), available (4), automatic (4), developer (4), annotations (4), is_extension (4), predicate (4), value (4), attr (4), match_id (4), end (4), matches (4), return (4), which (4), allow_missing (4), doclike (4), actions (4), iterator (4), build (4), using (4), generation (4), quality (4), issues (4), that (3), information (3), 2026 (3), reply (3), quote (3), project (3), have (3), options (3), pypi (3), tool (3), are (3), has (3), development (3), hints (3), modules (3), results (3), generate (3), one (3), instead (3), into (3), tuples (3), get (3), check (3), remove (3), filter (3), first (3), longest (3), argument (3), _n_ (3), tokens (3), literal (3), overload (3), dict (3), integrate (3), docstrings (3), incomplete (3), 13920 (3), consider (3), insights (3), pull (3), requests (3), signed (3), settings (3), another (3), tab (3), window (3), refresh (3), session (3), use (3), grade (3), copilot (3), platform (3), solutions (3), explore (3), perform (2), time (2), manage (2), footer (2), thumbs (2), reference (2), mention (2), attach (2), task (2), unordered (2), numbered (2), link (2), italic (2), bold (2), heading (2), menu (2), labels (2), ideas (2), conversation (2), comments (2), cli (2), configuration (2), approach (2), integration (2), edited (2), handles (2), cases (2), additional (2), better (2), users (2), stubgenpyx (2), via (2), handwritten (2), making (2), returned (2), objects (2), skip (2), missing (2), find (2), sequences (2), matching (2), object (2), as_tuples (2), return_matches (2), batch_size (2), pipe (2), retrieve (2), default (2), given (2), has_key (2), ones (2), _m_ (2), least (2), exactly (2), ids (2), consists (2), previous (2), contains (2), __contains__ (2), added (2), __len__ (2), __reduce__ (2), levenshtein_compare (2), usage (2), based (2), iterable (2), include (2), full (2), automatically (2), constructs (2), signatures (2), direct (2), user (2), date (2), they (2), out (2), maintainer (2), feb (2), something (2), went (2), wrong (2), editor (2), edit (2), content (2), discussion (2), discussions (2), explosion (2), appearance (2), cancel (2), see (2), searches (2), repositories (2), business (2), advanced (2), topics (2), open (2), resources (2), customer (2), services (2), devops (2), app (2), merge (2), action, share, personal, cookies, contact, status, privacy, terms, inc, eyes, rocket, heart, confused, hooray, laugh, down, select, participant, yet, category, already, account, comment, join, free, replies, reactions, logged, vote, give, translation, helpful, beta, includes, details, org, com, references, would, team, interested, exploring, happy, help, discuss, questions, about, breaking, existing, structure, required, human, readable, manually, reviewed, needed, comprehensive, test, coverage, edge, well, actively, maintained, notes, foundation, stricter, checking, validation, through, faster, cycles, experience, downstream, improved, autocomplete, expected, outcomes, failed, pyx_file, print, success, convert_glob, stubgen_pyx, command, example, written, single, truth, maintaining, two, versions, __future__, callbacks, unpickle_matcher, _comparisonpredicate, __repr__, intersects, is_superset, is_subset, not_in, _setpredicate, _regexpredicate, fuzzy9, fuzzy8, fuzzy7, fuzzy6, fuzzy5, fuzzy4, fuzzy3, fuzzy2, fuzzy1, _fuzzypredicate, alignments, integer, describing, describes, setting, ignored, corresponding, index, length, matched, each, entry, denotes, alignment, attributes, included, defaults, checks, annotation, document, over, supplied, stream, documents, yielding, them, turn, deprecated, 1000, stored, string, exist, keyerror, raised, does, executed, keyword, since, takes, second, returning, non, overlapping, per, either, taking, preference, however, final, possible, just, most, but, than, allow, zero, make, allowing, negate, requiring, quantifier, operator, under, quantifiers, dictionary, mapping, attribute, values, optionally, token_specs, where, token_spec, will, receive, arguments, also, replaced, exists, appended, individual, identical, note, only, comparison, method, vocabulary, shared, levenshtein, _normalize_key, compat, typing, current, state, proof, concept, regenerate, distributed, package, script, pipeline, dependency, implementation, works, integrated, pipelines, easy, auto, deduplicates, trims, unused, imports, smart, handling, converts, types, equivalents, unicode, bint, normalization, cdef, classes, cpdef, functions, other, maintains, decorators, docstring, preservation, preserves, parses, directly, compiler, ast, pxd, analysis, benefits, specialized, offers, proposed, solution, poor, autocompletion, loss, function, specific, these, difficulties, might, lead, following, frustrations, addition, keep, when, consuming, prone, process, currently, limited, tooling, cannot, access, embedded, putting, disadvantage, accessing, module, doesn, problem, statement, like, propose, integrating, creator, utility, overview, actor, deleted, title, top, started, 175, star, fork, change, notification, notifications, public, message, dismiss, alert, switched, accounts, resetting, focus, qualifiers, our, query, name, quickly, submit, email, address, contacted, read, every, piece, take, input, very, seriously, provide, syntax, tips, clear, jump, pricing, premium, ons, powered, collections, trending, archive, program, stars, accelerator, lab, programs, fund, developers, sponsors, partners, trust, center, forum, skills, ebooks, reports, events, webinars, stories, software, topic, industries, government, manufacturing, financial, healthcare, industry, devsecops, modernization, case, nonprofits, startups, small, medium, teams, enterprises, company, size, marketplace, changelog, blog, why, stop, leaks, before, secret, protection, secure, fix, vulnerabilities, application, enforce, review, plan, track, work, instant, dev, environments, codespaces, automate, workflow, workflows, external, tools, mcp, registry, agents, issue, write, creation, toggle,
Text of the page (random words):
consider using stubgen pyx for automatic cython stub generation explosion spacy discussion 13920 github skip to content navigation menu toggle navigation sign in appearance settings platform ai code creation github copilot write better code with ai github copilot app direct agents from issue to merge mcp registry new integrate external tools developer workflows actions automate any workflow codespaces instant dev environments issues plan and track work code review manage code changes code quality enforce quality at merge application security github advanced security find and fix vulnerabilities code security secure your code as you build secret protection stop leaks before they start explore why github documentation blog changelog marketplace view all features solutions by company size enterprises small and medium teams startups nonprofits by use case app modernization devsecops devops ci cd view all use cases by industry healthcare financial services manufacturing government view all industries view all solutions resources explore by topic ai software development devops security view all topics explore by type customer stories events webinars ebooks reports business insights github skills support services documentation customer support community forum trust center partners view all resources open source community github sponsors fund open source developers programs security lab maintainer community accelerator github stars archive program repositories topics trending collections enterprise enterprise solutions enterprise platform ai powered developer platform available add ons github advanced security enterprise grade security features copilot for business enterprise grade ai features premium support enterprise grade 24 7 support pricing search or jump to search code repositories users issues pull requests search clear search syntax tips provide feedback we read every piece of feedback and take your input very seriously include my email address so i can be contacted cancel submit feedback saved searches use saved searches to filter your results more quickly name query to see all available qualifiers see our documentation cancel create saved search sign in sign up appearance settings resetting focus you signed in with another tab or window reload to refresh your session you signed out in another tab or window reload to refresh your session you switched accounts on another tab or window reload to refresh your session dismiss alert message uh oh there was an error while loading please reload this page explosion spacy public uh oh there was an error while loading please reload this page notifications you must be signed in to change notification settings fork 4 7k star 33 8k code issues 175 pull requests 55 discussions actions security and quality 0 insights additional navigation options code issues pull requests discussions actions security and quality insights consider using stubgen pyx for automatic cython stub generation 13920 jon edward started this conversation in new features project ideas consider using stubgen pyx for automatic cython stub generation 13920 jon edward feb 9 2026 0 comments return to top discussion options uh oh there was an error while loading please reload this page title something went wrong uh oh there was an error while loading please reload this page quote reply edited uh oh there was an error while loading please reload this page editor s edit actor deleted this content editor s edit something went wrong uh oh there was an error while loading please reload this page jon edward feb 9 2026 overview i d like to propose integrating stubgen pyx to automatically generate python stub files pyi from spacy s cython source code i am the creator and maintainer of this utility problem statement spacy s cython modules currently have limited ide support ide tooling cannot access type hints and docstrings embedded in cython source code putting the user at a disadvantage if they re accessing a cython module that doesn t have a handwritten pyi file or if the pyi file is out of date or incomplete in addition to this a spacy developer must keep the pyi file up to date when making changes to the cython source which is a time consuming and error prone process these difficulties might lead to the following user frustrations missing or incomplete type annotations and cython specific constructs incomplete function signatures loss of docstrings poor ide autocompletion and type hints for cython modules proposed solution integrate stubgen pyx a specialized stub generation tool for cython which offers key benefits direct source analysis parses pyx and pxd files directly using the cython compiler s ast type information preserves type annotations and signatures from cython source docstring preservation maintains docstrings and decorators in generated stubs full cython support handles cdef classes cpdef functions and other cython constructs type normalization automatically converts cython types e g bint bool unicode str to python equivalents smart import handling auto deduplicates and trims unused imports in generated stubs easy integration works via cli or python api can be integrated into build pipelines and ci cd implementation approach add stubgen pyx as a development build dependency create a script to generate stubs for all cython files e g in build pipeline include pyi files in the distributed package for full ide support integrate into ci cd to regenerate stubs on cython source changes optional proof of concept this is the current state of spacy matcher matcher pyi from typing import any callable dict iterable iterator list optional tuple union overload from compat import literal from tokens import doc span from vocab import vocab class matcher def __init__ self vocab vocab validate bool fuzzy_compare callable str str int bool none def __reduce__ self any def __len__ self int def __contains__ self key str bool def add self key union str int patterns list list dict str any on_match optional callable matcher doc int list tuple any any greedy optional str none def remove self key str none def has_key self key union str int bool def get self key union str int default optional any tuple optional callable any any list list dict any any def pipe self docs iterable tuple doc any batch_size int return_matches bool as_tuples bool union iterator tuple tuple doc any any iterator tuple doc any iterator doc overload def __call__ self doclike union doc span as_spans literal false allow_missing bool with_alignments bool list tuple int int int overload def __call__ self doclike union doc span as_spans literal true allow_missing bool with_alignments bool list span def _normalize_key self key any any this is the result of stubgen pyx from __future__ import annotations from tokens token import token from levenshtein import levenshtein_compare class matcher match sequences of tokens based on pattern rules docs https spacy io api matcher usage https spacy io usage rule based matching def __init__ self vocab validate true fuzzy_compare levenshtein_compare create the matcher vocab vocab the vocabulary object which must be shared with the validate bool validate all patterns added to this matcher fuzzy_compare callable str str int bool the comparison method for the fuzzy operators def __reduce__ self def __len__ self get the number of rules added to the matcher note that this only returns the number of rules identical with the number of ids not the number of individual patterns returns int the number of rules def __contains__ self key check whether the matcher contains rules for a match id key str the match id returns bool whether the matcher contains rules for this match id def add self key patterns on_match none greedy str none add a match rule to the matcher a match rule consists of an id key an on_match callback and one or more patterns if the key exists the patterns are appended to the previous ones and the previous on_match callback is replaced the on_match callback will receive the arguments matcher doc i matches you can also set on_match to none to not perform any actions a pattern consists of one or more token_specs where a token_spec is a dictionary mapping attribute ids to values and optionally a quantifier operator under the key op the available quantifiers are negate the pattern by requiring it to match exactly 0 times make the pattern optional by allowing it to match 0 or 1 times require the pattern to match 1 or more times allow the pattern to zero or more times n require the pattern to match exactly _n_ times n m require the pattern to match at least _n_ but not more than _m_ times n require the pattern to match at least _n_ times m require the pattern to match at most _m_ times the and operators return all possible matches not just the greedy ones however the greedy argument can filter the final matches by returning a non overlapping set per key either taking preference to the first greedy match first or the longest longest since spacy v2 2 2 matcher add takes a list of patterns as the second argument and the on_match callback is an optional keyword argument key union str int the match id patterns list the patterns to add for the given key on_match callable optional callback executed on match greedy str optional filter first or longest def remove self key remove a rule from the matcher a keyerror is raised if the key does not exist key str the id of the match rule def has_key self key check whether the matcher has a rule with a given key key string or int the key to check returns bool whether the matcher has the rule def get self key default none retrieve the pattern stored for a key key str int the key to retrieve returns tuple the rule as an on_match patterns tuple def pipe self docs batch_size 1000 return_matches false as_tuples false match a stream of documents yielding them in turn deprecated as of spacy v3 0 def __call__ self doclike object as_spans false allow_missing false with_alignments false find all token sequences matching the supplied pattern doclike doc or span the document to match over as_spans bool return span objects with labels instead of match_id start end tuples allow_missing bool whether to skip checks for missing annotation for attributes included in patterns defaults to false with_alignments bool return match alignment information which is list int with length of matched span each entry denotes the corresponding index of token pattern if as_spans is set to true this setting is ignored returns list a list of match_id start end tuples describing the matches a match tuple describes a span doc start end the match_id is an integer if as_spans is set to true a list of span objects is returned if with_alignments is set to true and as_spans is set to false a list of match_id start end alignments tuples is returned class _fuzzypredicate operators fuzzy fuzzy1 fuzzy2 fuzzy3 fuzzy4 fuzzy5 fuzzy6 fuzzy7 fuzzy8 fuzzy9 def __init__ self i attr value predicate is_extension false vocab none regex false fuzzy none fuzzy_compare none def __call__ self token token class _regexpredicate operators regex def __init__ self i attr value predicate is_extension false vocab none regex false fuzzy none fuzzy_compare none def __call__ self token token class _setpredicate operators in not_in is_subset is_superset intersects def __init__ self i attr value predicate is_extension false vocab none regex false fuzzy none fuzzy_compare none def __call__ self token token def __repr__ self class _comparisonpredicate operators def __init__ self i attr value predicate is_extension false vocab none regex false fuzzy none fuzzy_compare none def __call__ self token token def unpickle_matcher vocab patterns callbacks validate fuzzy_compare this file was generated by stubgen pyx v0 2 2 from spacy matcher matcher pyx the handwritten type annotations ie callable str str int bool can instead be written into the cython file making a single source of truth instead of maintaining two versions configuration example generate all stubs in one command stubgen pyx spacy or via python api from stubgen_pyx import stubgenpyx stubgen stubgenpyx results stubgen convert_glob spacy pyx for result in results if not result success print f failed result pyx_file result error expected outcomes improved ide support autocomplete type hints for spacy s cython modules better developer experience for downstream users faster development cycles automatic documentation of cython api through type stubs foundation for stricter type checking and validation additional notes stubgen pyx is actively maintained and available on pypi it has comprehensive test coverage and handles edge cases well the generated stubs are human readable and can be manually reviewed edited if needed no breaking changes to existing spacy api or structure required would the spacy team be interested in exploring this approach i d be happy to help with integration or discuss any questions about the tool tool references github https github com jon edward stubgen pyx pypi https pypi org project stubgen pyx documentation includes cli options python api and configuration details beta was this translation helpful give feedback 2 you must be logged in to vote all reactions replies 0 comments sign up for free to join this conversation on github already have an account sign in to comment category new features project ideas labels none yet 1 participant heading bold italic quote code link numbered list unordered list task list attach files mention reference menu heading bold italic quote code link numbered list unordered list task list attach files mention reference select a reply loading uh oh there was an error while loading please reload this page create a new saved reply 1 reacted with thumbs up emoji 1 reacted with thumbs down emoji 1 reacted with laugh emoji 1 reacted with hooray emoji 1 reacted with confused emoji ️ 1 reacted with heart emoji 1 reacted with rocket emoji 1 reacted with eyes emoji footer 2026 github inc footer navigation terms privacy security status community docs contact manage cookies do not share my personal information you can t perform that action at this time
|