Skip to main content

A high-performance asynchronous micro-framework inspired by Spring Boot styling.

Project description

MicroPos

一个由 asyncio 驱动、支持热重载、复刻 Spring Boot 启动风格的高性能异步微框架。

安装

pip install micropos
# 或者使用 uv
uv add micropos

快速开始

import micropos
app = micropos.create_server(port=8000)
app.get("/", lambda: {"hello": "world"})
if __name__ == "__main__":
    micropos.run(app)

2. 创建 pyproject.toml(核心配置文件): 在根目录下新建该文件,将以下内容粘贴进去。记得根据你的实际情况微调:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "micropos"   # 你在 pip install 时用的名字。如果提示重名,你需要改个别的
version = "0.1.0"   # 版本号
description = "A high-performance asynchronous micro-framework inspired by Spring Boot styling."
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
authors = [
    { name = "YourName", email = "your_email@example.com" }
]
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]
dependencies = [
    "uvicorn>=0.20.0",
    "aiofiles>=23.0.0"
]

[tool.hatch.build.targets.wheel]
packages = ["micropos"]

第三步:使用 uv 极速构建与发布

既然你想对接 uv 区域,我们直接用 uv 来完成打包和发布(uv 内部集成了非常棒的构建引擎)。

  1. 安装 uv(如果你还没装):
pip install uv
  1. 在项目根目录下执行构建(生成 .whl.tar.gz 压缩包):
uv build

执行成功后,你会发现根目录下多出了一个 dist/ 文件夹。 3. 发布到 PyPI: 使用 uv 推荐的发布命令:

uv publish
  • 提示输入 Username 时,输入:__token__ (固定就是这个,不要输你的用户名)。
  • 提示输入 Password 时,粘贴你第一步在 PyPI 复制的那串 pypi- 开头的长 Token。

稍等几秒钟,终端就会提示:Upload successful! 🎉


第四步:去 pipuv 区域检验成果!

发布成功大约 1 分钟后,你就可以在全球任何一台电脑上测试你的框架了!

1. 传统的 pip 区域安装测试:

pip install micropos

2. 现代的 uv 区域安装与运行测试: 如果你或你的用户使用 uv,可以新建一个空文件夹直接秒级下载并运行:

# 初始化一个 uv 项目
uv init my-web-app
cd my-web-app

# 使用 uv 一键添加你的微框架(uv 会自动解析 pyproject.toml 里的依赖)
uv add micropos

# 编写 main.py 后,直接用 uv 闪电启动
uv run python main.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropos-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

micropos-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file micropos-0.1.0.tar.gz.

File metadata

  • Download URL: micropos-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for micropos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 178e1ef242cb4da01d7c56f3d7201bfcfe14d7246fec6ca36a5d601e29f39501
MD5 e66e40a3bafc2a1808ea2d26b7b55f86
BLAKE2b-256 7da87b4e87841f49864cdf1ad5777cb46a0ccb88c0eb0b24dabbb5f737f8502f

See more details on using hashes here.

File details

Details for the file micropos-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: micropos-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for micropos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 971969b4fa7090143fa1d408f6c4ba20fb19b0d75b70312cd5eb922bc6ce0be7
MD5 fcf58e92608ee8aeaee9e7811c788dfb
BLAKE2b-256 bf47e7b8c501eb45fef6b521e6eb5dfc840c28d74f236ca699a8e6a4f7b4efbf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page