Skip to content

Commit 702aa7c

Browse files
committed
export symbols using __all__ to avoid typing errors
Mentioned in libgit2#1322 Explanation on how it works - https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface Example failing snippet: ```python import pygit2 def test(repo: pygit2.Repository): ... ```
1 parent 894a4dc commit 702aa7c

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

pygit2/__init__.py

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,79 @@
6161
from .utils import to_bytes, to_str
6262

6363

64+
__all__ = (
65+
# Low level API
66+
'Object',
67+
'Reference',
68+
'AlreadyExistsError',
69+
'Blob',
70+
'Branch',
71+
'Commit',
72+
'Diff',
73+
'DiffDelta',
74+
'DiffFile',
75+
'DiffHunk',
76+
'DiffLine',
77+
'DiffStats',
78+
'GitError',
79+
'InvalidSpecError',
80+
'Mailmap',
81+
'Note',
82+
'Odb',
83+
'OdbBackend',
84+
'OdbBackendLoose',
85+
'OdbBackendPack',
86+
'Oid',
87+
'Patch',
88+
'RefLogEntry',
89+
'Refdb',
90+
'RefdbBackend',
91+
'RefdbFsBackend',
92+
'Repository',
93+
'RevSpec',
94+
'Signature',
95+
'Stash',
96+
'Tag',
97+
'Tree',
98+
'TreeBuilder',
99+
'Walker',
100+
'Worktree',
101+
#
102+
'Blame',
103+
'BlameHunk',
104+
'BlobIO',
105+
'Payload',
106+
# callbacks
107+
'RemoteCallbacks',
108+
'CheckoutCallbacks',
109+
'StashApplyCallbacks',
110+
'git_clone_options',
111+
'git_fetch_options',
112+
'git_proxy_options',
113+
'get_credentials',
114+
#
115+
'Config',
116+
# credentials
117+
'Username',
118+
'UserPass',
119+
'Keypair',
120+
'KeypairFromAgent',
121+
'KeypairFromMemory',
122+
#
123+
'check_error',
124+
'Passthrough',
125+
'Filter',
126+
'Index',
127+
'IndexEntry',
128+
'PackBuilder',
129+
'Remote',
130+
'Repository',
131+
'Settings',
132+
'Submodule',
133+
'to_bytes',
134+
'to_str',
135+
)
136+
64137
# Features
65138
features = enums.Feature(C.git_libgit2_features())
66139

0 commit comments

Comments
 (0)