M

MCP Python Server

這是一個Python項目模板,集成了ruff、black等代碼檢查和格式化工具,使用pre-commit管理鉤子,包含pytest測試框架和覆蓋率插件,並通過Github Actions實現自動化測試。支持devcontainer開發環境和傳統虛擬環境。
2分
18

What is this Python Project Template?

This is a starter template for Python projects that comes pre-configured with essential development tools like code formatters, linters, and testing frameworks. It helps developers quickly start new projects with best practices already in place.

How to use this template?

You can either use the built-in devcontainer for a containerized development environment or set up manually with virtualenv. The template includes pre-commit hooks for code quality checks and GitHub Actions for continuous integration.

When should I use this template?

Ideal for starting new Python projects of any size, especially when you want to ensure code quality from the beginning. Great for both individual developers and teams.

Key Features

Code Quality ToolsIncludes ruff (combining flake8, isort, pyupgrade) for linting and black for automatic code formatting
Testing FrameworkComes with pytest and pytest-cov for testing with coverage reporting
CI/CD IntegrationGitHub Actions workflow pre-configured to run checks on every pull request and merge
DevContainer SupportReady-to-use development container configuration for VS Code and GitHub Codespaces

Pros and Cons

Advantages
Saves setup time with pre-configured tools
Enforces consistent code style across team members
Containerized development environment reduces 'works on my machine' issues
Built-in CI/CD pipeline ensures code quality
Limitations
Initial learning curve for developers unfamiliar with the tools
Might include unnecessary tools for very simple projects
Default Python version (3.11) may need adjustment for some projects

Getting Started

Option 1: Use DevContainer
Open in VS Code with Dev Containers extension or GitHub Codespaces for automatic setup
Option 2: Manual Setup
Create virtual environment and install dependencies
Install Pre-commit Hooks
Set up git hooks to run quality checks before each commit
Start Developing
Replace the sample main.py and tests with your own code

Example Workflows

Adding New Feature1. Create feature branch 2. Write code 3. Add tests 4. Pre-commit checks will run automatically 5. Push to GitHub where CI runs full checks
Fixing Style IssuesWhen pre-commit finds style violations, it will either auto-fix them or show you what needs manual fixing

Frequently Asked Questions

How do I change the Python version?
Can I add more pre-commit hooks?
What if I don't want to use all these tools?

Additional Resources

Blog Post: How I Setup Python Projects
Detailed explanation of the template's design decisions
DevContainer Images
List of available Python devcontainer images
Pre-commit Hooks
Additional hooks you can add to the configuration
安裝
複製以下命令到你的Client進行配置
注意:您的密鑰屬於敏感信息,請勿與任何人分享。
精選MCP服務推薦
M
Markdownify MCP
Markdownify是一個多功能文件轉換服務,支持將PDF、圖片、音頻等多種格式及網頁內容轉換為Markdown格式。
TypeScript
1.7K
5分
B
Baidu Map
已認證
百度地圖MCP Server是國內首個兼容MCP協議的地圖服務,提供地理編碼、路線規劃等10個標準化API接口,支持Python和Typescript快速接入,賦能智能體實現地圖相關功能。
Python
697
4.5分
F
Firecrawl MCP Server
Firecrawl MCP Server是一個集成Firecrawl網頁抓取能力的模型上下文協議服務器,提供豐富的網頁抓取、搜索和內容提取功能。
TypeScript
3.8K
5分
S
Sequential Thinking MCP Server
一個基於MCP協議的結構化思維服務器,通過定義思考階段幫助分解複雜問題並生成總結
Python
249
4.5分
C
Context7
Context7 MCP是一個為AI編程助手提供即時、版本特定文檔和代碼示例的服務,通過Model Context Protocol直接集成到提示中,解決LLM使用過時信息的問題。
TypeScript
5.2K
4.7分
E
Edgeone Pages MCP Server
EdgeOne Pages MCP是一個通過MCP協議快速部署HTML內容到EdgeOne Pages並獲取公開URL的服務
TypeScript
246
4.8分
N
Notion Api MCP
已認證
一個基於Python的MCP服務器,通過Notion API提供高級待辦事項管理和內容組織功能,實現AI模型與Notion的無縫集成。
Python
113
4.5分
M
Magic MCP
Magic Component Platform (MCP) 是一個AI驅動的UI組件生成工具,通過自然語言描述幫助開發者快速創建現代化UI組件,支持多種IDE集成。
JavaScript
1.7K
5分
AIbase
智啟未來,您的人工智慧解決方案智庫
© 2025AIbase