Skip to content
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

Binary support #164

Merged
merged 47 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ad05487
Used exception instead of bare exception
JonnoFTW Jan 26, 2021
3b4d28d
Merge remote-tracking branch 'upstream/master'
JonnoFTW Feb 9, 2021
4ebd943
Use getvalue if available to read the contents of the transport, repe…
JonnoFTW Oct 26, 2020
06e2bc8
Added magic line
JonnoFTW Oct 15, 2020
4aba93b
Added apachejsonprotocol to documentation
JonnoFTW Oct 15, 2020
bb57d6b
Added extra test case for boolean map keys
JonnoFTW Oct 12, 2020
ef789d5
No bare exception
JonnoFTW Feb 9, 2021
08b32e8
fixed version of six
JonnoFTW Oct 15, 2020
d5f5061
Updated apache test thrift
JonnoFTW Feb 9, 2021
6d60c53
Fixed imports
JonnoFTW Oct 1, 2020
d0a9ffb
Removed trailing comma
JonnoFTW Oct 13, 2020
847adfe
Added check for binary support
JonnoFTW Feb 9, 2021
ea8c70e
added binary data fields
JonnoFTW Oct 1, 2020
740768c
Removed duplicate binary member
JonnoFTW Oct 13, 2020
cda0198
Corrected binary serialisation
JonnoFTW Oct 14, 2020
d17b07c
Added test case to show that protocols are broken
JonnoFTW Oct 14, 2020
5e69e43
Fixed relative import issue
JonnoFTW Oct 14, 2020
16cf122
Fixed read/write of TType.BINARY
JonnoFTW Oct 14, 2020
feca83f
Removed useless traceback debug
JonnoFTW Oct 14, 2020
35de6a2
Added binary field
JonnoFTW Oct 14, 2020
8482a1c
Refactored test
JonnoFTW Oct 14, 2020
5a8a971
WIP for compact to support binary
JonnoFTW Oct 14, 2020
a1344ba
Added binary support to compact protocol
JonnoFTW Oct 15, 2020
0132455
cleaned up comment
JonnoFTW Oct 15, 2020
1313dc3
Added binary support to asyncio compact format
JonnoFTW Oct 15, 2020
f00bf6a
Added binary support to asyncio binary protocol
JonnoFTW Oct 15, 2020
d652a59
Fixed linter and pypy error
JonnoFTW Oct 15, 2020
997bb39
Added trailing comma
JonnoFTW Oct 16, 2020
2e46fcc
Increased server startup delay
JonnoFTW Oct 16, 2020
03278ab
Fixed six semantic version
JonnoFTW Oct 16, 2020
e23284a
Fixed incompatibility with apache thrift binary
JonnoFTW Oct 20, 2020
446e18d
Refactored bin_type check
JonnoFTW Oct 20, 2020
33953b7
Added extra test cases
JonnoFTW Oct 20, 2020
a3c735f
Fixed binary lists not working
JonnoFTW Oct 21, 2020
255d401
Made cybin work with string/binary
JonnoFTW Oct 21, 2020
4f26dff
Added more test cases
JonnoFTW Oct 21, 2020
0ef8541
Added more test cases to check for exception raising
JonnoFTW Oct 26, 2020
d4bd284
Wait a bit for the process to die before the next test starts
JonnoFTW Oct 26, 2020
0bbc551
Added binary support
JonnoFTW Feb 10, 2021
c546d4c
Fixed flake8 error
JonnoFTW Feb 10, 2021
6d4c545
Fix py2 error
JonnoFTW Feb 10, 2021
8283109
added check to prevent test running on pypy
JonnoFTW Feb 10, 2021
f780936
Added reason for skipif
JonnoFTW Feb 10, 2021
6c8cb13
Flake8 fix hopefully
JonnoFTW Feb 10, 2021
f85a3f1
Merge branch 'master' into binary_support
ethe Apr 12, 2021
d6e6034
Added newline at end of file
JonnoFTW Apr 12, 2021
80264d7
Merge remote-tracking branch 'origin/binary_support' into binary_support
JonnoFTW Apr 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ python lib):

* json protocol

* Apache JSON protocol compatible with apache thrift distribution's JSON protocol.
Simply do ``from thriftpy2.protocol import TApacheJSONProtocolFactory`` and pass
this to the ``proto_factory`` argument where appropriate.

* buffered transport (python & cython)

* framed transport
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

install_requires = [
"ply>=3.4,<4.0",
"six~=1.15",
]

tornado_requires = [
Expand All @@ -35,6 +36,7 @@
"pytest>=2.8",
"sphinx-rtd-theme>=0.1.9",
"sphinx>=1.3",
"pytest>=6.1.1",
] + tornado_requires


Expand Down
41 changes: 41 additions & 0 deletions tests/apache_json_test.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
exception TestException {
1: string message
}
struct Foo {
1: string bar
}
struct Test {
1: bool tbool,
2: i8 tbyte,
3: i16 tshort,
4: i32 tint,
5: i64 tlong,
6: double tdouble,
7: string tstr,
8: list<string> tlist_of_strings,
9: map<i32, string> tmap_of_int2str,
10: set<i32> tsetofints,
11: map<string, Foo> tmap_of_str2foo,
12: map<string, list<string>> tmap_of_str2stringlist,
13: map<string, map<string, Foo>> tmap_of_str2mapofstring2foo,
14: list<Foo> tlist_of_foo,
15: Foo tfoo,
16: list<map<string, i32>> tlist_of_maps2int,
17: map<string, list<Foo>> tmap_of_str2foolist,
18: map<i32, Foo> tmap_of_int2foo,
19: binary tbinary,
20: optional map<bool, string> tmap_of_bool2str
21: optional map<bool, i16> tmap_of_bool2int,
22: list<binary> tlist_of_binary,
23: set<binary> tset_of_binary,
24: map<binary,binary> tbin2bin,

}

service TestService {
// Testing Service that just returns what you give it
Test test(1: Test test);
void do_error(1: string arg) throws (
1: TestException e
)
}
15 changes: 15 additions & 0 deletions tests/bin_test.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct BinTest {
1: binary tbinary,
2: map<string, binary> str2bin,
3: map<binary, binary> bin2bin,
4: map<binary, string> bin2str,
5: list<binary> binlist,
6: set<binary> binset,
7: map<string, list<binary>> map_of_str2binlist,
8: map<binary, map<binary, binary>> map_of_bin2bin,
9: optional list<map<binary, string>> list_of_bin2str
}
service BinService {
// Testing Service that just returns what you give it
BinTest test(1: BinTest test);
}
Loading