@mseep/csv-editor 1.0.0

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 (106) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +53 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +38 -0
  3. package/.github/workflows/deploy-docs.yml +62 -0
  4. package/.github/workflows/publish-github.yml +52 -0
  5. package/.github/workflows/publish.yml +44 -0
  6. package/.github/workflows/test.yml +32 -0
  7. package/.pre-commit-config.yaml +157 -0
  8. package/ALTERNATIVE_PUBLISHING.md +175 -0
  9. package/ARCHITECTURE.md +1011 -0
  10. package/CHANGELOG.md +99 -0
  11. package/CODE_OF_CONDUCT.md +41 -0
  12. package/CONTRIBUTING.md +427 -0
  13. package/Dockerfile +22 -0
  14. package/LICENSE +21 -0
  15. package/MCP_CONFIG.md +505 -0
  16. package/PUBLISHING.md +210 -0
  17. package/README.md +400 -0
  18. package/SECURITY.md +61 -0
  19. package/docs/README.md +41 -0
  20. package/docs/blog/2019-05-28-first-blog-post.md +12 -0
  21. package/docs/blog/2019-05-29-long-blog-post.md +44 -0
  22. package/docs/blog/2021-08-01-mdx-blog-post.mdx +24 -0
  23. package/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
  24. package/docs/blog/2021-08-26-welcome/index.md +29 -0
  25. package/docs/blog/authors.yml +25 -0
  26. package/docs/blog/tags.yml +19 -0
  27. package/docs/docs/api/overview.md +183 -0
  28. package/docs/docs/installation.md +252 -0
  29. package/docs/docs/intro.md +87 -0
  30. package/docs/docs/tutorial-basics/_category_.json +8 -0
  31. package/docs/docs/tutorial-basics/congratulations.md +23 -0
  32. package/docs/docs/tutorial-basics/create-a-blog-post.md +34 -0
  33. package/docs/docs/tutorial-basics/create-a-document.md +57 -0
  34. package/docs/docs/tutorial-basics/create-a-page.md +43 -0
  35. package/docs/docs/tutorial-basics/deploy-your-site.md +31 -0
  36. package/docs/docs/tutorial-basics/markdown-features.mdx +152 -0
  37. package/docs/docs/tutorial-extras/_category_.json +7 -0
  38. package/docs/docs/tutorial-extras/img/docsVersionDropdown.png +0 -0
  39. package/docs/docs/tutorial-extras/img/localeDropdown.png +0 -0
  40. package/docs/docs/tutorial-extras/manage-docs-versions.md +55 -0
  41. package/docs/docs/tutorial-extras/translate-your-site.md +88 -0
  42. package/docs/docs/tutorials/quickstart.md +365 -0
  43. package/docs/docusaurus.config.ts +163 -0
  44. package/docs/package-lock.json +17493 -0
  45. package/docs/package.json +48 -0
  46. package/docs/sidebars.ts +33 -0
  47. package/docs/src/components/HomepageFeatures/index.tsx +71 -0
  48. package/docs/src/components/HomepageFeatures/styles.module.css +11 -0
  49. package/docs/src/css/custom.css +30 -0
  50. package/docs/src/pages/index.module.css +23 -0
  51. package/docs/src/pages/index.tsx +44 -0
  52. package/docs/src/pages/markdown-page.md +7 -0
  53. package/docs/static/.nojekyll +0 -0
  54. package/docs/static/img/docusaurus-social-card.jpg +0 -0
  55. package/docs/static/img/docusaurus.png +0 -0
  56. package/docs/static/img/favicon.ico +0 -0
  57. package/docs/static/img/logo.svg +1 -0
  58. package/docs/static/img/undraw_docusaurus_mountain.svg +171 -0
  59. package/docs/static/img/undraw_docusaurus_react.svg +170 -0
  60. package/docs/static/img/undraw_docusaurus_tree.svg +40 -0
  61. package/docs/tsconfig.json +8 -0
  62. package/examples/README.md +48 -0
  63. package/examples/auto_save_demo.py +206 -0
  64. package/examples/auto_save_overwrite.py +201 -0
  65. package/examples/basic_usage.py +135 -0
  66. package/examples/demo.py +139 -0
  67. package/examples/history_demo.py +317 -0
  68. package/examples/test_default_autosave.py +124 -0
  69. package/examples/update_consignee_example.py +179 -0
  70. package/package.json +51 -0
  71. package/plans/2026-04-19-fastmcp3-migration-plan.md +1045 -0
  72. package/pyproject.toml +331 -0
  73. package/requirements-dev.txt +30 -0
  74. package/requirements.txt +22 -0
  75. package/scripts/publish.py +67 -0
  76. package/smithery.yaml +15 -0
  77. package/specs/2026-04-19-fastmcp3-migration-design.md +243 -0
  78. package/src/csv_editor/__init__.py +8 -0
  79. package/src/csv_editor/models/__init__.py +39 -0
  80. package/src/csv_editor/models/auto_save.py +246 -0
  81. package/src/csv_editor/models/csv_session.py +468 -0
  82. package/src/csv_editor/models/data_models.py +244 -0
  83. package/src/csv_editor/models/history_manager.py +456 -0
  84. package/src/csv_editor/prompts/__init__.py +0 -0
  85. package/src/csv_editor/prompts/data_prompts.py +13 -0
  86. package/src/csv_editor/resources/__init__.py +0 -0
  87. package/src/csv_editor/resources/csv_resources.py +22 -0
  88. package/src/csv_editor/server.py +640 -0
  89. package/src/csv_editor/tools/__init__.py +5 -0
  90. package/src/csv_editor/tools/analytics.py +700 -0
  91. package/src/csv_editor/tools/auto_save_operations.py +235 -0
  92. package/src/csv_editor/tools/data_operations.py +3 -0
  93. package/src/csv_editor/tools/history_operations.py +315 -0
  94. package/src/csv_editor/tools/io_operations.py +431 -0
  95. package/src/csv_editor/tools/transformations.py +663 -0
  96. package/src/csv_editor/tools/validation.py +822 -0
  97. package/src/csv_editor/utils/__init__.py +0 -0
  98. package/src/csv_editor/utils/validators.py +205 -0
  99. package/tests/README.md +65 -0
  100. package/tests/__init__.py +7 -0
  101. package/tests/conftest.py +50 -0
  102. package/tests/test_auto_save.py +378 -0
  103. package/tests/test_basic.py +103 -0
  104. package/tests/test_integration.py +356 -0
  105. package/tests/test_server_boot.py +50 -0
  106. package/tests/test_settings.py +184 -0
