简体   繁体   English

上传到 PyPi 返回无效的 URI

[英]uploading to PyPi returning Invalid URI

I'm trying to upload my package to PyPi and keep getting this error:我正在尝试将我的 package 上传到 PyPi 并不断收到此错误:

 HTTPError: 400 Client Error: 'github.com/Palashio/Libra' is an invalid value for Home-Page. Error: Invalid URI See https://packaging.python.org/specifications/core-metadata for url: https://test.pypi.org/legacy/

I'm using this tutorial: https://packaging.python.org/tutorials/packaging-projects/#uploading-your-project-to-pypi我正在使用本教程: https://packaging.python.org/tutorials/packaging-projects/#uploading-your-project-to-pypi

This happens when I run this line:当我运行此行时会发生这种情况:

python3 -m twine upload --repository testpypi dist/*

and enter __ token __ as the username, and the generated token from the test.pypi.org as the password并输入 __ token __ 作为用户名,从 test.pypi.org 生成的令牌作为密码

This is what my directory contains: build, dist, reponame (with all the package files in it), reponame.eggs-info, LICENSE.txt, README.md, setup.cfg, and setup.py这是我的目录包含的内容:build、dist、reponame(其中包含所有 package 文件)、reponame.eggs-info、LICENSE.txt、README.md、setup.cfg 和 setup.py

This is what my setup.py file looks like:这是我的 setup.py 文件的样子:

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="libradocs", # Replace with your own username
    version="0.0.0",
    author="username-from-test.pypi",
    author_email="author@example.com",
    description="A small example package",
    long_description=long_description,
    long_description_content_type="text/markdown",
    homepage="https://github.com/Palashio/Libra",
    packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.6',
)

inside of the reponame folder, I have 5 different folders, with different files and function that I want users to be able to use.在 reponame 文件夹中,我有 5 个不同的文件夹,包含不同的文件和 function,我希望用户能够使用它们。 I have put blank init .py files in both the root and in each of the sub-folders within Libra.我在 Libra 的根目录和每个子文件夹中都放置了空白的init .py 文件。

The homepage parameter has been deprecated. homepage参数已被弃用。 Replace this with url and you should be good.url替换它,你应该会很好。 The example in the docs follows this format as well. 文档中的示例也遵循这种格式。

Just got it to work.刚刚开始工作。 Make sure your name is the same as the token name in which you create on the test.pypi online site.确保您的名称与您在 test.pypi 在线站点上创建的令牌名称相同。 Also make sure that you're not creating a PyPi package that already exists.还要确保您没有创建已经存在的 PyPi package。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM