pydantic-fixedwidth 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pydantic-fixedwidth might be problematic. Click here for more details.

@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: pydantic-fixedwidth
3
+ Version: 0.1.2
4
+ Summary: Custom Pydantic models for parsing and serializing fixed-width format of data.
5
+ Project-URL: Homepage, https://github.com/lasuillard/pydantic-fixedwidth
6
+ Project-URL: Repository, https://github.com/lasuillard/pydantic-fixedwidth.git
7
+ Project-URL: Issues, https://github.com/lasuillard/pydantic-fixedwidth/issues
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: <4.0,>=3.9
11
+ Requires-Dist: pydantic<3,>=2
12
+ Provides-Extra: dev
13
+ Requires-Dist: mypy~=1.11; extra == 'dev'
14
+ Requires-Dist: ruff~=0.6; extra == 'dev'
15
+ Provides-Extra: test
16
+ Requires-Dist: coverage~=7.3; extra == 'test'
17
+ Requires-Dist: pytest-cov<7,>=5; extra == 'test'
18
+ Requires-Dist: pytest-sugar~=1.0; extra == 'test'
19
+ Requires-Dist: pytest~=8.0; extra == 'test'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # pydantic-fixedwidth
23
+
24
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
25
+ [![CI](https://github.com/lasuillard/pydantic-fixedwidth/actions/workflows/ci.yaml/badge.svg)](https://github.com/lasuillard/pydantic-fixedwidth/actions/workflows/ci.yaml)
26
+ [![codecov](https://codecov.io/gh/lasuillard/pydantic-fixedwidth/graph/badge.svg?token=R5pQWB43DP)](https://codecov.io/gh/lasuillard/pydantic-fixedwidth)
27
+ ![PyPI - Version](https://img.shields.io/pypi/v/pydantic-fixedwidth)
28
+
29
+ Custom Pydantic models for serializing and deserializing fixed-width format data.
30
+
31
+
32
+ ## 🚀 Quick Start
33
+
34
+ Install this package with pip:
35
+
36
+ ```shell
37
+ $ pip install pydantic-fixedwidth
38
+ ```
39
+
40
+ Usage example:
41
+
42
+ ```python
43
+ from datetime import datetime, timezone
44
+
45
+ from pydantic_fixedwidth import Fixedwidth, Padding
46
+ from pydantic_fixedwidth import OrderedField as Field
47
+
48
+ tzinfo = timezone.utc
49
+
50
+
51
+ class SomeRequest(Fixedwidth):
52
+ string: str = Field(length=8)
53
+ hangul: str = Field(length=6)
54
+ number: int = Field(length=10, justify="right", fill_char=b"0")
55
+
56
+ # Just an padding field
57
+ p_: str = Padding(length=10)
58
+
59
+ # This field will be ignored in ser/de
60
+ ignore: str = Field(length=10, default="IGNORE", exclude=True)
61
+
62
+ ts: datetime = Field(
63
+ length=20,
64
+ to_str=lambda dt: dt.strftime("%Y%m%d%H%M%S%f"),
65
+ from_str=lambda s: datetime.strptime(s, "%Y%m%d%H%M%S%f").replace(tzinfo=tzinfo),
66
+ )
67
+
68
+
69
+ some_request = SomeRequest(
70
+ string="<DFG&",
71
+ hangul="한글",
72
+ number=381,
73
+ ts=datetime(2024, 1, 23, 14, 11, 20, 124277, tzinfo=tzinfo),
74
+ )
75
+ b = some_request.format_bytes()
76
+
77
+ assert len(b) == 54
78
+ assert b == b"<DFG& \xed\x95\x9c\xea\xb8\x800000000381 20240123141120124277"
79
+ ```
@@ -1,7 +1,7 @@
1
1
  pydantic_fixedwidth/__init__.py,sha256=vVLHRSOlPVHzVbG3RGpUqNcBUPrnbbDSC03BwrMVMWA,131
2
2
  pydantic_fixedwidth/fixedwidth.py,sha256=bYTPpWvGlwQM2l6LdOlADQvvCWNmXniLHnTutDjcKao,5379
3
3
  pydantic_fixedwidth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- pydantic_fixedwidth-0.1.1.dist-info/METADATA,sha256=RAIh5glXxFRdkNfBftYCRu_SgCNxHUM98_9yEl-gAjM,1236
5
- pydantic_fixedwidth-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- pydantic_fixedwidth-0.1.1.dist-info/licenses/LICENSE,sha256=Q5GkvYijQ2KTQ-QWhv43ilzCno4ZrzrEuATEQZd9rYo,1067
7
- pydantic_fixedwidth-0.1.1.dist-info/RECORD,,
4
+ pydantic_fixedwidth-0.1.2.dist-info/METADATA,sha256=2RTSRyII7tl_OEeMBfX_I9OSHG2CYCVgE2H_8kHKolE,2587
5
+ pydantic_fixedwidth-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ pydantic_fixedwidth-0.1.2.dist-info/licenses/LICENSE,sha256=Q5GkvYijQ2KTQ-QWhv43ilzCno4ZrzrEuATEQZd9rYo,1067
7
+ pydantic_fixedwidth-0.1.2.dist-info/RECORD,,
@@ -1,26 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pydantic-fixedwidth
3
- Version: 0.1.1
4
- Summary: Custom Pydantic models for parsing and serializing fixed-width format of data.
5
- License-Expression: MIT
6
- License-File: LICENSE
7
- Requires-Python: <4.0,>=3.9
8
- Requires-Dist: pydantic<3,>=2
9
- Provides-Extra: dev
10
- Requires-Dist: mypy~=1.11; extra == 'dev'
11
- Requires-Dist: ruff~=0.6; extra == 'dev'
12
- Provides-Extra: test
13
- Requires-Dist: coverage~=7.3; extra == 'test'
14
- Requires-Dist: pytest-cov<7,>=5; extra == 'test'
15
- Requires-Dist: pytest-sugar~=1.0; extra == 'test'
16
- Requires-Dist: pytest~=8.0; extra == 'test'
17
- Description-Content-Type: text/markdown
18
-
19
- # pydantic-fixedwidth
20
-
21
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
22
- [![CI](https://github.com/lasuillard/pydantic-fixedwidth/actions/workflows/ci.yaml/badge.svg)](https://github.com/lasuillard/pydantic-fixedwidth/actions/workflows/ci.yaml)
23
- [![codecov](https://codecov.io/gh/lasuillard/pydantic-fixedwidth/graph/badge.svg?token=R5pQWB43DP)](https://codecov.io/gh/lasuillard/pydantic-fixedwidth)
24
- ![GitHub Release](https://img.shields.io/github/v/release/lasuillard/pydantic-fixedwidth)
25
-
26
- Custom Pydantic models for parsing and serializing fixed-width format of data.