diff --git a/.github/workflows/doc.yaml b/.github/workflows/doc.yaml new file mode 100644 index 0000000..8bf2529 --- /dev/null +++ b/.github/workflows/doc.yaml @@ -0,0 +1,71 @@ +name: documentation +on: + push: + branches: + - main + +env: + PYTHON_VERSION: 3.10.14 + +permissions: + contents: write + id-token: write + pages: write + +jobs: + documentation: + name: Build documentation + runs-on: ubuntu-latest + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python runtime + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: pip + cache-dependency-path: | + pyproject.toml + requirements.txt + + - name: Set up build cache + uses: actions/cache/restore@v4 + with: + key: mkdocs-material-${{ hashfiles('.cache/**') }} + path: .cache + restore-keys: | + mkdocs-material- + + - name: Install Python dependencies + run: | + pip install mkdocs-material + pip install "mkdocstrings[python]" + + - name: Build documentation + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + mkdocs build --clean + mkdocs --version + + - name: Adjust permissions + run: | + chmod -c -R +rX site/ | while read line; do + echo "::warning title=Invalid file permissions automatically fixed::$line" + done + + - name: Upload to GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: site + + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 + + - name: Save build cache + uses: actions/cache/save@v4 + with: + key: mkdocs-material-${{ hashfiles('.cache/**') }} + path: .cache diff --git a/.github/workflows/publish_PYPI.yaml b/.github/workflows/publish_PYPI.yaml new file mode 100644 index 0000000..621c2ae --- /dev/null +++ b/.github/workflows/publish_PYPI.yaml @@ -0,0 +1,39 @@ +name: publish python package to PyPI + +on: + release: + types: [published] + +jobs: + build_wheels: + name: Build wheels + runs-on: ubuntu-latest + environment: pypi + steps: + - uses: actions/checkout@master + + - name: Set up Python 3.10 + uses: actions/setup-python@v1 + with: + python-version: 3.10.14 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + + - name: publish to PYPI + uses: pypa/gh-action-pypi-publish@v1.8.12 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/publish_TESTPYPI.yaml b/.github/workflows/publish_TESTPYPI.yaml new file mode 100644 index 0000000..74ae27a --- /dev/null +++ b/.github/workflows/publish_TESTPYPI.yaml @@ -0,0 +1,41 @@ +name: publish python package to PyPI + +on: + push: + # Alternative: only build for tags. + tags: + - 'v*' +jobs: + build_wheels: + name: Build wheels + runs-on: ubuntu-latest + environment: pypi + steps: + - uses: actions/checkout@master + + - name: Set up Python 3.10 + uses: actions/setup-python@v1 + with: + python-version: 3.10.14 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + + - name: publish to Test PYPI + uses: pypa/gh-action-pypi-publish@v1.8.12 + with: + repository-url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TESTPYPI_API_TOKEN }} diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..ea3c8e2 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,9 @@ +include *.md +include asset/* +recursive-include *.cpp *.c *.hpp *.h +recursive-include *.py *.csv *.json *.txt *.cpp *.hpp *.h + +exclude data/* + +global-exclude .DS_Store +global-exclude *.pyc diff --git a/asset/FMA_social_preview.jpg b/asset/FMA_social_preview.jpg new file mode 100644 index 0000000..6a42d37 Binary files /dev/null and b/asset/FMA_social_preview.jpg differ diff --git a/docs/Documentation/API.md b/docs/Documentation/API.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/Documentation/API.md @@ -0,0 +1 @@ + diff --git a/docs/HOME/ABOUT.md b/docs/HOME/ABOUT.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Quick_Start/installation.md b/docs/Quick_Start/installation.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Quick_Start/user_guide.md b/docs/Quick_Start/user_guide.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/Tutorial/tutorial.md b/docs/Tutorial/tutorial.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..90c61f3 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +# 🔧 FastMindAPI diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..d929c4f --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,59 @@ +# Project information +site_name: FastMindAPI + +# Repository +repo_name: fairyshine/FastMindAPI +repo_url: https://github.com/fairyshine/FastMindAPI + +# Configuration +theme: + name: "material" + features: + - navigation.tabs # 页面上方的导航栏 + - navigation.instant # 现在页面不会跳转,而是类似单页应用,搜索和各种跳转都是在当前页面完成,对美观有很大帮助 + - navigation.tracking # 页面滚动时,导航栏高亮当前页面 + - navigation.sections # 使导航栏分块 + - navigation.expand # 默认展开导航 + - navigation.prune # 只渲染当前页面的导航 + - toc.follow # 滚动的时候侧边栏自动跟随 + - navigation.top # 返回顶部按钮 + - search.suggest # 补全建议 + - search.highlight # 搜索结果高亮 + - search.share # 搜索结果分享 + - navigation.footer # 页脚提示下一章 + - content.code.copy # 代码段上的赋值按钮 + icon: + logo: material/tools + palette: + # Palette toggle for light mode + - scheme: default + primary: deep purple + accent: purple + toggle: + icon: material/weather-night + name: Switch to dark mode + + # Palette toggle for dark mode + - scheme: slate + primary: deep purple + accent: purple + toggle: + icon: material/weather-sunny + name: Switch to light mode + +plugins: + - mkdocstrings: + handlers: + python: + paths: [src] + - search # built-in 搜索插件 + +nav: + - Home: + - index.md + - ABOUT: HOME/ABOUT.md + - Quick Start: + - Installation: Quick_Start/installation.md + - User Guide: Quick_Start/user_guide.md + - Tutorial: Tutorial/tutorial.md + - Documentation: Documentation/API.md diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1fb6967 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools>=64", "setuptools-scm>=8"] +build-backend = "setuptools.build_meta" + +[project] +name = "fastmindapi" +description = "An easy-to-use, high-performance(?) backend for serving LLMs and other AI models, built on FastAPI." +dynamic = ["version", "dependencies"] +readme = "README.md" +requires-python = ">=3.10" +license = { file = "LICENSE" } +authors = [ + { name = "Mengsong Wu", email = "radi.cat@qq.com" }, +] +maintainers = [ + { name = "Mengsong Wu", email = "radi.cat@qq.com" }, +] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[tool.setuptools.packages.find] +where = ["src"] +include = ["fastmindapi"] + +[tool.setuptools_scm] + +[project.urls] +"Homepage" = "https://github.com/fairyshine/FastMindAPI/" +"Bug Tracker" = "https://github.com/fairyshine/FastMindAPI/issues" +"Source" = "https://github.com/fairyshine/FastMindAPI" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..35cdd82 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +pydantic +uvicorn +fastapi +rich \ No newline at end of file diff --git a/src/fastmindapi/__init__.py b/src/fastmindapi/__init__.py new file mode 100644 index 0000000..4d94916 --- /dev/null +++ b/src/fastmindapi/__init__.py @@ -0,0 +1,25 @@ +"""Python Package named ToolAgent (A Highly-Modularized Tool Learning Framework for LLM Based Agent)""" + +from importlib.metadata import PackageNotFoundError +from importlib.metadata import version + +# from fastmindapi.utils.config import get_config +# from fastmindapi.utils.logging import get_logger + +__all__ = [ + "__version__", + # "config", + # "logger" +] + +# Official PEP 396 +try: + __version__ = version("fastmindapi") +except PackageNotFoundError: + __version__ = "unknown version" + +# config = get_config() +# logger = get_logger() + + +# logger.info("FastMindAPI (FM) initialization is completed.")