Does anyone have experience using Protobufs in Pan...
# general
r
Does anyone have experience using Protobufs in Pants? I am using some of `Google`'s well-known types & common types. I have them checked-in in my codebase (is there a better way?) for convenience. However, this does not work well with Pants when I run:
Copy code
pants export \
  --resolve=python-default \
  --export-py-generated-sources-in-resolve=python-default
It fails with:
Copy code
Traceback (most recent call last):
  File "/Users/achrafmamdouh/GitHub/hera/dist/export/python/virtualenvs/python-default/3.12.7/__pants_codegen__/codegen_setup.py", line 15, in <module>
    os.rename(os.path.join(codegen_dir, item), os.path.join(site_packages_dir, item))
OSError: [Errno 66] Directory not empty: '/Users/achrafmamdouh/GitHub/hera/dist/export/python/virtualenvs/python-default/3.12.7/__pants_codegen__/google' -> '/Users/achrafmamdouh/GitHub/hera/dist/export/python/virtualenvs/python-default/3.12.7/lib/python3.12/site-packages/google'
I understand why the error is emitted: 1. `Google`'s types have a package starting with
google
. Hence, the output of the export is written under a folder named
google
. 2. At the same time, I have several 3rd party deps that are also written there. Hence the clash.
g
I've never used the common types, but it does seem like an actual bug that it fails like this.
r
Ok thanks for confirming. I will file a bug
Do you know if there is an easy workaround to unblock me?
By the way the same issue should happen with the well-known types like
Timestamp
.
Changing package from
google
to
goog
solve my issue for the time being.
Actually it's not a good idea to change the
package
name because well-known types have extra behavior @gorgeous-winter-99296 this is a blocker. Can you help me?
g
If you can put together a small repo with a repro I can take a look :)