当前位置:   article > 正文

python 打包发布(含静态文件)_pyproject.toml 打包

pyproject.toml 打包

pypi账号注册及设置

注册及添加token

首先在 https://pypi.org/ 注册一个账号,然后在 https://pypi.org/manage/account/ 添加一个token

设备本地token

macOS

~/.pypirc

[distutils]
index-servers =
    pypi

[pypi]
  repository = https://upload.pypi.org/legacy/
  username = __token__
  password = pypi-Ag*******中间省略*******EX_84SF8M3HZg
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

准备一个python项目

项目目录结构

|____LICENSE
|____pyproject.toml
|____tests # 留空即可
|____README.md
|____MANIFEST.in # 配置项目包含文件(setuptools打包方式生效)
|____test # 测试目录,留空
|____mditor  # 项目名称,pyproject.toml 中一致,也可以不一致
| |____项目文件
| |____views.py
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

静态文件打包

需要在 pyproject.toml 中使用 setuptools 方式打包,并在 MANIFEST.in 声明

文件内容

pyproject.toml

[build-system]
# 方式一:通过 MANIFEST.in 声明项目包含的文件
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
# 方式二:暂时不知道如何包含文件夹
# requires = ["hatchling"]
# build-backend = "hatchling.build"

[project]
name = "mditor"
version = "0.0.1"
authors = [
  { name="XiaoBing Jing", email="ju4t@qq.com" },
]
description = "描述"
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.7"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/ju4t/mditor"
"Bug Tracker" = "https://github.com/ju4t/mditor/issues"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

LICENSE

Copyright (c) 2018 The Python Packaging Authority

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

MANIFEST.in

include LICENSE
include README.md
recursive-include mditor/static *
recursive-include mditor/templates *
  • 1
  • 2
  • 3
  • 4

使用方法参考:https://packaging.python.org/en/latest/guides/using-manifest-in/

构建及发布

构建及发布命令

