launchdarkly / python-server-sdk

LaunchDarkly Server-side SDK for Python
https://docs.launchdarkly.com/sdk/server-side/python
Other
38 stars 45 forks source link

Packaging this sdk with PEX causes collisions #281

Closed Sheemap closed 6 months ago

Sheemap commented 6 months ago

Is your feature request related to a problem? Please describe.

Yes, It's causing an issue with our build system. The issue is the testing directories for this repo and the python-eventsource repo, are named the same and both included in their respective pip releases.


We use the pex build tool to package up all our dependencies up into a serverless function, it tries to ensure packages don't conflict when it collects those dependencies.

Unfortunately when building python-server-sdk, it errors out due to a namespace collision with python-eventsource, which it depends on.

I got to this conclusion from someone else reporting this error to the Pants build system devs, here is the maintainer's explanation and proposed fix. https://github.com/pantsbuild/pants/issues/20224#issuecomment-1821741455

Describe the solution you'd like

If it isn't used at runtime, excluding the testing folder from the released pip package would be great.

Describe alternatives you've considered

Additional context

There is a workaround we can use short term to allow collisions, but we hope to use launchdarkly on a lot of functions, and don't want to disable this collision feature long term.

Logs I'm seeing

Encountered collisions populating src.python.api/lambda from PEX at faas_repository.pex:
1. src.python.api/lambda/testing/http_util.py was provided by:
    sha1:41a85a0d0ed3f173204af13855221a85262e9509 -> /home/bread/.cache/pants/named_caches/pex_root/installed_wheels/1b9580d49755735bd7acccd4e2cecfc17a1669e8e499e96e396a401012dbdae3/launchdarkly_server_sdk-9.3.0-py3-none-any.whl/testing/http_util.py
    sha1:6992afbf74d310b1d70287f856d9d96140f9455d -> /home/bread/.cache/pants/named_caches/pex_root/installed_wheels/3d7e5301bc4b4a744ecdaa10de8bce52c2f3c66a97e9aa10ab11ca81b67fb31b/launchdarkly_eventsource-1.1.1-py3-none-any.whl/testing/http_util.py
2. src.python.api/lambda/testing/__init__.py was provided by:
    sha1:b679ff39746fd1ccd574ad90603eb8c5e97d5164 -> /home/bread/.cache/pants/named_caches/pex_root/installed_wheels/1b9580d49755735bd7acccd4e2cecfc17a1669e8e499e96e396a401012dbdae3/launchdarkly_server_sdk-9.3.0-py3-none-any.whl/testing/__init__.py
    sha1:da39a3ee5e6b4b0d3255bfef95601890afd80709 -> /home/bread/.cache/pants/named_caches/pex_root/installed_wheels/3d7e5301bc4b4a744ecdaa10de8bce52c2f3c66a97e9aa10ab11ca81b67fb31b/launchdarkly_eventsource-1.1.1-py3-none-any.whl/testing/__init__.py

Thanks!

keelerm84 commented 6 months ago

Thank you for bringing this to our attention. I will take a look at this and let you know once we have a resolution.

Tracking internally as sc-239226.

keelerm84 commented 6 months ago

@Sheemap this should be resolved in v9.3.1. Please let me know if you experience any further issues.

Sheemap commented 6 months ago

Awesome! Just confirmed it working, thanks a bunch for the quick response and fix! :)