-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add optional cython extension #44
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2f24545
feat: add optional cython extension
bdraco 5df1680
feat: add optional cython extension
bdraco 55c00c9
fix: reduce by 35%
bdraco 3ec5894
fix: reduce by 35%
bdraco 200a623
fix: add pxd
bdraco 2825db9
fix: some more
bdraco 96669ff
fix: fixes
bdraco 99ddcec
feat: adjust for cython
bdraco f26bd00
fix: fix refactoring error
bdraco 5d55e92
fix: add SKIP_CYTHON option
bdraco 7e1bf02
fix: bash syntax
bdraco b356585
fix: cache
bdraco 9178368
fix: cache
bdraco 4506f4c
fix: delete setup.py
bdraco 5f03047
fix: lock
bdraco e53b074
fix: relock poetry
bdraco d8bc552
fix: poetry build
bdraco 7304d29
fix: generation of setup.py
bdraco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Build optional cython modules.""" | ||
|
||
import contextlib | ||
import os | ||
from distutils.command.build_ext import build_ext | ||
|
||
|
||
class BuildExt(build_ext): | ||
def build_extensions(self): | ||
try: | ||
super().build_extensions() | ||
except Exception: | ||
pass | ||
|
||
|
||
def build(setup_kwargs): | ||
if os.environ.get("SKIP_CYTHON", False): | ||
return | ||
with contextlib.suppress(Exception): | ||
from Cython.Build import cythonize | ||
|
||
setup_kwargs.update( | ||
dict( | ||
ext_modules=cythonize( | ||
[ | ||
"src/dbus_fast/_private/marshaller.py", | ||
"src/dbus_fast/_private/unmarshaller.py", | ||
] | ||
), | ||
cmdclass=dict(build_ext=BuildExt), | ||
) | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""cdefs for marshaller.py""" | ||
|
||
import cython | ||
|
||
|
||
cdef class Marshaller: | ||
|
||
cdef object signature_tree | ||
cdef object _buf | ||
cdef object body | ||
|
||
|
||
@cython.locals( | ||
offset=cython.ulong, | ||
) | ||
cpdef int align(self, unsigned long n) | ||
|
||
|
||
@cython.locals( | ||
signature_len=cython.uint, | ||
written=cython.uint, | ||
) | ||
cpdef write_string(self, object value, _ = *) | ||
|
||
@cython.locals( | ||
array_len=cython.uint, | ||
written=cython.uint, | ||
) | ||
cpdef write_array(self, object array, object type) | ||
|
||
@cython.locals( | ||
written=cython.uint, | ||
) | ||
cpdef write_single(self, object type_, object body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"""cdefs for unmarshaller.py""" | ||
|
||
import cython | ||
|
||
from ..signature import SignatureType | ||
|
||
|
||
cdef unsigned int UINT32_SIZE | ||
cdef unsigned int HEADER_ARRAY_OF_STRUCT_SIGNATURE_POSITION | ||
cdef unsigned int HEADER_SIGNATURE_SIZE | ||
|
||
cdef class Unmarshaller: | ||
|
||
cdef object unix_fds | ||
cdef object buf | ||
cdef object view | ||
cdef unsigned int pos | ||
cdef object stream | ||
cdef object sock | ||
cdef object _message | ||
cdef object readers | ||
cdef unsigned int body_len | ||
cdef unsigned int serial | ||
cdef unsigned int header_len | ||
cdef object message_type | ||
cdef object flag | ||
cdef unsigned int msg_len | ||
cdef object _uint32_unpack | ||
|
||
|
||
@cython.locals( | ||
start_len=cython.ulong, | ||
missing_bytes=cython.ulong, | ||
) | ||
cpdef read_to_pos(self, unsigned long pos) | ||
|
||
cpdef read_string_cast(self, type_ = *) | ||
|
||
@cython.locals( | ||
beginning_pos=cython.ulong, | ||
array_length=cython.uint, | ||
) | ||
cpdef read_array(self, object type_) | ||
|
||
@cython.locals( | ||
o=cython.ulong, | ||
signature_len=cython.uint, | ||
) | ||
cpdef read_signature(self, type_ = *) | ||
|
||
@cython.locals( | ||
endian=cython.uint, | ||
protocol_version=cython.uint, | ||
) | ||
cpdef _read_header(self) | ||
|
||
@cython.locals( | ||
beginning_pos=cython.ulong, | ||
o=cython.ulong, | ||
signature_len=cython.uint, | ||
) | ||
cpdef header_fields(self, unsigned int header_length) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncio_timeout
is a dependency, so we can no longer claim zero dependencies.