feat: Complete PyPI Query MCP Server Implementation (#3)
Merge pull request implementing complete PyPI query MCP server with comprehensive features and CI/CD pipeline.
This commit is contained in:
parent
b1a1a6866d
commit
030b3a2607
33 changed files with 3238 additions and 246 deletions
60
.github/workflows/build-exe.yml
vendored
60
.github/workflows/build-exe.yml
vendored
|
|
@ -1,60 +0,0 @@
|
|||
name: Build Executable
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Python Package"]
|
||||
types:
|
||||
- completed
|
||||
branches:
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Only run if the python-publish workflow succeeded
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- os: windows-2022
|
||||
triple: x86_64-pc-windows-msvc
|
||||
- os: ubuntu-22.04
|
||||
triple: x86_64-unknown-linux-gnu
|
||||
- os: macos-12
|
||||
triple: x86_64-apple-darwin
|
||||
runs-on: ${{ matrix.target.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: olegtarasov/get-tag@v2.1.4
|
||||
id: get_tag_name
|
||||
with:
|
||||
tagRegex: "v(?<version>.*)"
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: pip
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install nox
|
||||
|
||||
- name: Build exe
|
||||
run: |
|
||||
nox -s build-exe -- --release --version ${{ steps.get_tag_name.outputs.version }}
|
||||
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
allowUpdates: true
|
||||
updateOnlyUnreleased: false
|
||||
omitBody: true
|
||||
artifacts: ".zip/*.zip"
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
23
.github/workflows/bumpversion.yml
vendored
23
.github/workflows/bumpversion.yml
vendored
|
|
@ -1,23 +0,0 @@
|
|||
name: Bump version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
bump-version:
|
||||
if: "!startsWith(github.event.head_commit.message, 'bump:')"
|
||||
runs-on: ubuntu-latest
|
||||
name: "Bump version and create changelog with commitizen"
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
|
||||
- name: Create bump and changelog
|
||||
uses: commitizen-tools/commitizen-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
branch: main
|
||||
34
.github/workflows/codecov.yml
vendored
34
.github/workflows/codecov.yml
vendored
|
|
@ -1,34 +0,0 @@
|
|||
name: Codecov
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get repository name
|
||||
id: repo-name
|
||||
uses: MariachiBear/get-repo-name-action@v1.3.0
|
||||
with:
|
||||
with-owner: 'true'
|
||||
string-case: 'uppercase'
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -r requirements-dev.txt
|
||||
poetry --version
|
||||
- name: Run tests and collect coverage
|
||||
run: |
|
||||
nox -s pytest
|
||||
- name: Upload coverage reports to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
slug: loonghao/${{ steps.repo-name.outputs.repository-name }}
|
||||
files: 'coverage.xml'
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
18
.github/workflows/issue-translator.yml
vendored
18
.github/workflows/issue-translator.yml
vendored
|
|
@ -1,18 +0,0 @@
|
|||
name: 'issue-translator'
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: usthe/issues-translate-action@v2.7
|
||||
with:
|
||||
IS_MODIFY_TITLE: false
|
||||
# not require, default false, . Decide whether to modify the issue title
|
||||
# if true, the robot account @Issues-translate-bot must have modification permissions, invite @Issues-translate-bot to your project or use your custom bot.
|
||||
CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
|
||||
# not require. Customize the translation robot prefix message.
|
||||
35
.github/workflows/mr-test.yml
vendored
35
.github/workflows/mr-test.yml
vendored
|
|
@ -1,35 +0,0 @@
|
|||
name: MR Checks
|
||||
on: [ pull_request ]
|
||||
|
||||
jobs:
|
||||
python-check:
|
||||
strategy:
|
||||
max-parallel: 3
|
||||
matrix:
|
||||
target:
|
||||
- os: 'ubuntu-22.04'
|
||||
triple: 'x86_64-unknown-linux-gnu'
|
||||
- os: 'macos-12'
|
||||
triple: 'x86_64-apple-darwin'
|
||||
- os: 'windows-2022'
|
||||
triple: 'x86_64-pc-windows-msvc'
|
||||
python-version: ["3.10"]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.target.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -r requirements-dev.txt
|
||||
poetry --version
|
||||
- name: lint
|
||||
run: |
|
||||
nox -s lint
|
||||
- name: test build
|
||||
run: |
|
||||
nox -s build-exe -- --test
|
||||
66
.github/workflows/python-publish.yml
vendored
66
.github/workflows/python-publish.yml
vendored
|
|
@ -1,66 +0,0 @@
|
|||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||
id-token: write
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
fetch-depth: 0
|
||||
ref: main
|
||||
- uses: olegtarasov/get-tag@v2.1.4
|
||||
id: get_tag_name
|
||||
with:
|
||||
tagRegex: "v(?<version>.*)"
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -r requirements-dev.txt
|
||||
poetry --version
|
||||
poetry build
|
||||
# Note that we don't need credentials.
|
||||
# We rely on https://docs.pypi.org/trusted-publishers/.
|
||||
- name: Upload to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
packages-dir: dist
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
uses: jaywcjlove/changelog-generator@main
|
||||
with:
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
filter-author: (|dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot)
|
||||
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
|
||||
template: |
|
||||
## Bugs
|
||||
{{fix}}
|
||||
## Feature
|
||||
{{feat}}
|
||||
## Improve
|
||||
{{refactor,perf,clean}}
|
||||
## Misc
|
||||
{{chore,style,ci||🔶 Nothing change}}
|
||||
## Unknown
|
||||
{{__unknown__}}
|
||||
- uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "dist/*"
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
body: |
|
||||
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
|
||||
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
102
.github/workflows/release.yml
vendored
Normal file
102
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/test.yml
|
||||
|
||||
build:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install uv
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uvx poetry install
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
uvx poetry build
|
||||
|
||||
- name: Check package
|
||||
run: |
|
||||
uvx poetry run twine check dist/*
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
publish:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
permissions:
|
||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
skip-existing: true
|
||||
|
||||
github-release:
|
||||
needs: publish
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
run: |
|
||||
# Extract version from tag
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
# Generate changelog (basic implementation)
|
||||
echo "## Changes in v$VERSION" > CHANGELOG.md
|
||||
echo "" >> CHANGELOG.md
|
||||
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> CHANGELOG.md || echo "- Initial release" >> CHANGELOG.md
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release v${{ steps.changelog.outputs.version }}
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: false
|
||||
104
.github/workflows/test.yml
vendored
Normal file
104
.github/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
max-parallel: 6
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
python-version: ["3.10", "3.11", "3.12"]
|
||||
fail-fast: false
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
cache-dependency-path: '**/pyproject.toml'
|
||||
|
||||
# Cache Poetry dependencies
|
||||
- name: Cache Poetry dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pypoetry
|
||||
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-poetry-${{ matrix.python-version }}-
|
||||
|
||||
# Cache nox environments
|
||||
- name: Cache nox environments
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .nox
|
||||
key: ${{ runner.os }}-nox-${{ matrix.python-version }}-${{ hashFiles('**/noxfile.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nox-${{ matrix.python-version }}-
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install uv
|
||||
uv --version
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uvx poetry install
|
||||
|
||||
- name: Lint with ruff
|
||||
run: |
|
||||
uvx nox -s lint
|
||||
|
||||
- name: Type check with mypy
|
||||
run: |
|
||||
uvx nox -s mypy
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
uvx nox -s pytest
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install uv
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uvx poetry install
|
||||
|
||||
- name: Run security checks
|
||||
run: |
|
||||
uvx nox -s safety
|
||||
Loading…
Add table
Add a link
Reference in a new issue