# 命令汇总
$ python3 -m pip install --upgrade build
$ python3 -m pip install --upgrade twine
$ python3 -m build
$ python3 -m twine upload --repository pypi dist/*
  • 1
  • 2
  • 3
  • 4
  • 5

安装构建和发布所需的软件包

需要 build 和 twine 两个包

# 安装 build 包
$ python3 -m pip install --upgrade build

python3 -m pip install --upgrade build
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: build in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (0.8.0)
Requirement already satisfied: importlib-metadata>=0.22 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from build) (4.12.0)
Requirement already satisfied: packaging>=19.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from build) (21.3)
Requirement already satisfied: pep517>=0.9.1 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from build) (0.13.0)
Requirement already satisfied: tomli>=1.0.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from build) (2.0.1)
Requirement already satisfied: zipp>=0.5 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from importlib-metadata>=0.22->build) (3.8.1)
Requirement already satisfied: typing-extensions>=3.6.4 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from importlib-metadata>=0.22->build) (4.3.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from packaging>=19.0->build) (3.0.9)

# 安装 twine 包
python3 -m pip install --upgrade twine
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: twine in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (4.0.1)
Requirement already satisfied: rich>=12.0.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (12.5.1)
Requirement already satisfied: readme-renderer>=35.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (37.0)
Requirement already satisfied: keyring>=15.1 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (23.9.0)
Requirement already satisfied: rfc3986>=1.4.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (2.0.0)
Requirement already satisfied: importlib-metadata>=3.6 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (4.12.0)
Requirement already satisfied: pkginfo>=1.8.1 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (1.8.3)
Requirement already satisfied: requests-toolbelt!=0.9.0,>=0.8.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (0.9.1)
Requirement already satisfied: requests>=2.20 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (2.28.1)
Requirement already satisfied: urllib3>=1.26.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from twine) (1.26.12)
Requirement already satisfied: typing-extensions>=3.6.4 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from importlib-metadata>=3.6->twine) (4.3.0)
Requirement already satisfied: zipp>=0.5 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from importlib-metadata>=3.6->twine) (3.8.1)
Requirement already satisfied: jaraco.classes in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from keyring>=15.1->twine) (3.2.2)
Requirement already satisfied: docutils>=0.13.1 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from readme-renderer>=35.0->twine) (0.19)
Requirement already satisfied: bleach>=2.1.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from readme-renderer>=35.0->twine) (5.0.1)
Requirement already satisfied: Pygments>=2.5.1 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from readme-renderer>=35.0->twine) (2.13.0)
Requirement already satisfied: charset-normalizer<3,>=2 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from requests>=2.20->twine) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from requests>=2.20->twine) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from requests>=2.20->twine) (2022.6.15)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from rich>=12.0.0->twine) (0.9.1)
Requirement already satisfied: webencodings in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from bleach>=2.1.0->readme-renderer>=35.0->twine) (0.5.1)
Requirement already satisfied: six>=1.9.0 in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from bleach>=2.1.0->readme-renderer>=35.0->twine) (1.16.0)
Requirement already satisfied: more-itertools in /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages (from jaraco.classes->keyring>=15.1->twine) (8.14.0)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

构建

$ python3 -m build

* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=61.0)
* Getting dependencies for sdist...
running egg_info
creating django_mditor.egg-info
writing django_mditor.egg-info/PKG-INFO
writing dependency_links to django_mditor.egg-info/dependency_links.txt
writing top-level names to django_mditor.egg-info/top_level.txt
writing manifest file 'django_mditor.egg-info/SOURCES.txt'
reading manifest file 'django_mditor.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'django_mditor.egg-info/SOURCES.txt'
* Building sdist...
running sdist
running egg_info
writing django_mditor.egg-info/PKG-INFO
writing dependency_links to django_mditor.egg-info/dependency_links.txt
writing top-level names to django_mditor.egg-info/top_level.txt
reading manifest file 'django_mditor.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'django_mditor.egg-info/SOURCES.txt'
running check
creating django-mditor-0.0.11
creating django-mditor-0.0.11/django_mditor.egg-info
creating django-mditor-0.0.11/mditor
creating django-mditor-0.0.11/mditor/static
creating django-mditor-0.0.11/mditor/static/mditor
creating django-mditor-0.0.11/mditor/static/mditor/css
creating django-mditor-0.0.11/mditor/static/mditor/font
creating django-mditor-0.0.11/mditor/static/mditor/js
creating django-mditor-0.0.11/mditor/templates
creating django-mditor-0.0.11/mditor/templates/mditor
copying files to django-mditor-0.0.11...
copying LICENSE -> django-mditor-0.0.11
copying MANIFEST.in -> django-mditor-0.0.11
copying README.md -> django-mditor-0.0.11
copying pyproject.toml -> django-mditor-0.0.11
copying django_mditor.egg-info/PKG-INFO -> django-mditor-0.0.11/django_mditor.egg-info
copying django_mditor.egg-info/SOURCES.txt -> django-mditor-0.0.11/django_mditor.egg-info
copying django_mditor.egg-info/dependency_links.txt -> django-mditor-0.0.11/django_mditor.egg-info
copying django_mditor.egg-info/top_level.txt -> django-mditor-0.0.11/django_mditor.egg-info
copying mditor/__init__.py -> django-mditor-0.0.11/mditor
copying mditor/configs.py -> django-mditor-0.0.11/mditor
copying mditor/fields.py -> django-mditor-0.0.11/mditor
copying mditor/urls.py -> django-mditor-0.0.11/mditor
copying mditor/views.py -> django-mditor-0.0.11/mditor
copying mditor/widgets.py -> django-mditor-0.0.11/mditor
copying mditor/static/mditor/css/highlight.css -> django-mditor-0.0.11/mditor/static/mditor/css
copying mditor/static/mditor/css/highlight.min.css -> django-mditor-0.0.11/mditor/static/mditor/css
copying mditor/static/mditor/css/mditor.css -> django-mditor-0.0.11/mditor/static/mditor/css
copying mditor/static/mditor/css/mditor.min.css -> django-mditor-0.0.11/mditor/static/mditor/css
copying mditor/static/mditor/font/674f50d287a8c48dc19ba404d20fe713.eot -> django-mditor-0.0.11/mditor/static/mditor/font
copying mditor/static/mditor/font/912ec66d7572ff821749319396470bde.svg -> django-mditor-0.0.11/mditor/static/mditor/font
copying mditor/static/mditor/font/a48ac41620cd818c5020d0f4302489ff.ttf -> django-mditor-0.0.11/mditor/static/mditor/font
copying mditor/static/mditor/font/af7ae505a9eed503f8b8e6982036873e.woff2 -> django-mditor-0.0.11/mditor/static/mditor/font
copying mditor/static/mditor/font/b06871f281fee6b241d60582ae9369b9.ttf -> django-mditor-0.0.11/mditor/static/mditor/font
copying mditor/static/mditor/font/fee66e712a8a08eef5805a46892932ad.woff -> django-mditor-0.0.11/mditor/static/mditor/font
copying mditor/static/mditor/js/mditor.js -> django-mditor-0.0.11/mditor/static/mditor/js
copying mditor/static/mditor/js/mditor.min.js -> django-mditor-0.0.11/mditor/static/mditor/js
copying mditor/templates/mditor/widget.html -> django-mditor-0.0.11/mditor/templates/mditor
Writing django-mditor-0.0.11/setup.cfg
Creating tar archive
removing 'django-mditor-0.0.11' (and everything under it)
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=61.0)
* Getting dependencies for wheel...
running egg_info
writing django_mditor.egg-info/PKG-INFO
writing dependency_links to django_mditor.egg-info/dependency_links.txt
writing top-level names to django_mditor.egg-info/top_level.txt
reading manifest file 'django_mditor.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'django_mditor.egg-info/SOURCES.txt'
* Installing packages in isolated environment... (wheel)
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/mditor
copying mditor/configs.py -> build/lib/mditor
copying mditor/fields.py -> build/lib/mditor
copying mditor/__init__.py -> build/lib/mditor
copying mditor/widgets.py -> build/lib/mditor
copying mditor/urls.py -> build/lib/mditor
copying mditor/views.py -> build/lib/mditor
running egg_info
writing django_mditor.egg-info/PKG-INFO
writing dependency_links to django_mditor.egg-info/dependency_links.txt
writing top-level names to django_mditor.egg-info/top_level.txt
reading manifest file 'django_mditor.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'django_mditor.egg-info/SOURCES.txt'
creating build/lib/mditor/static
creating build/lib/mditor/static/mditor
creating build/lib/mditor/static/mditor/css
copying mditor/static/mditor/css/highlight.css -> build/lib/mditor/static/mditor/css
copying mditor/static/mditor/css/highlight.min.css -> build/lib/mditor/static/mditor/css
copying mditor/static/mditor/css/mditor.css -> build/lib/mditor/static/mditor/css
copying mditor/static/mditor/css/mditor.min.css -> build/lib/mditor/static/mditor/css
creating build/lib/mditor/static/mditor/js
copying mditor/static/mditor/js/mditor.js -> build/lib/mditor/static/mditor/js
copying mditor/static/mditor/js/mditor.min.js -> build/lib/mditor/static/mditor/js
creating build/lib/mditor/static/mditor/font
copying mditor/static/mditor/font/674f50d287a8c48dc19ba404d20fe713.eot -> build/lib/mditor/static/mditor/font
copying mditor/static/mditor/font/912ec66d7572ff821749319396470bde.svg -> build/lib/mditor/static/mditor/font
copying mditor/static/mditor/font/a48ac41620cd818c5020d0f4302489ff.ttf -> build/lib/mditor/static/mditor/font
copying mditor/static/mditor/font/af7ae505a9eed503f8b8e6982036873e.woff2 -> build/lib/mditor/static/mditor/font
copying mditor/static/mditor/font/b06871f281fee6b241d60582ae9369b9.ttf -> build/lib/mditor/static/mditor/font
copying mditor/static/mditor/font/fee66e712a8a08eef5805a46892932ad.woff -> build/lib/mditor/static/mditor/font
creating build/lib/mditor/templates
creating build/lib/mditor/templates/mditor
copying mditor/templates/mditor/widget.html -> build/lib/mditor/templates/mditor
installing to build/bdist.macosx-12-x86_64/wheel
running install
running install_lib
creating build/bdist.macosx-12-x86_64
creating build/bdist.macosx-12-x86_64/wheel
creating build/bdist.macosx-12-x86_64/wheel/mditor
copying build/lib/mditor/configs.py -> build/bdist.macosx-12-x86_64/wheel/mditor
copying build/lib/mditor/fields.py -> build/bdist.macosx-12-x86_64/wheel/mditor
copying build/lib/mditor/__init__.py -> build/bdist.macosx-12-x86_64/wheel/mditor
copying build/lib/mditor/widgets.py -> build/bdist.macosx-12-x86_64/wheel/mditor
creating build/bdist.macosx-12-x86_64/wheel/mditor/static
creating build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor
creating build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/css
copying build/lib/mditor/static/mditor/css/mditor.min.css -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/css
copying build/lib/mditor/static/mditor/css/highlight.css -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/css
copying build/lib/mditor/static/mditor/css/highlight.min.css -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/css
copying build/lib/mditor/static/mditor/css/mditor.css -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/css
creating build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/js
copying build/lib/mditor/static/mditor/js/mditor.min.js -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/js
copying build/lib/mditor/static/mditor/js/mditor.js -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/js
creating build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
copying build/lib/mditor/static/mditor/font/a48ac41620cd818c5020d0f4302489ff.ttf -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
copying build/lib/mditor/static/mditor/font/af7ae505a9eed503f8b8e6982036873e.woff2 -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
copying build/lib/mditor/static/mditor/font/674f50d287a8c48dc19ba404d20fe713.eot -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
copying build/lib/mditor/static/mditor/font/b06871f281fee6b241d60582ae9369b9.ttf -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
copying build/lib/mditor/static/mditor/font/912ec66d7572ff821749319396470bde.svg -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
copying build/lib/mditor/static/mditor/font/fee66e712a8a08eef5805a46892932ad.woff -> build/bdist.macosx-12-x86_64/wheel/mditor/static/mditor/font
creating build/bdist.macosx-12-x86_64/wheel/mditor/templates
creating build/bdist.macosx-12-x86_64/wheel/mditor/templates/mditor
copying build/lib/mditor/templates/mditor/widget.html -> build/bdist.macosx-12-x86_64/wheel/mditor/templates/mditor
copying build/lib/mditor/urls.py -> build/bdist.macosx-12-x86_64/wheel/mditor
copying build/lib/mditor/views.py -> build/bdist.macosx-12-x86_64/wheel/mditor
running install_egg_info
Copying django_mditor.egg-info to build/bdist.macosx-12-x86_64/wheel/django_mditor-0.0.11-py3.7.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-12-x86_64/wheel/django_mditor-0.0.11.dist-info/WHEEL
creating '/Volumes/Data/Dev/python/django-mditor/dist/tmp828s103b/django_mditor-0.0.11-py3-none-any.whl' and adding 'build/bdist.macosx-12-x86_64/wheel' to it
adding 'mditor/__init__.py'
adding 'mditor/configs.py'
adding 'mditor/fields.py'
adding 'mditor/urls.py'
adding 'mditor/views.py'
adding 'mditor/widgets.py'
adding 'mditor/static/mditor/css/highlight.css'
adding 'mditor/static/mditor/css/highlight.min.css'
adding 'mditor/static/mditor/css/mditor.css'
adding 'mditor/static/mditor/css/mditor.min.css'
adding 'mditor/static/mditor/font/674f50d287a8c48dc19ba404d20fe713.eot'
adding 'mditor/static/mditor/font/912ec66d7572ff821749319396470bde.svg'
adding 'mditor/static/mditor/font/a48ac41620cd818c5020d0f4302489ff.ttf'
adding 'mditor/static/mditor/font/af7ae505a9eed503f8b8e6982036873e.woff2'
adding 'mditor/static/mditor/font/b06871f281fee6b241d60582ae9369b9.ttf'
adding 'mditor/static/mditor/font/fee66e712a8a08eef5805a46892932ad.woff'
adding 'mditor/static/mditor/js/mditor.js'
adding 'mditor/static/mditor/js/mditor.min.js'
adding 'mditor/templates/mditor/widget.html'
adding 'django_mditor-0.0.11.dist-info/LICENSE'
adding 'django_mditor-0.0.11.dist-info/METADATA'
adding 'django_mditor-0.0.11.dist-info/WHEEL'
adding 'django_mditor-0.0.11.dist-info/top_level.txt'
adding 'django_mditor-0.0.11.dist-info/RECORD'
removing build/bdist.macosx-12-x86_64/wheel
Successfully built django-mditor-0.0.11.tar.gz and django_mditor-0.0.11-py3-none-any.whl
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185

至此 已经在 dist目录下生成了 django-mditor-0.0.11.tar.gz and django_mditor-0.0.11-py3-none-any.whl,以及 django_mditor.egg-info

发布

$ python3 -m twine upload --repository pypi dist/*

Uploading distributions to https://upload.pypi.org/legacy/
Uploading django_mditor-0.0.11-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 762.8/762.8 kB • 00:02 • 522.9 kB/s
Uploading django-mditor-0.0.11.tar.gz
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 759.8/759.8 kB • 00:00 • 18.5 MB/s

View at:
https://pypi.org/project/django-mditor/0.0.11/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

安装

至此,大约1分钟后就可以通过 pip install django-mditor 来安装了

$ pip show django-mditor     
Name: django-mditor
Version: 0.0.11
Summary: 描述
Home-page: 
Author: 
Author-email: 敬晓兵 <ju4t@qq.com>
License: MIT License
Location: /Users/ju4t/.virtualenvs/django-mditor/lib/python3.7/site-packages
Requires: 
Required-by: 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

但是国内镜像更新没有那么快,所以使用镜像加速的暂时不行。

也可以在本地配置好镜像加速后,通过 pip install django-mditor==0.0.11 指定版本号的方法来触发更新,更新时间不确定。

当 https://mirrors.aliyun.com/pypi/simple/django-mditor/ 有安装包后 就可以通过 加速镜像 安装了

注意内容

构建及发布时确保网络正常,推荐使用国内镜像
macOS 阿里云配置如下 ~/.pip/pip.conf

[global]
index-url=https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com
  • 1
  • 2
  • 3
  • 4
  • 5

转载自:https://labdoc.cc/article/8/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/505969?site
推荐阅读
相关标签
  

闽ICP备14008679号