| 1 |
Source: dacite |
| 2 |
Section: python |
| 3 |
Priority: optional |
| 4 |
Maintainer: Debian Python Team <[email protected]> |
| 5 |
Uploaders: Valentin Vidic <[email protected]> |
| 6 |
Build-Depends: |
| 7 |
debhelper-compat (= 13), |
| 8 |
dh-python, |
| 9 |
python3-all, |
| 10 |
python3-pytest <!nocheck>, |
| 11 |
python3-pytest-benchmark <!nocheck>, |
| 12 |
python3-setuptools, |
| 13 |
Standards-Version: 4.7.2 |
| 14 |
Rules-Requires-Root: no |
| 15 |
Homepage: https://github.com/konradhalas/dacite |
| 16 |
Vcs-Git: https://salsa.debian.org/python-team/packages/dacite.git |
| 17 |
Vcs-Browser: https://salsa.debian.org/python-team/packages/dacite |
| 18 |
|
| 19 |
Package: python3-dacite |
| 20 |
Architecture: all |
| 21 |
Depends: ${misc:Depends}, ${python3:Depends}, |
| 22 |
Description: Simple creation of data classes from dictionaries |
| 23 |
Passing plain dictionaries as a data container between your functions or |
| 24 |
methods isn't a good practice. Of course you can always create your |
| 25 |
custom class instead, but this solution is an overkill if you only want |
| 26 |
to merge a few fields within a single object. |
| 27 |
. |
| 28 |
Fortunately Python has a good solution to this problem - data classes. |
| 29 |
Thanks to `@dataclass` decorator you can easily create a new custom |
| 30 |
type with a list of given fields in a declarative manner. Data classes |
| 31 |
support type hints by design. |
| 32 |
. |
| 33 |
However, even if you are using data classes, you have to create their |
| 34 |
instances somehow. In many such cases, your input is a dictionary - it |
| 35 |
can be a payload from a HTTP request or a raw data from a database. If |
| 36 |
you want to convert those dictionaries into data classes, `dacite` is |
| 37 |
your best friend. |
| 38 |
. |
| 39 |
This library was originally created to simplify creation of type hinted |
| 40 |
data transfer objects (DTO) which can cross the boundaries in the |
| 41 |
application architecture. |
| 42 |
. |
| 43 |
It's important to mention that `dacite` is not a data validation library. |
| 44 |
There are dozens of awesome data validation projects and it doesn't make |
| 45 |
sense to duplicate this functionality within `dacite`. If you want to |
| 46 |
validate your data first, you should combine `dacite` with one of data |
| 47 |
validation library. |