Skip to content

Commit 3c5eda2

Browse files
committed
feat: Added Literal type, all errors are TOMLError types and updated README
1 parent b221fe4 commit 3c5eda2

13 files changed

Lines changed: 777 additions & 206 deletions

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@
1010
![Downloads](https://static.pepy.tech/badge/tomlval)
1111
![Monthly Downloads](https://static.pepy.tech/badge/tomlval/month)
1212

13-
A dependency-free and easy to use validator made for the TOML markup language.
13+
A flexible, easy-to-use, and dependency-free Python library for validating TOML data against custom schemas.
14+
15+
## Features
16+
17+
- **Full TOML support**: Validates TOML data against custom schemas, ensuring compliance with the [TOML specification](https://toml.io/en/).
18+
- **Dependency-free**: No external dependencies, making it lightweight and easy to integrate.
19+
- **Flexible**: Supports custom schemas with optional fields and type validation.
20+
- **Easy to use**: Simple API for defining schemas and validating data.
21+
- **Type hints**: Utilizes Python's type hints for schema definitions, making code more readable and maintainable.
1422

1523
## Installation
1624

@@ -20,7 +28,39 @@ You can install the package from [PyPI](https://pypi.org/project/tomlval/):
2028
pip install tomlval
2129
```
2230

23-
The package is available for Python 3.11 and newer.
31+
The package is available for Python 3.10 and newer.
32+
33+
## Usage
34+
35+
### Basic Example
36+
37+
```python
38+
import re
39+
from datetime import datetime
40+
from tomlval import TOMLSchema, Optional, Invalid, Literal
41+
42+
schema = TOMLSchema({
43+
"*": Invalid # Catch-all
44+
})
45+
```
46+
47+
## Testing
48+
49+
Test dependencies are installed with the `dev` extra:
50+
51+
```bash
52+
pip install tomlval[dev]
53+
```
54+
55+
Run the tests with:
56+
57+
```bash
58+
pytest
59+
```
60+
61+
## Contributing
62+
63+
Contributions are welcome. If you have suggestions for improvements or find bugs, please open an issue or submit a pull request.
2464

2565
## License
2666

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "tomlval"
3-
version = "1.2.0"
4-
description = "A simple and easy to use TOML validator for Python."
3+
version = "2.0.0"
4+
description = "A flexible, easy-to-use, and dependency-free Python library for validating TOML data against custom schemas."
55
authors = [
66
{ name = "Marcus Fredriksson", email = "marcus@marcusfredriksson.com" },
77
]
@@ -50,6 +50,7 @@ disable = [
5050
"broad-exception-caught",
5151
"too-many-return-statements",
5252
"too-many-branches",
53+
"too-many-public-methods",
5354
]
5455

5556
[tool.pylint.format]

0 commit comments

Comments
 (0)