Python项目模板

一个用于Python项目的模板,提供本地开发、Docker开发和部署的指令。

  • by ks6088ts-labs
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 ks6088ts-labs/template-mcp-python

使用说明

模板-MCP-Python

这是一个Python的模板仓库

先决条件

开发指南

本地开发

使用Makefile在本地运行项目。

# help
make

# install dependencies for development
make install-deps-dev

# run tests
make test

# run CI tests
make ci-test

Docker 开发

# build docker image
make docker-build

# run docker container
make docker-run

# run CI tests in docker container
make ci-test-docker

部署指南

Docker Hub

要将Docker镜像发布到Docker Hub,您需要 创建访问令牌 并在仓库设置中设置以下密钥。

gh secret set DOCKERHUB_USERNAME --body $DOCKERHUB_USERNAME
gh secret set DOCKERHUB_TOKEN --body $DOCKERHUB_TOKEN

Azure 静态 Web 应用

RESOURCE_GROUP_NAME=your-resource-group-name
SWA_NAME=your-static-web-app-name

# Create a static app
az staticwebapp create --name $SWA_NAME --resource-group $RESOURCE_GROUP_NAME

# Retrieve the API key
AZURE_STATIC_WEB_APPS_API_TOKEN=$(az staticwebapp secrets list --name $SWA_NAME --query "properties.apiKey" -o tsv)

# Set the API key as a GitHub secret
gh secret set AZURE_STATIC_WEB_APPS_API_TOKEN --body $AZURE_STATIC_WEB_APPS_API_TOKEN

如需更多信息,请参阅以下链接: