pyscn 1.1.0__py3-none-macosx_11_0_arm64.whl → 1.3.0__py3-none-macosx_11_0_arm64.whl

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.
Binary file
Binary file
pyscn/mcp_main.py ADDED
@@ -0,0 +1,96 @@
1
+ """
2
+ Entry point for pyscn-mcp MCP server.
3
+
4
+ This module provides a Python wrapper for the Go-implemented pyscn-mcp binary.
5
+ It automatically detects the platform and executes the appropriate MCP server binary.
6
+ """
7
+
8
+ import os
9
+ import sys
10
+ import platform
11
+ from pathlib import Path
12
+
13
+
14
+ def get_mcp_binary_path() -> str:
15
+ """
16
+ Get the path to the pyscn-mcp binary for the current platform.
17
+
18
+ Returns:
19
+ str: Path to the pyscn-mcp binary.
20
+
21
+ Raises:
22
+ FileNotFoundError: If the binary is not found for the current platform.
23
+ """
24
+ system = platform.system().lower()
25
+ machine = platform.machine().lower()
26
+
27
+ # Normalize architecture names
28
+ if machine in ('x86_64', 'amd64'):
29
+ machine = 'amd64'
30
+ elif machine in ('aarch64', 'arm64'):
31
+ machine = 'arm64'
32
+ else:
33
+ raise FileNotFoundError(
34
+ f"Unsupported architecture: {machine}. "
35
+ f"Supported architectures: amd64, arm64"
36
+ )
37
+
38
+ # Determine binary name
39
+ binary_name = f"pyscn-mcp-{system}-{machine}"
40
+ if system == "windows":
41
+ binary_name += ".exe"
42
+
43
+ # Binary path within the package
44
+ binary_path = Path(__file__).parent / "bin" / binary_name
45
+
46
+ if not binary_path.exists():
47
+ raise FileNotFoundError(
48
+ f"pyscn-mcp binary not found for platform {system}-{machine}.\n"
49
+ f"Expected location: {binary_path}\n"
50
+ f"Please check that the package was installed correctly."
51
+ )
52
+
53
+ return str(binary_path)
54
+
55
+
56
+ def main():
57
+ """
58
+ Main entry point for pyscn-mcp MCP server.
59
+
60
+ Replaces the current process with the Go-implemented MCP server binary.
61
+ This ensures proper stdio handling for MCP's JSON-RPC communication.
62
+ """
63
+ try:
64
+ binary_path = get_mcp_binary_path()
65
+
66
+ # Prepare arguments
67
+ args = [binary_path] + sys.argv[1:]
68
+
69
+ # Replace the current process with the MCP server binary
70
+ # This is critical for MCP servers as they need direct stdio access
71
+ # and proper signal handling without a Python wrapper layer
72
+ if sys.platform == "win32":
73
+ # Windows: use os.execv
74
+ os.execv(binary_path, args)
75
+ else:
76
+ # Unix-like: use os.execv
77
+ os.execv(binary_path, args)
78
+
79
+ except FileNotFoundError as e:
80
+ print(f"Error: {e}", file=sys.stderr)
81
+ print(
82
+ f"\nPlatform information:\n"
83
+ f" System: {platform.system()}\n"
84
+ f" Architecture: {platform.machine()}\n"
85
+ f" Python: {platform.python_version()}",
86
+ file=sys.stderr
87
+ )
88
+ sys.exit(1)
89
+
90
+ except Exception as e:
91
+ print(f"Unexpected error: {e}", file=sys.stderr)
92
+ sys.exit(1)
93
+
94
+
95
+ if __name__ == "__main__":
96
+ main()
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyscn
3
- Version: 1.1.0
3
+ Version: 1.3.0
4
4
  Summary: An intelligent Python code quality analyzer with architectural guidance
5
5
  Home-page: https://github.com/ludo-technologies/pyscn
6
6
  Author: DaisukeYoda
7
7
  Author-email: daisukeyoda@users.noreply.github.com
8
8
  License: MIT
9
- Classifier: Development Status :: 4 - Beta
9
+ Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Environment :: Console
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
@@ -17,12 +17,15 @@ Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
20
21
  Classifier: Topic :: Software Development :: Quality Assurance
22
+ Classifier: Typing :: Typed
21
23
  Requires-Python: >=3.8
22
24
  Description-Content-Type: text/markdown
23
25
 
24
26
  # pyscn - Python Code Quality Analyzer
25
27
 
28
+ [![Article](https://img.shields.io/badge/dev.to-Article-0A0A0A?style=flat-square&logo=dev.to)](https://dev.to/daisukeyoda/pyscn-the-code-quality-analyzer-for-vibe-coders-18hk)
26
29
  [![PyPI](https://img.shields.io/pypi/v/pyscn?style=flat-square&logo=pypi)](https://pypi.org/project/pyscn/)
27
30
  [![Go](https://img.shields.io/badge/Go-1.24+-00ADD8?style=flat-square&logo=go)](https://go.dev/)
28
31
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
@@ -54,6 +57,48 @@ https://github.com/user-attachments/assets/07f48070-c0dd-437b-9621-cb3963f863ff
54
57
 
55
58
  **100,000+ lines/sec** • Built with Go + tree-sitter
56
59
 
60
+ ## MCP Integration
61
+
62
+ Run pyscn analyses straight from AI coding assistants via the Model Context Protocol (MCP). The bundled `pyscn-mcp` server exposes the same tools used in the CLI to Claude Code, Cursor, ChatGPT, and other MCP clients.
63
+
64
+ ### MCP Use Cases
65
+
66
+ You can interact with pyscn with your AI coding tools:
67
+
68
+ 1. "Analyze the code quality of the app/ directory"
69
+
70
+ 2. "Find duplicate code and help me refactor it"
71
+
72
+ 3. "Show me complex code and help me simplify it"
73
+
74
+ ### Claude Code Setup
75
+
76
+ ```bash
77
+ claude mcp add pyscn-mcp uvx -- pyscn-mcp
78
+ ```
79
+
80
+ ### Cursor / Claude Desktop Setup
81
+
82
+ Add to your MCP settings (`~/.config/claude-desktop/config.json` or Cursor settings):
83
+
84
+ ```json
85
+ {
86
+ "mcpServers": {
87
+ "pyscn-mcp": {
88
+ "command": "uvx",
89
+ "args": ["pyscn-mcp"],
90
+ "env": {
91
+ "PYSCN_CONFIG": "/path/to/.pyscn.toml"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ The instructions like "Analyze the code quality" trigger pyscn via MCP.
99
+
100
+ Dive deeper in `mcp/README.md` for setup walkthroughs and `docs/MCP_INTEGRATION.md` for architecture details.
101
+
57
102
  ## Installation
58
103
 
59
104
  ```bash
@@ -129,25 +174,19 @@ directory = "reports"
129
174
  ## CI/CD Integration
130
175
 
131
176
  ```yaml
132
- # .github/workflows/code-quality.yml
133
- name: Code Quality
134
- on: [push, pull_request]
135
-
136
- jobs:
137
- quality-check:
138
- runs-on: ubuntu-latest
139
- steps:
140
- - uses: actions/checkout@v4
141
- - run: pip install pyscn
142
- - name: Quick quality check
143
- run: pyscn check .
144
- - name: Generate detailed report
145
- run: pyscn analyze --json --select complexity,deadcode,deps src/
146
- - name: Upload report
147
- uses: actions/upload-artifact@v4
148
- with:
149
- name: code-quality-report
150
- path: .pyscn/reports/
177
+ # GitHub Actions
178
+ - uses: actions/checkout@v4
179
+ - run: pipx run pyscn check . # Fail on quality issues
180
+
181
+ # Pre-commit hook
182
+ - repo: local
183
+ hooks:
184
+ - id: pyscn
185
+ name: pyscn check
186
+ entry: pipx run pyscn check .
187
+ language: system
188
+ pass_filenames: false
189
+ types: [python]
151
190
  ```
152
191
 
153
192
  ---
@@ -0,0 +1,10 @@
1
+ pyscn-1.3.0.dist-info/METADATA,sha256=lwp_J2zS1HZb9wFuWUmsOmFqD-y5o80VNHrfw8TM6G4,5743
2
+ pyscn-1.3.0.dist-info/WHEEL,sha256=CYyQE2vHrYPvCU3b7nn-Hl7_xZMO7l2E38d23t5MbRM,104
3
+ pyscn-1.3.0.dist-info/entry_points.txt,sha256=b3uDJeuGfdioTYIV5vD_OLiCO_BPZ53Bqbe5jOurh4o,78
4
+ pyscn/__init__.py,sha256=2899qYVW2M1QljQ7xSvgLeHyf8yjzemZp62di19Baw8,431
5
+ pyscn/__main__.py,sha256=ctBTSh1ps0V8KJLus4fcg5NE2FCF1HEyfXmh1KCw0gs,120
6
+ pyscn/bin/pyscn-darwin-arm64,sha256=HojdouF2MF_CAgtcbQ6zvYZ6qlWjpts3JVNygCUFJ9s,11624306
7
+ pyscn/bin/pyscn-mcp-darwin-arm64,sha256=5BI4rF3muqvdrCMCdN51WaAT2foFstL1LQM86Av6ihs,7105506
8
+ pyscn/main.py,sha256=rtQdBLwQwLWAh8dvynOzilgWd0ayRoh7MaaycpfQcI8,2619
9
+ pyscn/mcp_main.py,sha256=pWy07VEsQzpsuaGyRrNPKUq_4TO538rFk7v7mMkqC1A,2755
10
+ pyscn-1.3.0.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  pyscn = pyscn.__main__:main
3
+ pyscn-mcp = pyscn.mcp_main:main
@@ -1,8 +0,0 @@
1
- pyscn-1.1.0.dist-info/METADATA,sha256=ZvcdbK5o8njCOZcKlsGPLvl3tfbU-9L9MUiib6k8fEI,4674
2
- pyscn-1.1.0.dist-info/WHEEL,sha256=CYyQE2vHrYPvCU3b7nn-Hl7_xZMO7l2E38d23t5MbRM,104
3
- pyscn-1.1.0.dist-info/entry_points.txt,sha256=Hq59HuLE4ipwZthGmgvAv7aQF3oiixtCLxivVoNil5w,46
4
- pyscn/__init__.py,sha256=2899qYVW2M1QljQ7xSvgLeHyf8yjzemZp62di19Baw8,431
5
- pyscn/__main__.py,sha256=ctBTSh1ps0V8KJLus4fcg5NE2FCF1HEyfXmh1KCw0gs,120
6
- pyscn/bin/pyscn-darwin-arm64,sha256=3iTmV-UwrSGoWLtzmL_oKeVJWnLkgfhD3xWIgNq728Q,11624338
7
- pyscn/main.py,sha256=rtQdBLwQwLWAh8dvynOzilgWd0ayRoh7MaaycpfQcI8,2619
8
- pyscn-1.1.0.dist-info/RECORD,,
File without changes