发布pipy包

新建一个project

在这里插入图片描述

注册一个账号

https://pypi.org/

项目配置如下:

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

[project]
name = "daniel_eos"
version = "1.0"
authors = [
  { name="Daniel Chen", email="cdmstrong123@gmail.com"},
]
description = "daniel_eos is a package for eos to yidongyun "
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.9"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]
dependencies = [
        "aiohttp",
        "requests",
        "boto3==1.35.92",
        "pydantic",
    ]

[project.urls]
"Homepage" = "https://github.com/NickYi1990/juans"

[tool.setuptools.packages.find]
where = ["daniel_eos"]  # 查找src目录下的包

导入包

然后在__init__.py 下


from .upload import upload_file

打包

从新打包的话,使用删除命令:

rm -rf build dist *.egg-info
python -m build
twine check dist/*

可能会出现

twine check dist/*
Checking dist/daniel_eos-1.0-py3-none-any.whl: InvalidDistribution: Metadata is missing required fields: Name, Version.
Make sure the distribution includes the files where those fields are specified, and is using a supported Metadata-Version: 1.0, 1.1, 1.2, 2.0, 2.1, 2.2.

在这里插入图片描述
这里主要是因为版本的问题,twine 升级到最新版就可以,要用pip 安装,不要用apt-get 安装

发布

绑定 token
在这里插入图片描述
获取密钥:
1、在 PyPI 的 2FA 设置页面,选择 “Authenticator app” 后,会看到一个16 或 32 字符的密钥(只包含 A-Z 和 2-7)
2、执行python -c “import pyotp; print(pyotp.TOTP(‘你的正确密钥’).now())”,出现6位数,输入到verify
3、回到设置页:
在这里插入图片描述
发布成功:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

东哥aigc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值