我是在 pypi 上发布包的新手。我试图发布我的包,但我什至不能自己安装。你能帮我看看我哪里错了吗?
错误:
# by pip
pip install fastapi-casdoor
ERROR: Could not find a version that satisfies the requirement fastapi-casdoor (from versions: none)
ERROR: No matching distribution found for fastapi-casdoor
# by poetry
poetry add fastapi-casdoor
Could not find a matching version of package fastapi-casdoor
设置.py
#!/usr/bin/python
# encoding: utf-8
from setuptools import setup, find_packages
if __name__ == '__main__':
setup()
设置.cfg
[metadata]
name = fastapi-casdoor
author = Winrey
author_email = [email protected]
version = 0.1.8
description = Integration Casdoor with FastAPI
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/winrey/python-fastapi-casdoor
license_files = LICENSE
keywords = auth, casdoor, fastapi, dependency
classifiers =
Development Status :: 3 - Alpha
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Framework :: FastAPI
Topic :: Internet :: WWW/HTTP
Natural Language :: English
Natural Language :: Chinese (Simplified)
[options]
package_dir=
= src
packages=find:
python_requires = >=3.6
install_requires =
fastapi
python-dateutil
PyJWT
pydantic
[options.packages.find]
where=src
项目:https://github.com/winrey/python-fastapi-casdoor/ pypi:https://pypi.org/project/fastapi-casdoor/
# but it can be searched on poetry
poetry search fastapi-casdoor
fastapi-casdoor (0.1.8)
Integration Casdoor with FastAPI
casdoor (1.8.0)
Python SDK built for Casdoor
我尝试将
python_requires = >3.10
修改为python_requires = >=3.10
和python_requires = >=3.6
,最后尝试删除它,但没有成功。
这是一个 python 包的两个发行版:Source Distributions 和 Built Distributions。
内置分布有两种类型:Egg 和 Wheel。
如果你想通过 pip/poetry 安装你的包,你需要上传 Wheel 包或 Source Distributions。
您可以通过以下命令构建和上传它们:
# update your python build if needs
python3 -m pip install --upgrade build
# build package
python3 -m build
# upload to pypi
twine upload dist/*
如果你对 egg 和 wheel 的区别感兴趣,可以点击以下链接: https://packaging.python.org/en/latest/discussions/wheel-vs-egg/
如果没有,就选择轮子:)
以下是一些主要优点:
Wheels 是 Python 发行版的新标准,旨在 代替鸡蛋。 pip >= 1.4 和 setuptools >= 0.8 提供支持。
- wheels 的优点纯 Python 和原生 C 的安装速度更快 扩展包。
- 避免为安装执行任意代码。 (避免 setup.py)
- 安装 C 扩展不需要 Linux、Windows 或 macOS 上的编译器。
- 允许更好的缓存以进行测试和持续集成。
- 创建 .pyc 文件作为安装的一部分,以确保它们与所使用的 Python 解释器相匹配。
- 更一致的跨平台和机器安装。
很抱歉这个基础问题,但是如果你和我一样是一个python包入门者,希望它能帮助到你~
这都是@phd提醒我并让我注意到的,谢谢。
如果我有什么误解,欢迎指正:)