peopledatalabs / peopledatalabs-python Goto Github PK
View Code? Open in Web Editor NEWA Python client for the People Data Labs API
Home Page: https://docs.peopledatalabs.com/docs/python-sdk
License: MIT License
A Python client for the People Data Labs API
Home Page: https://docs.peopledatalabs.com/docs/python-sdk
License: MIT License
Describe the bug
We are trying to upgrade a project dependency to pydantic > 2.0 and are blocked by not having a version of this project that supports it.
To Reproduce
poetry add pydantic==^2.0
Expected behavior
There could be a version of this package that was compatible with newer versions of pydantic
Screenshots
If applicable, add screenshots to help explain your problem.
Describe the bug
If the PDLP
constructor is called like this:
client = PDLPY(
api_key="YOUR API KEY",
)
the default value for version is settings.version
, and it is populated with the env var VERSION
if it's defined, which is a generic name that shouldn't be used as default value.
To Reproduce
$ export VERSION=latest
$ python -c "from peopledatalabs import PDLPY; client=PDLPY(api_key='YOUR API KEY')"
Expected behavior
IMHO the env var used should start with PDL_
. In this case PDL_VERSION
Additional context
peopledatalabs version = 1.1.1
pedantic version = 1.9.2
Traceback
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 8, in __init__
File "/usr/local/lib/python3.10/site-packages/pydantic/dataclasses.py", line 100, in _pydantic_post_init
raise validation_error
pydantic.error_wrappers.ValidationError: 1 validation error for PDLPY
version
string does not match regex "^v[0-9]$" (type=value_error.str.regex; pattern=^v[0-9]$)
This library currently pegs all dependencies to specific versions (i.e. using ==
in requirements.txt
), instead of specifying minimum required versions (i.e. using >=
). This practice makes it difficult to use this library in the context of larger projects, which are likely to have conflicting dependencies.
For example, I just tried installing this in a project that uses Prefect, and got this error:
These problems can be avoided if the People Data Labs library specifies minimum requirements, or version ranges where needed.
Describe the bug
Pydantic complains that you're supplying a mutable type as the default value for a field in the PDLPY.api_key
.
To Reproduce
Try to import the module: from peopledatalabs import PDLPY
Expected behavior
You should be able to import the module
Screenshots
N/A
Additional context
Here's my stacktrace:
Traceback (most recent call last):
File "/Users/me/Documents/workspace/pdl_api_test/src/main.py", line 11, in <module>
from src.lib.pdl_api import PDLCLient
File "/Users/me/Documents/workspace/pdl_api_test/src/lib/pdl_api.py", line 15, in <module>
from peopledatalabs import PDLPY # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/peopledatalabs/__init__.py", line 6, in <module>
from .main import PDLPY
File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/peopledatalabs/main.py", line 30, in <module>
@dataclass
^^^^^^^^^
File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/pydantic/dataclasses.py", line 265, in dataclass
return wrap(_cls)
^^^^^^^^^^
File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/pydantic/dataclasses.py", line 260, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/me/Library/Caches/pypoetry/virtualenvs/src-3ck7Pn5u-py3.11/lib/python3.11/site-packages/pydantic/dataclasses.py", line 159, in _process_class
cls: Type['Dataclass'] = dataclasses.dataclass( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1220, in dataclass
return wrap(cls)
^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1210, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'pydantic.types.SecretStr'> for field api_key is not allowed: use default_factory
Hi,
we're starting to integrate PDL into our backend. For our local and sandbox environments, we would like to use the sandbox API endpoints (https://docs.peopledatalabs.com/docs/sandbox-apis). However it seems that this client doesn't support it out of the box, the only way seems to set a BASE_PATH environment variable (from this line). The issue with this approach is that the naming of this variable is confusing, ideally it would be something like PDL_BASE_PATH.
Actually I'd suggest prefixing by PDL_ all environment variables that would override the settings to avoid conflicts with existing env vars.
Let me know what you think,
Cheers, Olivier
When trying to use the required
parameter in bulk person enrichment, it seems that it ends up being ignored. When calling directly the endpoint (e.g. with Postman) using the same request, it seems to work so the issue doesn't appear to come from the API.
One of the request being built:
{'metadata': {'key': '1'}, 'params': {'first_name': ['...'], 'last_name': ['...'], 'email': ['...'], 'min_likelihood': 6, 'required': 'work_email'}}
However, I'm getting back a 200 status code with a record that does not have a work_email
field (null value)
I'm using version 1.1.3
Describe the bug
InvalidEndpontError
for endpoints:
To Reproduce
Minimal reproduction
Expected behavior
Endpoints return results
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Calling these endpoints, with the Python SDK was working correctly a few days ago and I've confirmed the endpoints are working correctly when the same parameters are passed directly to the API via an HTTP client
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.