Skip to content

Commit f34d826

Browse files
committed
Reorganize project structure: move app to src/, add proper entry points
- Move json_to_csv_multifile_pyqt.py to src/gui.py - Add src/main.py and src/__main__.py for `python -m src` support - Move fileshift.spec and scripts to packaging/ - Fix pyproject.toml: remove non-existent types-PyQt6, add hatch wheel config - Update justfile and README.md with new paths
1 parent 3df79b3 commit f34d826

11 files changed

Lines changed: 1311 additions & 14 deletions

File tree

.pytest_cache/v/cache/lastfailed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tests/test_base.py::TestEncodingDetector::test_detect_latin1_encoding": true,
3+
"tests/test_base.py::TestFormatHandlerBase::test_unflatten_record": true
4+
}

.pytest_cache/v/cache/nodeids

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[
2+
"tests/test_base.py::TestConversionOptions::test_custom_options",
3+
"tests/test_base.py::TestConversionOptions::test_default_options",
4+
"tests/test_base.py::TestEncodingDetector::test_detect_latin1_encoding",
5+
"tests/test_base.py::TestEncodingDetector::test_detect_utf8_encoding",
6+
"tests/test_base.py::TestFormatDetector::test_detect_csv_format",
7+
"tests/test_base.py::TestFormatDetector::test_detect_json_array_format",
8+
"tests/test_base.py::TestFormatDetector::test_detect_jsonl_format",
9+
"tests/test_base.py::TestFormatDetector::test_detect_jsonl_with_json_extension",
10+
"tests/test_base.py::TestFormatDetector::test_detect_unknown_format",
11+
"tests/test_base.py::TestFormatHandlerBase::test_extract_fields_flat",
12+
"tests/test_base.py::TestFormatHandlerBase::test_extract_fields_nested",
13+
"tests/test_base.py::TestFormatHandlerBase::test_flatten_record",
14+
"tests/test_base.py::TestFormatHandlerBase::test_parse_value_types",
15+
"tests/test_base.py::TestFormatHandlerBase::test_unflatten_record",
16+
"tests/test_handlers.py::TestCSVHandler::test_can_handle_csv",
17+
"tests/test_handlers.py::TestCSVHandler::test_detect_metadata",
18+
"tests/test_handlers.py::TestCSVHandler::test_read_records",
19+
"tests/test_handlers.py::TestCSVHandler::test_write_records",
20+
"tests/test_handlers.py::TestFormatConversion::test_csv_to_jsonl",
21+
"tests/test_handlers.py::TestFormatConversion::test_json_to_csv",
22+
"tests/test_handlers.py::TestFormatConversion::test_jsonl_to_json",
23+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_file_csv",
24+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_file_json",
25+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_file_jsonl",
26+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_format_csv",
27+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_format_json",
28+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_format_jsonl",
29+
"tests/test_handlers.py::TestHandlerFactory::test_get_handler_for_format_unknown",
30+
"tests/test_handlers.py::TestJSONHandler::test_can_handle_json_array",
31+
"tests/test_handlers.py::TestJSONHandler::test_cannot_handle_jsonl",
32+
"tests/test_handlers.py::TestJSONHandler::test_detect_metadata",
33+
"tests/test_handlers.py::TestJSONHandler::test_read_records",
34+
"tests/test_handlers.py::TestJSONHandler::test_write_records",
35+
"tests/test_handlers.py::TestJSONLHandler::test_can_handle_jsonl",
36+
"tests/test_handlers.py::TestJSONLHandler::test_cannot_handle_json_array",
37+
"tests/test_handlers.py::TestJSONLHandler::test_detect_metadata",
38+
"tests/test_handlers.py::TestJSONLHandler::test_read_records_streaming",
39+
"tests/test_handlers.py::TestJSONLHandler::test_write_records",
40+
"tests/test_operations.py::TestFileMerger::test_get_schema_preview",
41+
"tests/test_operations.py::TestFileMerger::test_merge_different_schemas_intersection",
42+
"tests/test_operations.py::TestFileMerger::test_merge_different_schemas_union",
43+
"tests/test_operations.py::TestFileMerger::test_merge_mixed_formats",
44+
"tests/test_operations.py::TestFileMerger::test_merge_preserves_all_records",
45+
"tests/test_operations.py::TestFileMerger::test_merge_same_schema",
46+
"tests/test_operations.py::TestFileSplitter::test_split_by_num_files",
47+
"tests/test_operations.py::TestFileSplitter::test_split_by_rows",
48+
"tests/test_operations.py::TestFileSplitter::test_split_by_size",
49+
"tests/test_operations.py::TestFileSplitter::test_split_empty_result_for_empty_file",
50+
"tests/test_operations.py::TestFileSplitter::test_split_format_conversion_csv_to_jsonl",
51+
"tests/test_operations.py::TestFileSplitter::test_split_format_conversion_json_to_csv",
52+
"tests/test_operations.py::TestRoundTrip::test_split_and_merge_preserves_data",
53+
"tests/test_operations.py::TestUtilityFunctions::test_count_records_csv",
54+
"tests/test_operations.py::TestUtilityFunctions::test_count_records_json",
55+
"tests/test_operations.py::TestUtilityFunctions::test_count_records_jsonl",
56+
"tests/test_operations.py::TestUtilityFunctions::test_get_file_info"
57+
]

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ source .venv/bin/activate
147147
uv pip install -e ".[dev]"
148148

