pyslog 0.1.0.dev5__tar.gz
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.
- pyslog-0.1.0.dev5/PKG-INFO +137 -0
- pyslog-0.1.0.dev5/README.md +106 -0
- pyslog-0.1.0.dev5/pyproject.toml +57 -0
- pyslog-0.1.0.dev5/src/pyslog/__init__.py +0 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/__init__.py +0 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/generator.py +495 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/__init__.py +18 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/_xml.py +250 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/enums/__init__.py +11 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/enums/business_process_type.py +20 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/enums/item_identification_scheme.py +6 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/enums/vat_category_code.py +27 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/enums/vat_point_date_code.py +7 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/models/invoice.py +99 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/schemas/eSLOG20_INVOIC_v200.xsd +2086 -0
- pyslog-0.1.0.dev5/src/pyslog/eslog2/validator.py +16 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyslog
|
|
3
|
+
Version: 0.1.0.dev5
|
|
4
|
+
Summary: Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents.
|
|
5
|
+
Keywords: eslog,eracun,e-racun,e-invoice
|
|
6
|
+
Author: Gregor Gabrovšek
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Framework :: Pydantic
|
|
10
|
+
Classifier: Framework :: Pydantic :: 2
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Topic :: Office/Business
|
|
22
|
+
Classifier: Topic :: Text Processing :: Markup :: XML
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Dist: pydantic~=2.12.5
|
|
25
|
+
Requires-Dist: lxml~=6.0.2
|
|
26
|
+
Requires-Dist: pydantic-xml~=2.18.0
|
|
27
|
+
Maintainer: Gregor Gabrovšek
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Project-URL: Repository, https://github.com/gregorgabrovsek/pyslog
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# pyslog - A modern Python library for generating eSLOG invoices
|
|
33
|
+
|
|
34
|
+
[](https://badge.fury.io/py/pyslog)
|
|
35
|
+
[](https://opensource.org/licenses/MIT)
|
|
36
|
+
|
|
37
|
+
> [!CAUTION]
|
|
38
|
+
> This library is in its early stages.
|
|
39
|
+
> The current implementation focuses on **eSLOG 2.0 Invoices**. Other document types and certain niche fields are not yet supported.
|
|
40
|
+
> Please double-check generated XML files against official validators before production use.
|
|
41
|
+
|
|
42
|
+
## Overview
|
|
43
|
+
|
|
44
|
+
`pyslog` is designed to provide a clean, Pythonic interface for generating standard-compliant eSLOG 2.0 documents. By separating the complex, segment-based XML logic from simple Pydantic models, we allow developers to focus on their data rather than the intricacies of the eSLOG specification.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Using uv
|
|
52
|
+
uv add pyslog
|
|
53
|
+
|
|
54
|
+
# Using pip
|
|
55
|
+
pip install pyslog
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Basic Example
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from pyslog.eslog2.models import Invoice, BusinessEntity, Item, BusinessProcessType, VATCategoryCode
|
|
62
|
+
from pyslog.eslog2.generator import generate_eslog_invoice
|
|
63
|
+
|
|
64
|
+
# 1. Define the Buyer and Seller
|
|
65
|
+
buyer = BusinessEntity(
|
|
66
|
+
name="Buyer Corp",
|
|
67
|
+
address_line_1="Industrial Road 1",
|
|
68
|
+
city="Ljubljana",
|
|
69
|
+
post_code="1000",
|
|
70
|
+
country_code="SI",
|
|
71
|
+
vat_registration_number="SI12345678"
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
seller = BusinessEntity(
|
|
75
|
+
name="Seller Ltd",
|
|
76
|
+
address_line_1="Tech Park 5",
|
|
77
|
+
city="Ljubljana",
|
|
78
|
+
post_code="1000",
|
|
79
|
+
country_code="SI",
|
|
80
|
+
iban="SI5600000000000",
|
|
81
|
+
bic="BANKSI2X",
|
|
82
|
+
vat_registration_number="SI87654321",
|
|
83
|
+
maticna="1234567000"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# 2. Define Items
|
|
87
|
+
item = Item(
|
|
88
|
+
standard_identifier="1234567890123",
|
|
89
|
+
standard_identifier_identification_scheme_identifier="0088", # EAN
|
|
90
|
+
sellers_item_identifier="SKU-001",
|
|
91
|
+
name="Consulting Services",
|
|
92
|
+
quantity="10",
|
|
93
|
+
quantity_unit_of_measure="HUR", # Hours
|
|
94
|
+
total_monetary_amount="1000.00",
|
|
95
|
+
item_net_price="100.00",
|
|
96
|
+
vat_rate="22",
|
|
97
|
+
vat_category_code=VATCategoryCode.STANDARD_RATE
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# 3. Create the Invoice
|
|
101
|
+
invoice = Invoice(
|
|
102
|
+
invoice_number="INV-2026-001",
|
|
103
|
+
invoice_issue_date="2026-01-13",
|
|
104
|
+
business_process_type=BusinessProcessType.INVOICING_BASED_ON_CONTRACT,
|
|
105
|
+
buyer=buyer,
|
|
106
|
+
seller=seller,
|
|
107
|
+
items=[item],
|
|
108
|
+
sum_of_invoice_line_net_amount="1000.00",
|
|
109
|
+
invoice_total_amount_without_vat="1000.00",
|
|
110
|
+
invoice_total_amount_with_vat="1220.00",
|
|
111
|
+
amount_due_for_payment="1220.00"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# 4. Generate XML string
|
|
115
|
+
xml_output = generate_eslog_invoice(invoice)
|
|
116
|
+
|
|
117
|
+
with open("invoice.xml", "w") as f:
|
|
118
|
+
f.write(xml_output)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Roadmap
|
|
122
|
+
|
|
123
|
+
- [x] Base eSLOG 2.0 Invoice Model
|
|
124
|
+
- [x] Pydantic integration for type safety
|
|
125
|
+
- [ ] Field-level validation (ISO codes, IBAN, etc.)
|
|
126
|
+
- [ ] eSLOG 2.0 Order & Order Confirmation
|
|
127
|
+
- [ ] eSLOG 2.0 Delivery Note (Dobavnica)
|
|
128
|
+
- [ ] Comprehensive documentation site
|
|
129
|
+
- [ ] Comprehensive tests
|
|
130
|
+
|
|
131
|
+
## Acknowledgements
|
|
132
|
+
|
|
133
|
+
Inspired by the early work of [python-eracun](https://github.com/boris-savic/python-eracun).
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# pyslog - A modern Python library for generating eSLOG invoices
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/pyslog)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
> [!CAUTION]
|
|
7
|
+
> This library is in its early stages.
|
|
8
|
+
> The current implementation focuses on **eSLOG 2.0 Invoices**. Other document types and certain niche fields are not yet supported.
|
|
9
|
+
> Please double-check generated XML files against official validators before production use.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
`pyslog` is designed to provide a clean, Pythonic interface for generating standard-compliant eSLOG 2.0 documents. By separating the complex, segment-based XML logic from simple Pydantic models, we allow developers to focus on their data rather than the intricacies of the eSLOG specification.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Using uv
|
|
21
|
+
uv add pyslog
|
|
22
|
+
|
|
23
|
+
# Using pip
|
|
24
|
+
pip install pyslog
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Basic Example
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from pyslog.eslog2.models import Invoice, BusinessEntity, Item, BusinessProcessType, VATCategoryCode
|
|
31
|
+
from pyslog.eslog2.generator import generate_eslog_invoice
|
|
32
|
+
|
|
33
|
+
# 1. Define the Buyer and Seller
|
|
34
|
+
buyer = BusinessEntity(
|
|
35
|
+
name="Buyer Corp",
|
|
36
|
+
address_line_1="Industrial Road 1",
|
|
37
|
+
city="Ljubljana",
|
|
38
|
+
post_code="1000",
|
|
39
|
+
country_code="SI",
|
|
40
|
+
vat_registration_number="SI12345678"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
seller = BusinessEntity(
|
|
44
|
+
name="Seller Ltd",
|
|
45
|
+
address_line_1="Tech Park 5",
|
|
46
|
+
city="Ljubljana",
|
|
47
|
+
post_code="1000",
|
|
48
|
+
country_code="SI",
|
|
49
|
+
iban="SI5600000000000",
|
|
50
|
+
bic="BANKSI2X",
|
|
51
|
+
vat_registration_number="SI87654321",
|
|
52
|
+
maticna="1234567000"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# 2. Define Items
|
|
56
|
+
item = Item(
|
|
57
|
+
standard_identifier="1234567890123",
|
|
58
|
+
standard_identifier_identification_scheme_identifier="0088", # EAN
|
|
59
|
+
sellers_item_identifier="SKU-001",
|
|
60
|
+
name="Consulting Services",
|
|
61
|
+
quantity="10",
|
|
62
|
+
quantity_unit_of_measure="HUR", # Hours
|
|
63
|
+
total_monetary_amount="1000.00",
|
|
64
|
+
item_net_price="100.00",
|
|
65
|
+
vat_rate="22",
|
|
66
|
+
vat_category_code=VATCategoryCode.STANDARD_RATE
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# 3. Create the Invoice
|
|
70
|
+
invoice = Invoice(
|
|
71
|
+
invoice_number="INV-2026-001",
|
|
72
|
+
invoice_issue_date="2026-01-13",
|
|
73
|
+
business_process_type=BusinessProcessType.INVOICING_BASED_ON_CONTRACT,
|
|
74
|
+
buyer=buyer,
|
|
75
|
+
seller=seller,
|
|
76
|
+
items=[item],
|
|
77
|
+
sum_of_invoice_line_net_amount="1000.00",
|
|
78
|
+
invoice_total_amount_without_vat="1000.00",
|
|
79
|
+
invoice_total_amount_with_vat="1220.00",
|
|
80
|
+
amount_due_for_payment="1220.00"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
# 4. Generate XML string
|
|
84
|
+
xml_output = generate_eslog_invoice(invoice)
|
|
85
|
+
|
|
86
|
+
with open("invoice.xml", "w") as f:
|
|
87
|
+
f.write(xml_output)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Roadmap
|
|
91
|
+
|
|
92
|
+
- [x] Base eSLOG 2.0 Invoice Model
|
|
93
|
+
- [x] Pydantic integration for type safety
|
|
94
|
+
- [ ] Field-level validation (ISO codes, IBAN, etc.)
|
|
95
|
+
- [ ] eSLOG 2.0 Order & Order Confirmation
|
|
96
|
+
- [ ] eSLOG 2.0 Delivery Note (Dobavnica)
|
|
97
|
+
- [ ] Comprehensive documentation site
|
|
98
|
+
- [ ] Comprehensive tests
|
|
99
|
+
|
|
100
|
+
## Acknowledgements
|
|
101
|
+
|
|
102
|
+
Inspired by the early work of [python-eracun](https://github.com/boris-savic/python-eracun).
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pyslog"
|
|
3
|
+
version = "0.1.0.dev5"
|
|
4
|
+
description = "Python e-SLOG library. Simplifies the generation of Slovenian e-SLOG electronic documents."
|
|
5
|
+
license = "MIT"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Gregor Gabrovšek" }
|
|
8
|
+
]
|
|
9
|
+
maintainers = [
|
|
10
|
+
{ name = "Gregor Gabrovšek" }
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"pydantic~=2.12.5",
|
|
16
|
+
"lxml~=6.0.2",
|
|
17
|
+
"pydantic-xml~=2.18.0",
|
|
18
|
+
]
|
|
19
|
+
keywords = [
|
|
20
|
+
"eslog", "eracun", "e-racun", "e-invoice"
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 3 - Alpha",
|
|
24
|
+
"Framework :: Pydantic",
|
|
25
|
+
"Framework :: Pydantic :: 2",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
31
|
+
"Programming Language :: Python :: 3.10",
|
|
32
|
+
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
34
|
+
"Programming Language :: Python :: 3.13",
|
|
35
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
36
|
+
"Topic :: Office/Business",
|
|
37
|
+
"Topic :: Text Processing :: Markup :: XML",
|
|
38
|
+
"Typing :: Typed",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Repository = "https://github.com/gregorgabrovsek/pyslog"
|
|
43
|
+
#Documentation = "https://github.com/gregorgabrovsek/pyslog/blob/main/README.md"
|
|
44
|
+
#Changelog = "https://github.com/gregorgabrovsek/pyslog/blob/main/CHANGELOG.md"
|
|
45
|
+
#Issues = "https://github.com/gregorgabrovsek/pyslog/issues"
|
|
46
|
+
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["uv_build"]
|
|
49
|
+
build-backend = "uv_build"
|
|
50
|
+
|
|
51
|
+
[tool.uv.build-backend]
|
|
52
|
+
data = ["src/pyslog/eslog2/schemas/eSLOG20_INVOIC_v200.xsd"]
|
|
53
|
+
|
|
54
|
+
[dependency-groups]
|
|
55
|
+
dev = [
|
|
56
|
+
"pytest>=9.0.2",
|
|
57
|
+
]
|
|
File without changes
|
|
File without changes
|