splurge-dsv 2025.1.4__tar.gz → 2025.2.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.
Files changed (31) hide show
  1. splurge_dsv-2025.2.0/PKG-INFO +217 -0
  2. splurge_dsv-2025.2.0/README.md +184 -0
  3. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/pyproject.toml +22 -2
  4. splurge_dsv-2025.2.0/splurge_dsv/__init__.py +96 -0
  5. splurge_dsv-2025.2.0/splurge_dsv/__main__.py +19 -0
  6. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv/cli.py +56 -46
  7. splurge_dsv-2025.2.0/splurge_dsv/dsv.py +256 -0
  8. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv/dsv_helper.py +63 -52
  9. splurge_dsv-2025.2.0/splurge_dsv/exceptions.py +153 -0
  10. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv/path_validator.py +49 -36
  11. splurge_dsv-2025.2.0/splurge_dsv/safe_text_file_reader.py +177 -0
  12. splurge_dsv-2025.2.0/splurge_dsv/safe_text_file_writer.py +136 -0
  13. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv/string_tokenizer.py +34 -26
  14. splurge_dsv-2025.2.0/splurge_dsv/text_file_helper.py +240 -0
  15. splurge_dsv-2025.2.0/splurge_dsv.egg-info/PKG-INFO +217 -0
  16. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv.egg-info/SOURCES.txt +4 -1
  17. splurge_dsv-2025.2.0/splurge_dsv.egg-info/entry_points.txt +2 -0
  18. splurge_dsv-2025.2.0/splurge_dsv.egg-info/requires.txt +9 -0
  19. splurge_dsv-2025.1.4/PKG-INFO +0 -263
  20. splurge_dsv-2025.1.4/README.md +0 -234
  21. splurge_dsv-2025.1.4/splurge_dsv/__init__.py +0 -84
  22. splurge_dsv-2025.1.4/splurge_dsv/__main__.py +0 -15
  23. splurge_dsv-2025.1.4/splurge_dsv/exceptions.py +0 -136
  24. splurge_dsv-2025.1.4/splurge_dsv/resource_manager.py +0 -371
  25. splurge_dsv-2025.1.4/splurge_dsv/text_file_helper.py +0 -321
  26. splurge_dsv-2025.1.4/splurge_dsv.egg-info/PKG-INFO +0 -263
  27. splurge_dsv-2025.1.4/splurge_dsv.egg-info/requires.txt +0 -5
  28. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/LICENSE +0 -0
  29. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/setup.cfg +0 -0
  30. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv.egg-info/dependency_links.txt +0 -0
  31. {splurge_dsv-2025.1.4 → splurge_dsv-2025.2.0}/splurge_dsv.egg-info/top_level.txt +0 -0
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: splurge-dsv
3
+ Version: 2025.2.0
4
+ Summary: A utility library for working with DSV (Delimited String Values) files
5
+ Author: Jim Schilling
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/jim-schilling/splurge-dsv
8
+ Project-URL: Repository, https://github.com/jim-schilling/splurge-dsv
9
+ Project-URL: Documentation, https://github.com/jim-schilling/splurge-dsv#readme
10
+ Project-URL: Bug Tracker, https://github.com/jim-schilling/splurge-dsv/issues
11
+ Keywords: dsv,csv,tsv,delimited,parsing,file-processing
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Text Processing :: Filters
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
26
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
27
+ Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
28
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
29
+ Requires-Dist: ruff>=0.0.241; extra == "dev"
30
+ Requires-Dist: pytest-mock>=3.0.0; extra == "dev"
31
+ Requires-Dist: hypothesis>=6.0.0; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # splurge-dsv
35
+
36
+ [![PyPI version](https://badge.fury.io/py/splurge-dsv.svg)](https://pypi.org/project/splurge-dsv/)
37
+ [![Python versions](https://img.shields.io/pypi/pyversions/splurge-dsv.svg)](https://pypi.org/project/splurge-dsv/)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
39
+
40
+ [![CI](https://github.com/jim-schilling/splurge-dsv/actions/workflows/ci-quick-test.yml/badge.svg)](https://github.com/jim-schilling/splurge-dsv/actions/workflows/ci-quick-test.yml)
41
+ [![Coverage](https://img.shields.io/badge/coverage-94%25-brightgreen.svg)](https://github.com/jim-schilling/splurge-dsv)
42
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
43
+ [![mypy](https://img.shields.io/badge/mypy-checked-black)](https://mypy-lang.org/)
44
+
45
+ A robust Python library for parsing and processing delimited-separated value (DSV) files with advanced features for data validation, streaming, and error handling.
46
+
47
+ ## Features
48
+
49
+ - **Multi-format DSV Support**: Parse CSV, TSV, pipe-delimited, and custom delimiter files
50
+ - **Memory-Efficient Streaming**: Process large files without loading entire content into memory
51
+ - **Security & Validation**: Comprehensive path validation and file permission checks
52
+ - **Unicode Support**: Full Unicode character and encoding support
53
+ - **Type Safety**: Full type annotations with mypy validation
54
+ - **Comprehensive Testing**: 420 tests (409 passed, 11 skipped) with 94% code coverage including property-based testing, edge case testing, and cross-platform compatibility
55
+
56
+ **⚠️ BREAKING CHANGES in v2025.2.0**
57
+ >
58
+ > - **Exception Names Changed**: All exceptions now use `SplurgeDsv*` prefix (e.g., `SplurgeParameterError` → `SplurgeDsvParameterError`)
59
+ > - **Resource Manager Removed**: The `ResourceManager` module and all related classes have been completely removed
60
+ >
61
+ > See the [CHANGELOG](CHANGELOG.md) for migration guidance.
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install splurge-dsv
67
+ ```
68
+
69
+ ## Quick Start
70
+
71
+ ### CLI Usage
72
+
73
+ ```bash
74
+ # Parse a CSV file
75
+ python -m splurge_dsv data.csv --delimiter ,
76
+
77
+ # Stream a large file
78
+ python -m splurge_dsv large_file.csv --delimiter , --stream --chunk-size 1000
79
+ ```
80
+
81
+ ### API Usage
82
+
83
+ ```python
84
+ from splurge_dsv import DsvHelper
85
+
86
+ # Parse a CSV string
87
+ data = DsvHelper.parse("a,b,c", delimiter=",")
88
+ print(data) # ['a', 'b', 'c']
89
+
90
+ # Parse a CSV file
91
+ rows = DsvHelper.parse_file("data.csv", delimiter=",")
92
+ ```
93
+
94
+ ### Modern API
95
+
96
+ ```python
97
+ from splurge_dsv import Dsv, DsvConfig
98
+
99
+ # Create configuration and parser
100
+ config = DsvConfig.csv(skip_header=1)
101
+ dsv = Dsv(config)
102
+
103
+ # Parse files
104
+ rows = dsv.parse_file("data.csv")
105
+ ```
106
+
107
+ ## Documentation
108
+
109
+ - **[Detailed Documentation](docs/README-details.md)**: Complete API reference, CLI options, and examples
110
+ - **[Testing Best Practices](docs/testing_best_practices.md)**: Comprehensive testing guidelines and patterns
111
+ - **[Hypothesis Usage Patterns](docs/hypothesis_usage_patterns.md)**: Property-based testing guide
112
+ - **[Changelog](CHANGELOG.md)**: Release notes and migration guides
113
+
114
+ ## License
115
+
116
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
117
+ ----------------------------
118
+
119
+ This library enforces deterministic newline handling for text files. The reader
120
+ normalizes CRLF (`\r\n`), CR (`\r`) and LF (`\n`) to LF internally and
121
+ returns logical lines. The writer utilities normalize any input newlines to LF
122
+ before writing. This avoids platform-dependent differences when reading files
123
+ produced by diverse sources.
124
+
125
+ Recommended usage:
126
+
127
+ - When creating files inside the project, prefer the `open_text_writer` context
128
+ manager or `SafeTextFileWriter` which will normalize to LF.
129
+ - When reading unknown files, the `open_text` / `SafeTextFileReader` will
130
+ provide deterministic normalization regardless of the source.
131
+ - `SplurgeResourceAcquisitionError` - Resource acquisition failures
132
+ - `SplurgeResourceReleaseError` - Resource cleanup failures
133
+
134
+ ## Development
135
+
136
+ ### Testing Suite
137
+
138
+ splurge-dsv features a comprehensive testing suite designed for robustness and reliability:
139
+
140
+ #### Test Categories
141
+ - **Unit Tests**: Core functionality testing (300+ tests)
142
+ - **Integration Tests**: End-to-end workflow validation (50+ tests)
143
+ - **Property-Based Tests**: Hypothesis-driven testing for edge cases (50+ tests)
144
+ - **Edge Case Tests**: Malformed input, encoding issues, filesystem anomalies
145
+ - **Cross-Platform Tests**: Path handling, line endings, encoding consistency
146
+
147
+ #### Running Tests
148
+
149
+ ```bash
150
+ # Run all tests
151
+ pytest tests/ -v
152
+
153
+ # Run with coverage report
154
+ pytest tests/ --cov=splurge_dsv --cov-report=html
155
+
156
+ # Run specific test categories
157
+ pytest tests/unit/ -v # Unit tests only
158
+ pytest tests/integration/ -v # Integration tests only
159
+ pytest tests/property/ -v # Property-based tests only
160
+ pytest tests/platform/ -v # Cross-platform tests only
161
+
162
+ # Run with parallel execution
163
+ pytest tests/ -n 4 --cov=splurge_dsv
164
+
165
+ # Run performance benchmarks
166
+ pytest tests/ --durations=10
167
+ ```
168
+
169
+ #### Test Quality Standards
170
+ - **94%+ Code Coverage**: All public APIs and critical paths covered
171
+ - **Property-Based Testing**: Hypothesis framework validates complex scenarios
172
+ - **Cross-Platform Compatibility**: Tests run on Windows, Linux, and macOS
173
+ - **Performance Regression Detection**: Automated benchmarks prevent slowdowns
174
+ - **Zero False Positives**: All property tests pass without spurious failures
175
+
176
+ #### Testing Best Practices
177
+ - Tests use `pytest-mock` for modern mocking patterns
178
+ - Property tests use Hypothesis strategies for comprehensive input generation
179
+ - Edge case tests validate error handling and boundary conditions
180
+ - Cross-platform tests ensure consistent behavior across operating systems
181
+
182
+ ### Code Quality
183
+
184
+ The project follows strict coding standards:
185
+ - PEP 8 compliance
186
+ - Type annotations for all functions
187
+ - Google-style docstrings
188
+ - 85%+ coverage gate enforced via CI
189
+ - Comprehensive error handling
190
+
191
+ ## Changelog
192
+
193
+ See the [CHANGELOG](CHANGELOG.md) for full release notes.
194
+
195
+ ## License
196
+
197
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
198
+
199
+ ## More Documentation
200
+
201
+ - Detailed docs: [docs/README-details.md](docs/README-details.md)
202
+ - E2E testing coverage: [docs/e2e_testing_coverage.md](docs/e2e_testing_coverage.md)
203
+
204
+ ## Contributing
205
+
206
+ Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for detailed information on:
207
+
208
+ - Development setup and workflow
209
+ - Coding standards and best practices
210
+ - Testing requirements and guidelines
211
+ - Pull request process and review criteria
212
+
213
+ For major changes, please open an issue first to discuss what you would like to change.
214
+
215
+ ## Support
216
+
217
+ For support, please open an issue on the GitHub repository or contact the maintainers.
@@ -0,0 +1,184 @@
1
+ # splurge-dsv
2
+
3
+ [![PyPI version](https://badge.fury.io/py/splurge-dsv.svg)](https://pypi.org/project/splurge-dsv/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/splurge-dsv.svg)](https://pypi.org/project/splurge-dsv/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ [![CI](https://github.com/jim-schilling/splurge-dsv/actions/workflows/ci-quick-test.yml/badge.svg)](https://github.com/jim-schilling/splurge-dsv/actions/workflows/ci-quick-test.yml)
8
+ [![Coverage](https://img.shields.io/badge/coverage-94%25-brightgreen.svg)](https://github.com/jim-schilling/splurge-dsv)
9
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
10
+ [![mypy](https://img.shields.io/badge/mypy-checked-black)](https://mypy-lang.org/)
11
+
12
+ A robust Python library for parsing and processing delimited-separated value (DSV) files with advanced features for data validation, streaming, and error handling.
13
+
14
+ ## Features
15
+
16
+ - **Multi-format DSV Support**: Parse CSV, TSV, pipe-delimited, and custom delimiter files
17
+ - **Memory-Efficient Streaming**: Process large files without loading entire content into memory
18
+ - **Security & Validation**: Comprehensive path validation and file permission checks
19
+ - **Unicode Support**: Full Unicode character and encoding support
20
+ - **Type Safety**: Full type annotations with mypy validation
21
+ - **Comprehensive Testing**: 420 tests (409 passed, 11 skipped) with 94% code coverage including property-based testing, edge case testing, and cross-platform compatibility
22
+
23
+ **⚠️ BREAKING CHANGES in v2025.2.0**
24
+ >
25
+ > - **Exception Names Changed**: All exceptions now use `SplurgeDsv*` prefix (e.g., `SplurgeParameterError` → `SplurgeDsvParameterError`)
26
+ > - **Resource Manager Removed**: The `ResourceManager` module and all related classes have been completely removed
27
+ >
28
+ > See the [CHANGELOG](CHANGELOG.md) for migration guidance.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install splurge-dsv
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ### CLI Usage
39
+
40
+ ```bash
41
+ # Parse a CSV file
42
+ python -m splurge_dsv data.csv --delimiter ,
43
+
44
+ # Stream a large file
45
+ python -m splurge_dsv large_file.csv --delimiter , --stream --chunk-size 1000
46
+ ```
47
+
48
+ ### API Usage
49
+
50
+ ```python
51
+ from splurge_dsv import DsvHelper
52
+
53
+ # Parse a CSV string
54
+ data = DsvHelper.parse("a,b,c", delimiter=",")
55
+ print(data) # ['a', 'b', 'c']
56
+
57
+ # Parse a CSV file
58
+ rows = DsvHelper.parse_file("data.csv", delimiter=",")
59
+ ```
60
+
61
+ ### Modern API
62
+
63
+ ```python
64
+ from splurge_dsv import Dsv, DsvConfig
65
+
66
+ # Create configuration and parser
67
+ config = DsvConfig.csv(skip_header=1)
68
+ dsv = Dsv(config)
69
+
70
+ # Parse files
71
+ rows = dsv.parse_file("data.csv")
72
+ ```
73
+
74
+ ## Documentation
75
+
76
+ - **[Detailed Documentation](docs/README-details.md)**: Complete API reference, CLI options, and examples
77
+ - **[Testing Best Practices](docs/testing_best_practices.md)**: Comprehensive testing guidelines and patterns
78
+ - **[Hypothesis Usage Patterns](docs/hypothesis_usage_patterns.md)**: Property-based testing guide
79
+ - **[Changelog](CHANGELOG.md)**: Release notes and migration guides
80
+
81
+ ## License
82
+
83
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
84
+ ----------------------------
85
+
86
+ This library enforces deterministic newline handling for text files. The reader
87
+ normalizes CRLF (`\r\n`), CR (`\r`) and LF (`\n`) to LF internally and
88
+ returns logical lines. The writer utilities normalize any input newlines to LF
89
+ before writing. This avoids platform-dependent differences when reading files
90
+ produced by diverse sources.
91
+
92
+ Recommended usage:
93
+
94
+ - When creating files inside the project, prefer the `open_text_writer` context
95
+ manager or `SafeTextFileWriter` which will normalize to LF.
96
+ - When reading unknown files, the `open_text` / `SafeTextFileReader` will
97
+ provide deterministic normalization regardless of the source.
98
+ - `SplurgeResourceAcquisitionError` - Resource acquisition failures
99
+ - `SplurgeResourceReleaseError` - Resource cleanup failures
100
+
101
+ ## Development
102
+
103
+ ### Testing Suite
104
+
105
+ splurge-dsv features a comprehensive testing suite designed for robustness and reliability:
106
+
107
+ #### Test Categories
108
+ - **Unit Tests**: Core functionality testing (300+ tests)
109
+ - **Integration Tests**: End-to-end workflow validation (50+ tests)
110
+ - **Property-Based Tests**: Hypothesis-driven testing for edge cases (50+ tests)
111
+ - **Edge Case Tests**: Malformed input, encoding issues, filesystem anomalies
112
+ - **Cross-Platform Tests**: Path handling, line endings, encoding consistency
113
+
114
+ #### Running Tests
115
+
116
+ ```bash
117
+ # Run all tests
118
+ pytest tests/ -v
119
+
120
+ # Run with coverage report
121
+ pytest tests/ --cov=splurge_dsv --cov-report=html
122
+
123
+ # Run specific test categories
124
+ pytest tests/unit/ -v # Unit tests only
125
+ pytest tests/integration/ -v # Integration tests only
126
+ pytest tests/property/ -v # Property-based tests only
127
+ pytest tests/platform/ -v # Cross-platform tests only
128
+
129
+ # Run with parallel execution
130
+ pytest tests/ -n 4 --cov=splurge_dsv
131
+
132
+ # Run performance benchmarks
133
+ pytest tests/ --durations=10
134
+ ```
135
+
136
+ #### Test Quality Standards
137
+ - **94%+ Code Coverage**: All public APIs and critical paths covered
138
+ - **Property-Based Testing**: Hypothesis framework validates complex scenarios
139
+ - **Cross-Platform Compatibility**: Tests run on Windows, Linux, and macOS
140
+ - **Performance Regression Detection**: Automated benchmarks prevent slowdowns
141
+ - **Zero False Positives**: All property tests pass without spurious failures
142
+
143
+ #### Testing Best Practices
144
+ - Tests use `pytest-mock` for modern mocking patterns
145
+ - Property tests use Hypothesis strategies for comprehensive input generation
146
+ - Edge case tests validate error handling and boundary conditions
147
+ - Cross-platform tests ensure consistent behavior across operating systems
148
+
149
+ ### Code Quality
150
+
151
+ The project follows strict coding standards:
152
+ - PEP 8 compliance
153
+ - Type annotations for all functions
154
+ - Google-style docstrings
155
+ - 85%+ coverage gate enforced via CI
156
+ - Comprehensive error handling
157
+
158
+ ## Changelog
159
+
160
+ See the [CHANGELOG](CHANGELOG.md) for full release notes.
161
+
162
+ ## License
163
+
164
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
165
+
166
+ ## More Documentation
167
+
168
+ - Detailed docs: [docs/README-details.md](docs/README-details.md)
169
+ - E2E testing coverage: [docs/e2e_testing_coverage.md](docs/e2e_testing_coverage.md)
170
+
171
+ ## Contributing
172
+
173
+ Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for detailed information on:
174
+
175
+ - Development setup and workflow
176
+ - Coding standards and best practices
177
+ - Testing requirements and guidelines
178
+ - Pull request process and review criteria
179
+
180
+ For major changes, please open an issue first to discuss what you would like to change.
181
+
182
+ ## Support
183
+
184
+ For support, please open an issue on the GitHub repository or contact the maintainers.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "splurge-dsv"
7
- version = "2025.1.4"
7
+ version = "2025.2.0"
8
8
  description = "A utility library for working with DSV (Delimited String Values) files"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -32,6 +32,10 @@ dev = [
32
32
  "pytest>=7.0.0",
33
33
  "pytest-cov>=4.0.0",
34
34
  "pytest-xdist>=3.0.0",
35
+ "mypy>=1.0.0",
36
+ "ruff>=0.0.241",
37
+ "pytest-mock>=3.0.0",
38
+ "hypothesis>=6.0.0",
35
39
  ]
36
40
 
37
41
  [project.urls]
@@ -40,13 +44,16 @@ Repository = "https://github.com/jim-schilling/splurge-dsv"
40
44
  Documentation = "https://github.com/jim-schilling/splurge-dsv#readme"
41
45
  "Bug Tracker" = "https://github.com/jim-schilling/splurge-dsv/issues"
42
46
 
47
+ [project.scripts]
48
+ splurge-dsv = "splurge_dsv.cli:run_cli"
49
+
43
50
  [tool.setuptools.packages.find]
44
51
  where = ["."]
45
52
  include = ["splurge_dsv*"]
46
53
 
47
54
  [tool.pytest.ini_options]
48
55
  minversion = "7.0"
49
- addopts = "-x -v --cov=splurge_dsv --cov-report=term-missing --cov-report=html --cov-fail-under=85"
56
+ addopts = "-x -v -n 4"
50
57
  testpaths = ["tests"]
51
58
  python_files = ["test_*.py"]
52
59
  python_classes = ["Test*"]
@@ -56,6 +63,13 @@ filterwarnings = [
56
63
  "ignore::PendingDeprecationWarning",
57
64
  ]
58
65
 
66
+ [tool.hypothesis]
67
+ # Hypothesis configuration for property-based testing
68
+ max_examples = 100
69
+ deadline = 5000 # 5 seconds per test
70
+ suppress_health_check = ["too_slow"]
71
+ verbosity = "normal"
72
+
59
73
  [tool.coverage.run]
60
74
  source = ["splurge_dsv"]
61
75
  omit = [
@@ -108,3 +122,9 @@ quote-style = "double"
108
122
  indent-style = "space"
109
123
  skip-magic-trailing-comma = false
110
124
  line-ending = "auto"
125
+
126
+ [tool.mypy]
127
+ # Only run mypy against the splurge_dsv package
128
+ files = ["splurge_dsv"]
129
+ # show_error_codes helps with diagnostics
130
+ show_error_codes = true
@@ -0,0 +1,96 @@
1
+ """Top-level package for Splurge DSV.
2
+
3
+ This package provides utilities for parsing, processing and manipulating
4
+ delimited string value (DSV) files. It exposes the high-level API objects
5
+ such as :class:`~splurge_dsv.dsv.Dsv` and :class:`~splurge_dsv.dsv.DsvConfig`,
6
+ convenience helpers, and the package's exception types.
7
+
8
+ License: MIT
9
+ Copyright (c) 2025 Jim Schilling
10
+ """
11
+
12
+ # Ensure current working directory exists. Some test environments or earlier
13
+ # test cases may remove the process working directory which causes calls to
14
+ # os.getcwd() to raise FileNotFoundError later during test execution. Guard
15
+ # against that here by switching to this package directory when cwd is missing.
16
+ import os
17
+ from pathlib import Path as _Path
18
+
19
+ try:
20
+ try:
21
+ # os.getcwd() can raise FileNotFoundError in CI/runner environments
22
+ # if the original working directory was removed. Check existence via
23
+ # Path.cwd(); if it doesn't exist, switch to the package directory.
24
+ if not _Path.cwd().exists():
25
+ os.chdir(_Path(__file__).resolve().parent)
26
+ except FileNotFoundError:
27
+ # Fall back to package directory when cwd is gone
28
+ os.chdir(_Path(__file__).resolve().parent)
29
+ except Exception:
30
+ # Be conservative: if this fails, don't break import - tests will report
31
+ # the original failure. Swallowing ensures import-time is resilient.
32
+ pass
33
+
34
+ # Local imports
35
+ from splurge_dsv.dsv import Dsv, DsvConfig
36
+ from splurge_dsv.dsv_helper import DsvHelper
37
+ from splurge_dsv.exceptions import (
38
+ SplurgeDsvConfigurationError,
39
+ SplurgeDsvDataProcessingError,
40
+ # canonical SplurgeDsv* exception names
41
+ SplurgeDsvError,
42
+ SplurgeDsvFileEncodingError,
43
+ SplurgeDsvFileNotFoundError,
44
+ SplurgeDsvFileOperationError,
45
+ SplurgeDsvFilePermissionError,
46
+ SplurgeDsvFormatError,
47
+ SplurgeDsvParameterError,
48
+ SplurgeDsvParsingError,
49
+ SplurgeDsvPathValidationError,
50
+ SplurgeDsvPerformanceWarning,
51
+ SplurgeDsvRangeError,
52
+ SplurgeDsvResourceAcquisitionError,
53
+ SplurgeDsvResourceError,
54
+ SplurgeDsvResourceReleaseError,
55
+ SplurgeDsvStreamingError,
56
+ SplurgeDsvTypeConversionError,
57
+ SplurgeDsvValidationError,
58
+ )
59
+ from splurge_dsv.path_validator import PathValidator
60
+ from splurge_dsv.string_tokenizer import StringTokenizer
61
+ from splurge_dsv.text_file_helper import TextFileHelper
62
+
63
+ __version__ = "2025.2.0"
64
+ __author__ = "Jim Schilling"
65
+ __license__ = "MIT"
66
+
67
+ __all__ = [
68
+ # Main classes
69
+ "Dsv",
70
+ "DsvConfig",
71
+ "DsvHelper",
72
+ # Exceptions
73
+ "SplurgeDsvError",
74
+ "SplurgeDsvValidationError",
75
+ "SplurgeDsvFileOperationError",
76
+ "SplurgeDsvFileNotFoundError",
77
+ "SplurgeDsvFilePermissionError",
78
+ "SplurgeDsvFileEncodingError",
79
+ "SplurgeDsvPathValidationError",
80
+ "SplurgeDsvDataProcessingError",
81
+ "SplurgeDsvParsingError",
82
+ "SplurgeDsvTypeConversionError",
83
+ "SplurgeDsvStreamingError",
84
+ "SplurgeDsvConfigurationError",
85
+ "SplurgeDsvResourceError",
86
+ "SplurgeDsvResourceAcquisitionError",
87
+ "SplurgeDsvResourceReleaseError",
88
+ "SplurgeDsvPerformanceWarning",
89
+ "SplurgeDsvParameterError",
90
+ "SplurgeDsvRangeError",
91
+ "SplurgeDsvFormatError",
92
+ # Utility classes
93
+ "StringTokenizer",
94
+ "TextFileHelper",
95
+ "PathValidator",
96
+ ]
@@ -0,0 +1,19 @@
1
+ """Module entrypoint for running splurge-dsv as a script.
2
+
3
+ When executed (``python -m splurge_dsv``), this module delegates to
4
+ ``splurge_dsv.cli.run_cli`` and returns the resulting exit code.
5
+
6
+ License: MIT
7
+ Copyright (c) 2025 Jim Schilling
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ # Standard library
13
+ import sys
14
+
15
+ # Local
16
+ from splurge_dsv.cli import run_cli
17
+
18
+ if __name__ == "__main__":
19
+ sys.exit(run_cli())