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0.7b2
0.7b1
0.7
0.6b4
0.6b3
0.6b2
0.6b1
0.6
0.5b3
0.5b2
0.5b1
0.5.1
0.5
0.4b6
0.4b5
0.4b4
0.4b3
0.4b2
0.4b1
0.4.2
0.4.1
0.4
0.3b4
0.3b3
0.3b2
0.3b1
0.3
0.2b6
0.2b5
0.2b4
0.2b3
0.2b2
0.2b1
0.2
0.1a9
0.1a8
0.1a7
0.1a6
0.1a5
0.1a4
0.1a3
0.1a2
0.1a13
0.1a12
0.1a11
0.1a10
0.1a1
0.15a4
0.15a3
0.15a2
0.15a1
0.15.2
0.15.1
0.15
0.14.post1
0.14
0.13b8
0.13b7
0.13b6
0.13b5
0.13b4
0.13b3
0.13b2
0.13b1
0.13.3
0.13.2
0.13.1
0.13
0.12b4
0.12b3
0.12b2
0.12b1
0.12
0.11b4
0.11b3
0.11b2
0.11b1
0.11.1
0.11
0.10b4
0.10b3
0.10b2
0.10b1
0.10
0.1
توضیحات
File-based ORM for dataclasses.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | datafiles-2.1b5 |
| نام | datafiles |
| نسخه کتابخانه | 2.1b5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Jace Browning |
| ایمیل نویسنده | jacebrowning@gmail.com |
| آدرس صفحه اصلی | https://pypi.org/project/datafiles |
| آدرس اینترنتی | https://pypi.org/project/datafiles/ |
| مجوز | MIT |
# Datafiles: A file-based ORM for Python dataclasses
Datafiles is a bidirectional serialization library for Python [dataclasses](https://docs.python.org/3/library/dataclasses.html) to synchronize objects to the filesystem using type annotations. It supports a variety of file formats with round-trip preservation of formatting and comments, where possible. Object changes are automatically saved to disk and only include the minimum data needed to restore each object.
[](https://travis-ci.com/jacebrowning/datafiles)
[](https://ci.appveyor.com/project/jacebrowning/datafiles)
[](https://coveralls.io/r/jacebrowning/datafiles)
[](https://pypi.org/project/datafiles)
[](https://pypi.org/project/datafiles)
[](https://pypistats.org/packages/datafiles)
[](https://gitter.im/jacebrowning/datafiles)
Some common use cases include:
- Coercing user-editable files into the proper Python types
- Storing program configuration and data in version control
- Loading data fixtures for demonstration or testing purposes
- Synchronizing application state using file sharing services
- Prototyping data models agnostic of persistence backends
Watch [my lightning talk](https://www.youtube.com/watch?v=moYkuNrmc1I&feature=youtu.be&t=1225) for a demo of this in action!
## Overview
Take an existing dataclass such as [this example](https://docs.python.org/3/library/dataclasses.html#module-dataclasses) from the documentation:
```python
from dataclasses import dataclass
@dataclass
class InventoryItem:
"""Class for keeping track of an item in inventory."""
name: str
unit_price: float
quantity_on_hand: int = 0
def total_cost(self) -> float:
return self.unit_price * self.quantity_on_hand
```
and decorate it with a directory pattern to synchronize instances:
```python
from datafiles import datafile
@datafile("inventory/items/{self.name}.yml")
class InventoryItem:
...
```
Then, work with instances of the class as normal:
```python
>>> item = InventoryItem("widget", 3)
```
```yaml
# inventory/items/widget.yml
unit_price: 3.0
```
Changes to the object are automatically saved to the filesystem:
```python
>>> item.quantity_on_hand += 100
```
```yaml
# inventory/items/widget.yml
unit_price: 3.0
quantity_on_hand: 100
```
Changes to the filesystem are automatically reflected in the object:
```yaml
# inventory/items/widget.yml
unit_price: 2.5 # <= manually changed from "3.0"
quantity_on_hand: 100
```
```python
>>> item.unit_price
2.5
```
Objects can also be restored from the filesystem:
```python
>>> from datafiles import Missing
>>> item = InventoryItem("widget", Missing)
>>> item.unit_price
2.5
>>> item.quantity_on_hand
100
```
## Installation
Install this library directly into an activated virtual environment:
```
$ pip install datafiles
```
or add it to your [Poetry](https://poetry.eustace.io/) project:
```
$ poetry add datafiles
```
## Documentation
To see additional synchronization and formatting options, please consult the [full documentation](https://datafiles.readthedocs.io).
نیازمندی
| مقدار | نام |
|---|---|
| >=0.17.21,<0.18.0 | ruamel.yaml |
| >=0.10.1,<0.11.0 | tomlkit |
| >=1.12,<2.0 | parse |
| >=1.5,<2.0 | cached_property |
| >=0.2,<0.3 | classproperties |
| >=2.1,<3.0 | minilog |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<4.0 | Python |
نحوه نصب
نصب پکیج whl datafiles-2.1b5:
pip install datafiles-2.1b5.whl
نصب پکیج tar.gz datafiles-2.1b5:
pip install datafiles-2.1b5.tar.gz