eadpy 0.1.0__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.
- eadpy-0.1.0/.gitignore +15 -0
- eadpy-0.1.0/.python-version +1 -0
- eadpy-0.1.0/PKG-INFO +86 -0
- eadpy-0.1.0/README.md +77 -0
- eadpy-0.1.0/pyproject.toml +25 -0
- eadpy-0.1.0/pytest.ini +4 -0
- eadpy-0.1.0/src/eadpy/__init__.py +8 -0
- eadpy-0.1.0/src/eadpy/cli.py +46 -0
- eadpy-0.1.0/src/eadpy/ead.py +637 -0
- eadpy-0.1.0/src/eadpy/py.typed +0 -0
- eadpy-0.1.0/tests/sample.xml +223 -0
- eadpy-0.1.0/tests/test_ead.py +253 -0
- eadpy-0.1.0/tests/test_ead_counts.py +49 -0
- eadpy-0.1.0/uv.lock +242 -0
eadpy-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
eadpy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eadpy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: Brendan Quinn <brendan-quinn@northwestern.edu>
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: lxml>=5.3.1
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# EADPy
|
|
11
|
+
|
|
12
|
+
[](https://pypi.org/project/eadpy/)
|
|
13
|
+
[](https://opensource.org/licenses/MIT)
|
|
14
|
+
|
|
15
|
+
A Python library for working with Encoded Archival Description (EAD) XML documents.
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Parse and manipulate EAD XML documents
|
|
20
|
+
- Convert EAD to various formats (JSON, CSV, etc.)
|
|
21
|
+
- Validate EAD documents against schemas
|
|
22
|
+
- Tools for batch processing of EAD files
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Install EADPy using pip:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install eadpy
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from eadpy import Ead
|
|
36
|
+
|
|
37
|
+
# Load an EAD file and process it
|
|
38
|
+
ead = Ead("path/to/finding_aid.xml")
|
|
39
|
+
ead.create_and_save_chunks("path/to/output.json")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Development
|
|
43
|
+
|
|
44
|
+
### Setting up the development environment
|
|
45
|
+
|
|
46
|
+
EADPy uses [uv](https://github.com/astral-sh/uv) for dependency management and virtual environment setup.
|
|
47
|
+
|
|
48
|
+
1. Clone the repository:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/yourusername/eadpy.git
|
|
52
|
+
cd eadpy
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. Create and activate a virtual environment:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
uv venv --python 3.13
|
|
59
|
+
source .venv/bin/activate # On Unix/macOS
|
|
60
|
+
# or
|
|
61
|
+
.venv\Scripts\activate # On Windows
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. Install development dependencies:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv pip install -e ".[dev]"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Running tests
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pytest
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
For full documentation, visit [eadpy.readthedocs.io](https://eadpy.readthedocs.io).
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
eadpy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# EADPy
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/eadpy/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A Python library for working with Encoded Archival Description (EAD) XML documents.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Parse and manipulate EAD XML documents
|
|
11
|
+
- Convert EAD to various formats (JSON, CSV, etc.)
|
|
12
|
+
- Validate EAD documents against schemas
|
|
13
|
+
- Tools for batch processing of EAD files
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install EADPy using pip:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install eadpy
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from eadpy import Ead
|
|
27
|
+
|
|
28
|
+
# Load an EAD file and process it
|
|
29
|
+
ead = Ead("path/to/finding_aid.xml")
|
|
30
|
+
ead.create_and_save_chunks("path/to/output.json")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
### Setting up the development environment
|
|
36
|
+
|
|
37
|
+
EADPy uses [uv](https://github.com/astral-sh/uv) for dependency management and virtual environment setup.
|
|
38
|
+
|
|
39
|
+
1. Clone the repository:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/yourusername/eadpy.git
|
|
43
|
+
cd eadpy
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. Create and activate a virtual environment:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv venv --python 3.13
|
|
50
|
+
source .venv/bin/activate # On Unix/macOS
|
|
51
|
+
# or
|
|
52
|
+
.venv\Scripts\activate # On Windows
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Install development dependencies:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
uv pip install -e ".[dev]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Running tests
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pytest
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
For full documentation, visit [eadpy.readthedocs.io](https://eadpy.readthedocs.io).
|
|
70
|
+
|
|
71
|
+
## Contributing
|
|
72
|
+
|
|
73
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "eadpy"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Brendan Quinn", email = "brendan-quinn@northwestern.edu" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"lxml>=5.3.1",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["hatchling"]
|
|
16
|
+
build-backend = "hatchling.build"
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"pytest>=8.3.5",
|
|
21
|
+
"pytest-cov>=6.0.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
eadpy = "eadpy.cli:main"
|
eadpy-0.1.0/pytest.ini
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command-line interface for the EADPy library.
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
from eadpy import Ead
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
"""Main entry point for the EADPy command-line interface."""
|
|
10
|
+
if len(sys.argv) < 2:
|
|
11
|
+
print("Usage: eadpy path_to_ead.xml [output_file.json]")
|
|
12
|
+
sys.exit(1)
|
|
13
|
+
|
|
14
|
+
ead_file = sys.argv[1]
|
|
15
|
+
print(f"Loading EAD file: {ead_file}")
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
if not os.path.exists(ead_file):
|
|
19
|
+
print(f"Error: File '{ead_file}' does not exist.")
|
|
20
|
+
print(f"Current working directory: {os.getcwd()}")
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
ead = Ead(ead_file)
|
|
24
|
+
print(f"Successfully parsed EAD file: {ead_file}")
|
|
25
|
+
|
|
26
|
+
output_file = None
|
|
27
|
+
if len(sys.argv) == 3:
|
|
28
|
+
output_file = sys.argv[2]
|
|
29
|
+
print(f"Output file: {output_file}")
|
|
30
|
+
else:
|
|
31
|
+
print("No output file specified. Using default: ead.json")
|
|
32
|
+
output_file = "ead.json"
|
|
33
|
+
|
|
34
|
+
ead.create_and_save_chunks(output_file)
|
|
35
|
+
print(f"Successfully wrote output to: {output_file}")
|
|
36
|
+
|
|
37
|
+
except FileNotFoundError as e:
|
|
38
|
+
print(f"Error: {str(e)}")
|
|
39
|
+
print(f"Current working directory: {os.getcwd()}")
|
|
40
|
+
sys.exit(1)
|
|
41
|
+
except Exception as e:
|
|
42
|
+
print(f"Error: {str(e)}")
|
|
43
|
+
sys.exit(1)
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|