Using Thrift 0.10.0, I am trying to use the package_prefix option like so:

 

$ thrift -version

Thrift version 0.10.0

 

$ thrift -v --gen py:package_prefix='top.package.' test.thrift

Scanning /Users/aaron.stockton/foo/bar/test.thrift for includes

Parsing /Users/aaron.stockton/foo/bar/test.thrift for types

Program: /Users/aaron.stockton/foo/bar/test.thrift

Generating "py:package_prefix=top.package."

 

$ cat test.thrift

const string MY_STRING = 'test'

 

struct SomeStruct {

  1: optional i32 id,

}

 

$ grep -r 'top\.package' gen-py

gen-py/test/constants.py:#  options string: py:package_prefix=top.package.

gen-py/test/ttypes.py:#  options string: py:package_prefix=top.package.

 

Looking through the pull_request that enabled this flag, the package should be 
prepended to the imports in my generated thrift. For example, here: 
https://github.com/apache/thrift/pull/755/files#diff-02a447078caf1a392f0a24b8ff73ecd0R1047

 

Not sure what Im doing wrong, but I haven’t been able to get thrift to do 
anything with that option other than adding it to a header at the top of the 
generated python. Any help would be greatly appreciated

 

 

Aaron Stockton

Reply via email to