Skip to content

Commit f74ed59

Browse files
authored
Merge pull request #1 from kiesraad/module_cleanup
General structure cleanup for release
2 parents 4301b91 + 409e476 commit f74ed59

23 files changed

+61
-5
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2023 Kiesraad
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ Data bindings for the EML_NL Standard to load EML_NL files into Python [dataclas
33

44
## Requirements
55
- At least Python version 3.10 for the [KW_ONLY](https://docs.python.org/3/library/dataclasses.html#dataclasses.KW_ONLY) type annotations for dataclasses. This is so that non-nullable fields can be marked as mandatory (see [here](https://xsdata.readthedocs.io/en/latest/faq/why-non-nullable-fields-are-marked-as-optional.html)).
6-
- [xsData](https://github.com/tefra/xsdata) for parsing using these databindings (`pip install xsdata`)
6+
- [xsData](https://github.com/tefra/xsdata) for parsing using these databindings.
77

88
## Testing
99
The bindings are tested on over 2500 different EML files from different type of Dutch elections, all downloaded from [data.overheid.nl](https://data.overheid.nl/community/organization/kiesraad) using a roundtrip serialization test.
1010

11-
See the [test report](test/pyeml_bindings_testreport.html)
11+
See the [test report](pyeml_bindings_testreport.html)
1212

1313
## Usage
1414
Make sure that xsData is installed. Using example file [`Telling_PS2023_Flevoland_gemeente_Almere.eml.xml`](https://data.overheid.nl/dataset/verkiezingsuitslag-provinciale-staten-2023#panel-resources) which has EML id 510b:
@@ -46,5 +46,11 @@ with open(Path("output.xml"), "w") as out_file:
4646

4747
```
4848

49+
## Building
50+
To build the package yourself instead of installing the `.whl`, simply clone the repository and then in the root folder run.
51+
```
52+
python -m build
53+
```
54+
4955
## Codegen
5056
These bindings are mostly generated using [xsData](https://xsdata.readthedocs.io) with some minor changes where needed. See commit history for these changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

pyproject.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "pyeml_bindings"
7+
description = "Data bindings for the EML_NL Standard"
8+
version = "1.0.0"
9+
authors = [{name = "Chris Mostert", email = "chris.mostert@kiesraad.nl"}]
10+
readme = "README.md"
11+
requires-python = ">=3.10"
12+
dependencies = [
13+
"xsdata == 23.*"
14+
]
15+
license = {file = "LICENSE"}
16+
classifiers = [
17+
"Programming Language :: Python :: 3",
18+
"License :: OSI Approved :: MIT License",
19+
"Operating System :: OS Independent",
20+
]
21+
22+
[project.optional-dependencies]
23+
tests = [
24+
"pytest",
25+
"formencode"
26+
]
27+
28+
[project.urls]
29+
Home = "https://github.com/kiesraad/pyeml_bindings"
File renamed without changes.

test/test_roundtrip.py renamed to tests/test_roundtrip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from xsdata.formats.dataclass.parsers import XmlParser
33
from xsdata.formats.dataclass.parsers.config import ParserConfig
44
from xsdata.formats.dataclass.serializers import XmlSerializer
5-
from .. import Eml110a, Eml230, Eml510, Eml520
6-
from ..namespace import NAMESPACE
5+
from pyeml_bindings import Eml110a, Eml230, Eml510, Eml520
6+
from pyeml_bindings.namespace import NAMESPACE
77
import xml.etree.ElementTree as ET
88
from formencode.doctest_xml_compare import xml_compare
99
from sys import stdout
@@ -28,7 +28,7 @@ def parsing_roundtrip_same(parser, serializer, reporter, path_to_eml, type) -> b
2828
parser = XmlParser(ParserConfig(fail_on_unknown_properties=False))
2929
serializer = XmlSerializer()
3030
reporter = lambda x: stdout.write(x + "\n")
31-
files = glob.glob(f"pyeml_bindings/test/data/**/*.eml.xml", recursive=True)
31+
files = glob.glob(f"data/**/*.eml.xml", recursive=True)
3232

3333
test_cases = zip(
3434
itertools.repeat(parser),

0 commit comments

Comments
 (0)