package/pyproject.toml ADDED
@@ -0,0 +1,331 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "csv-editor"
7
+ version = "2.0.0"
8
+ description = "MCP server for comprehensive CSV file operations with pandas-based tools"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Santosh Ray", email = "rayskumar02@gmail.com"},
14
+ ]
15
+ maintainers = [
16
+ {name = "Santosh Ray", email = "rayskumar02@gmail.com"},
17
+ ]
18
+ keywords = [
19
+ "csv",
20
+ "mcp",
21
+ "model-context-protocol",
22
+ "data-analysis",
23
+ "data-manipulation",
24
+ "pandas",
25
+ "fastmcp",
26
+ "data-validation",
27
+ "data-quality",
28
+ "data-profiling",
29
+ "outlier-detection",
30
+ ]
31
+ classifiers = [
32
+ "Development Status :: 4 - Beta",
33
+ "Intended Audience :: Developers",
34
+ "Intended Audience :: Science/Research",
35
+ "Intended Audience :: Financial and Insurance Industry",
36
+ "License :: OSI Approved :: MIT License",
37
+ "Operating System :: OS Independent",
38
+ "Programming Language :: Python",
39
+ "Programming Language :: Python :: 3",
40
+ "Programming Language :: Python :: 3.11",
41
+ "Programming Language :: Python :: 3.12",
42
+ "Programming Language :: Python :: 3.13",
43
+ "Programming Language :: Python :: 3.14",
44
+ "Topic :: Scientific/Engineering :: Information Analysis",
45
+ "Topic :: Software Development :: Libraries :: Python Modules",
46
+ "Topic :: Office/Business :: Financial :: Spreadsheet",
47
+ "Topic :: Utilities",
48
+ "Typing :: Typed",
49
+ "Framework :: AsyncIO",
50
+ ]
51
+
52
+ dependencies = [
53
+ "fastmcp>=3.2,<4",
54
+ "pandas>=2.2.3",
55
+ "numpy>=2.1.3",
56
+ "pydantic>=2.13",
57
+ "aiofiles>=25",
58
+ "python-dateutil>=2.9.0",
59
+ "httpx>=0.28",
60
+ "openpyxl>=3.1.5",
61
+ "pyarrow>=23",
62
+ "tabulate>=0.10",
63
+ "pytz>=2024.2",
64
+ "pydantic-settings>=2.13",
65
+ ]
66
+
67
+ [project.optional-dependencies]
68
+ performance = [
69
+ "numexpr>=2.10.0",
70
+ "bottleneck>=1.4.0",
71
+ "fastparquet>=2024.11.0", # Alternative Parquet engine
72
+ ]
73
+ dev = [
74
+ "pytest>=8.3.0",
75
+ "pytest-asyncio>=0.24.0",
76
+ "pytest-cov>=5.0.0",
77
+ "pytest-mock>=3.14.0",
78
+ "pytest-benchmark>=5.0.0",
79
+ "black>=24.10.0",
80
+ "ruff>=0.7.0",
81
+ "mypy>=1.13.0",
82
+ "pre-commit>=4.0.0",
83
+ "pandas-stubs>=2.2.3",
84
+ "types-aiofiles>=24.1.0",
85
+ "types-tabulate>=0.9.0",
86
+ "types-pytz>=2024.2",
87
+ "ipython>=8.29.0",
88
+ "rich>=13.9.0",
89
+ ]
90
+ docs = [
91
+ "mkdocs>=1.6.0",
92
+ "mkdocs-material>=9.5.0",
93
+ "mkdocstrings[python]>=0.26.0",
94
+ "mkdocs-mermaid2-plugin>=1.1.0",
95
+ ]
96
+ test = [
97
+ "pytest>=8.3.0",
98
+ "pytest-asyncio>=0.24.0",
99
+ "pytest-cov>=5.0.0",
100
+ "pytest-mock>=3.14.0",
101
+ "pytest-benchmark>=5.0.0",
102
+ "hypothesis>=6.122.0", # Property-based testing
103
+ "faker>=30.0.0", # Generate test data
104
+ ]
105
+ all = [
106
+ "csv-editor[performance,dev,docs,test]",
107
+ ]
108
+
109
+ [project.urls]
110
+ Homepage = "https://github.com/santoshray02/csv-editor"
111
+ Documentation = "https://github.com/santoshray02/csv-editor#readme"
112
+ Repository = "https://github.com/santoshray02/csv-editor"
113
+ Issues = "https://github.com/santoshray02/csv-editor/issues"
114
+ Changelog = "https://github.com/santoshray02/csv-editor/blob/main/CHANGELOG.md"
115
+ "Release Notes" = "https://github.com/santoshray02/csv-editor/releases"
116
+
117
+ [project.scripts]
118
+ csv-editor = "csv_editor.server:main"
119
+ csv = "csv_editor.server:main" # Shorter alias
120
+
121
+ # Note: We use uv for environment and dependency management
122
+ # Hatchling is used only as the build backend for packaging
123
+
124
+ [tool.hatch.build.targets.sdist]
125
+ include = [
126
+ "/src",
127
+ "/tests",
128
+ "/examples",
129
+ "README.md",
130
+ "LICENSE",
131
+ "CHANGELOG.md",
132
+ "pyproject.toml",
133
+ "uv.toml",
134
+ ]
135
+ exclude = [
136
+ "*.pyc",
137
+ "__pycache__",
138
+ ".git",
139
+ ".github",
140
+ ".venv",
141
+ ".env",
142
+ ".DS_Store",
143
+ "*.egg-info",
144
+ ".pytest_cache",
145
+ ".mypy_cache",
146
+ ".ruff_cache",
147
+ "htmlcov",
148
+ ".coverage",
149
+ ]
150
+
151
+ [tool.hatch.build.targets.wheel]
152
+ packages = ["src/csv_editor"]
153
+
154
+ # Use uv instead of hatch environments
155
+ # Run commands with:
156
+ # uv run test
157
+ # uv run server
158
+ # uv run fmt
159
+ # See uv.toml for command definitions
160
+
161
+ # Modern tool configurations
162
+
163
+ [tool.black]
164
+ line-length = 100
165
+ target-version = ["py311", "py312", "py313"]
166
+ include = '\.pyi?$'
167
+ extend-exclude = '''
168
+ /(
169
+ \.git
170
+ | \.venv
171
+ | build
172
+ | dist
173
+ | \.eggs
174
+ | \.hatch
175
+ )/
176
+ '''
177
+
178
+ [tool.ruff]
179
+ line-length = 100
180
+ target-version = "py311"
181
+ fix = true
182
+ output-format = "grouped"
183
+ show-fixes = true
184
+
185
+ [tool.ruff.lint]
186
+ select = [
187
+ "E", # pycodestyle errors
188
+ "W", # pycodestyle warnings
189
+ "F", # pyflakes
190
+ "I", # isort
191
+ "N", # pep8-naming
192
+ "B", # flake8-bugbear
193
+ "C4", # flake8-comprehensions
194
+ "UP", # pyupgrade
195
+ "ARG", # flake8-unused-arguments
196
+ "SIM", # flake8-simplify
197
+ "PTH", # flake8-use-pathlib
198
+ "RUF", # Ruff-specific rules
199
+ "ASYNC",# flake8-async
200
+ "TCH", # flake8-type-checking
201
+ "DTZ", # flake8-datetimez
202
+ "FA", # flake8-future-annotations
203
+ ]
204
+ ignore = [
205
+ "E501", # line too long (handled by black)
206
+ "B008", # do not perform function calls in argument defaults
207
+ "B905", # `zip()` without an explicit `strict=` parameter
208
+ "SIM105", # contextlib.suppress is slower
209
+ ]
210
+
211
+ [tool.ruff.lint.per-file-ignores]
212
+ "tests/*" = ["ARG", "S101", "DTZ"] # Allow unused arguments, assert, and naive datetime in tests
213
+ "examples/*" = ["T201", "T203"] # Allow print() in examples
214
+
215
+ [tool.ruff.lint.isort]
216
+ known-first-party = ["src", "csv_editor"]
217
+ section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
218
+
219
+ [tool.ruff.format]
220
+ quote-style = "double"
221
+ indent-style = "space"
222
+ skip-magic-trailing-comma = false
223
+
224
+ [tool.mypy]
225
+ python_version = "3.11"
226
+ namespace_packages = true
227
+ explicit_package_bases = true
228
+ warn_return_any = true
229
+ warn_unused_configs = true
230
+ disallow_untyped_defs = true
231
+ disallow_any_unimported = false
232
+ no_implicit_optional = true
233
+ check_untyped_defs = true
234
+ warn_redundant_casts = true
235
+ warn_unused_ignores = true
236
+ warn_no_return = true
237
+ show_error_codes = true
238
+ strict_equality = true
239
+ pretty = true
240
+ show_column_numbers = true
241
+ show_error_context = true
242
+
243
+ [[tool.mypy.overrides]]
244
+ module = [
245
+ "fastmcp",
246
+ "tabulate",
247
+ "openpyxl",
248
+ "pyarrow",
249
+ "numexpr",
250
+ "bottleneck",
251
+ "fastparquet",
252
+ ]
253
+ ignore_missing_imports = true
254
+
255
+ [tool.pytest.ini_options]
256
+ minversion = "8.0"
257
+ testpaths = ["tests"]
258
+ asyncio_mode = "auto"
259
+ asyncio_default_fixture_loop_scope = "function"
260
+ addopts = [
261
+ "--strict-markers",
262
+ "--tb=short",
263
+ "--verbose",
264
+ "--color=yes",
265
+ "-ra",
266
+ ]
267
+ markers = [
268
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
269
+ "integration: marks tests as integration tests",
270
+ "unit: marks tests as unit tests",
271
+ "benchmark: marks tests as benchmark tests",
272
+ ]
273
+ filterwarnings = [
274
+ "ignore::DeprecationWarning",
275
+ "ignore::PendingDeprecationWarning",
276
+ ]
277
+
278
+ [tool.coverage.run]
279
+ source = ["src"]
280
+ branch = true
281
+ parallel = true
282
+ omit = [
283
+ "*/tests/*",
284
+ "*/__pycache__/*",
285
+ "*/site-packages/*",
286
+ "src/csv_editor/__main__.py",
287
+ ]
288
+
289
+ [tool.coverage.report]
290
+ exclude_lines = [
291
+ "pragma: no cover",
292
+ "def __repr__",
293
+ "def __str__",
294
+ "raise AssertionError",
295
+ "raise NotImplementedError",
296
+ "if __name__ == .__main__.:",
297
+ "if TYPE_CHECKING:",
298
+ "pass",
299
+ "@abstractmethod",
300
+ "@abc.abstractmethod",
301
+ ]
302
+ precision = 2
303
+ show_missing = true
304
+ skip_covered = false
305
+ skip_empty = true
306
+ sort = "Cover"
307
+ fail_under = 80
308
+
309
+ [tool.coverage.html]
310
+ directory = "htmlcov"
311
+ title = "CSV Editor Coverage Report"
312
+
313
+ [tool.coverage.json]
314
+ output = "coverage.json"
315
+ pretty_print = true
316
+
317
+ # Documentation
318
+ [tool.mkdocs]
319
+ site_name = "CSV Editor"
320
+ site_description = "Comprehensive CSV manipulation and analysis via Model Context Protocol"
321
+ site_author = "Santosh Ray"
322
+ repo_url = "https://github.com/santoshray02/csv-editor"
323
+ repo_name = "csv-editor"
324
+
325
+ [dependency-groups]
326
+ dev = [
327
+ "twine>=6.1.0",
328
+ ]
329
+
330
+ # Pre-commit hooks configuration (for reference)
331
+ # Create .pre-commit-config.yaml separately
@@ -0,0 +1,30 @@
1
+ # Development and testing dependencies
2
+ -r requirements.txt
3
+
4
+ # Testing framework
5
+ pytest>=8.3.0
6
+ pytest-asyncio>=0.24.0
7
+ pytest-cov>=5.0.0
8
+ pytest-mock>=3.14.0
9
+
10
+ # Code quality
11
+ black>=24.10.0
12
+ ruff>=0.7.0
13
+ mypy>=1.13.0
14
+ pre-commit>=4.0.0
15
+
16
+ # Type stubs
17
+ pandas-stubs>=2.2.3
18
+ types-aiofiles>=24.1.0
19
+ types-tabulate>=0.9.0
20
+ types-pytz>=2024.2
21
+
22
+ # Documentation
23
+ mkdocs>=1.6.0
24
+ mkdocs-material>=9.5.0
25
+ mkdocstrings[python]>=0.26.0
26
+
27
+ # Development tools
28
+ ipython>=8.29.0
29
+ jupyter>=1.1.0
30
+ rich>=13.9.0 # Better console output
@@ -0,0 +1,22 @@
1
+ # Core dependencies - Latest stable versions (Dec 2024)
2
+ fastmcp>=2.11.3
3
+ pandas>=2.2.3
4
+ numpy>=2.1.3
5
+ pydantic>=2.10.4
6
+ aiofiles>=24.1.0
7
+ python-dateutil>=2.9.0
8
+
9
+ # HTTP client for URL loading
10
+ httpx>=0.27.0
11
+
12
+ # Data format support
13
+ openpyxl>=3.1.5 # Excel (.xlsx) support
14
+ pyarrow>=17.0.0 # Parquet format support
15
+ tabulate>=0.9.0 # Markdown/HTML table generation
16
+
17
+ # Optional performance enhancements
18
+ numexpr>=2.10.0 # Fast numerical expression evaluation
19
+ bottleneck>=1.4.0 # Fast NumPy array functions
20
+
21
+ # Timezone support
22
+ pytz>=2024.2
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Publishing script for CSV Editor package.
4
+ Handles building, testing, and publishing to PyPI.
5
+ """
6
+
7
+ import subprocess
8
+ import sys
9
+ import os
10
+ from pathlib import Path
11
+
12
+ def run_command(cmd, check=True):
13
+ """Run a command and return the result."""
14
+ print(f"Running: {cmd}")
15
+ result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
16
+ if check and result.returncode != 0:
17
+ print(f"Error running command: {cmd}")
18
+ print(f"stdout: {result.stdout}")
19
+ print(f"stderr: {result.stderr}")
20
+ sys.exit(1)
21
+ return result
22
+
23
+ def main():
24
+ """Main publishing workflow."""
25
+ # Ensure we're in the project root
26
+ project_root = Path(__file__).parent.parent
27
+ os.chdir(project_root)
28
+
29
+ print("๐Ÿš€ Starting CSV Editor publishing process...")
30
+
31
+ # 1. Clean previous builds
32
+ print("\n๐Ÿ“ฆ Cleaning previous builds...")
33
+ run_command("rm -rf dist/ build/ *.egg-info/")
34
+
35
+ # 2. Run tests
36
+ print("\n๐Ÿงช Running tests...")
37
+ run_command("uv run pytest tests/ -v")
38
+
39
+ # 3. Run linting
40
+ print("\n๐Ÿ” Running linting...")
41
+ run_command("uv run ruff check src/")
42
+ run_command("uv run black --check src/")
43
+
44
+ # 4. Type checking
45
+ print("\n๐Ÿ“ Running type checking...")
46
+ run_command("uv run mypy src/")
47
+
48
+ # 5. Build package
49
+ print("\n๐Ÿ”จ Building package...")
50
+ run_command("uv build")
51
+
52
+ # 6. Check package
53
+ print("\nโœ… Checking package...")
54
+ run_command("uv run twine check dist/*")
55
+
56
+ # 7. Test installation
57
+ print("\n๐Ÿ“ฅ Testing package installation...")
58
+ run_command("uv pip install dist/*.whl --force-reinstall")
59
+
60
+ print("\nโœจ Package built successfully!")
61
+ print("\nNext steps:")
62
+ print("1. Test publish: uv run twine upload --repository testpypi dist/*")
63
+ print("2. Real publish: uv run twine upload dist/*")
64
+ print("3. Or create a GitHub release to trigger automatic publishing")
65
+
66
+ if __name__ == "__main__":
67
+ main()
package/smithery.yaml ADDED
@@ -0,0 +1,15 @@
1
+ # Smithery configuration file: https://smithery.ai/docs/build/project-config
2
+
3
+ startCommand:
4
+ type: stdio
5
+ commandFunction:
6
+ # A JS function that produces the CLI command based on the given config to start the MCP on stdio.
7
+ |-
8
+ (config) => ({command: 'csv-editor', args: ['--transport', 'stdio']})
9
+ configSchema:
10
+ # JSON Schema defining the configuration options for the MCP.
11
+ type: object
12
+ default: {}
13
+ description: No configuration necessary to run the CSV Editor MCP server. Supply
14
+ an empty object.
15
+ exampleConfig: {}