149149
# Run the application
150-
python json_to_csv_multifile_pyqt.py
150+
python -m src
151151

152152
# Run tests
153153
pytest
@@ -157,14 +157,16 @@ pytest
157157

158158
```
159159
FileShift/
160-
├── json_to_csv_multifile_pyqt.py # Main GUI application
161160
├── src/
161+
│ ├── gui.py # Main GUI application
162+
│ ├── main.py # Entry point
162163
│ └── converters/ # Core conversion library
163164
│ ├── base.py # Base classes and types
164165
│ ├── handlers.py # Format handlers (JSON, JSONL, CSV)
165166
│ └── operations.py # Split and merge operations
166167
├── tests/ # Test suite
167-
├── fileshift.spec # PyInstaller build spec
168+
├── packaging/
169+
│ └── fileshift.spec # PyInstaller build spec
168170
└── pyproject.toml # Project configuration
169171
```
170172

justfile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,19 @@ clean:
5151

5252
# Build standalone app
5353
build:
54-
uv run pyinstaller json_to_csv_multifile_pyqt.py \
55-
--name "FileShift" \
56-
--windowed \
57-
--onefile \
58-
--icon resources/icon.ico \
59-
--add-data "src:src"
54+
uv run pyinstaller --clean packaging/fileshift.spec
6055

6156
# Run the GUI app
6257
run:
63-
uv run python json_to_csv_multifile_pyqt.py
58+
uv run python -m src
6459

6560
# Run the CLI
6661
run-cli *ARGS:
6762
uv run python -m src.cli {{ARGS}}
6863

6964
# Generate sample data
7065
generate-samples:
71-
uv run python scripts/generate_sample_data.py
66+
uv run python packaging/scripts/generate_sample_data.py
7267

7368
# Run pre-commit hooks
7469
pre-commit:
@@ -89,7 +84,7 @@ benchmark:
8984

9085
# Profile the application
9186
profile FILE:
92-
uv run python -m cProfile -o profile.stats json_to_csv_multifile_pyqt.py {{FILE}}
87+
uv run python -m cProfile -o profile.stats -m src {{FILE}}
9388
uv run python -m pstats profile.stats
9489

9590
# Update dependencies

fileshift.spec renamed to packaging/fileshift.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ excluded_modules = [
2020
]
2121

2222
a = Analysis(
23-
['json_to_csv_multifile_pyqt.py'],
23+
['src/main.py'],
2424
pathex=['.'],
2525
datas=[('src', 'src')],
2626
hiddenimports=['src.converters', 'src.converters.base', 'src.converters.handlers', 'src.converters.operations'],

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
requires = ["hatchling"]
33
build-backend = "hatchling.build"
44

5+
[tool.hatch.build.targets.wheel]
6+
packages = ["src"]
7+
58
[project]
69
name = "fileshift"
710
version = "0.2.0"
@@ -24,7 +27,6 @@ dev = [
2427
"pytest-benchmark>=4.0",
2528
"pytest-asyncio>=0.21.0",
2629
"mypy>=1.0",
27-
"types-PyQt6",
2830
"ruff>=0.1.0",
2931
"black>=23.0",
3032
"isort>=5.0",

src/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from src.gui import main
2+
3+
main()

src/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from src.gui import main
2+
3+
if __name__ == "__main__":
4+
main()

0 commit comments

Comments
 (0)