在将软件包上传到pypicloud之前更新setup.py中的版本

时间:2020-02-21 09:42:00

标签: python file pypi

我正在将python软件包自动部署到pypicloud。为此,我需要在创建和上传软件包之前更新setup.py文件,并将版本增加1。寻找使用python中简单文件处理的解决方案。其他线索也有帮助。

setup.py

的内容
from setuptools import setup, find_packages

setup(
    name='XXX',
    packages=find_packages(exclude=('tests')),
    description='ABC',
    # change to version='0.2.3'
    version='0.2.2',
    include_package_data=True,
    install_requires=["numpy==1.16.0", "pandas==0.23.3", "exrex==0.10.5",
                      "pymongo==3.5.1", "requests==2.18.4", "elasticsearch==6.1.1",
                      "jellyfish==0.6.1", "roman==3.1", "python_Levenshtein==0.12.0",
                      "findspark==1.3.0", "pyspark==2.4.4", "py4j==0.10.7"]
)

1 个答案:

答案 0 :(得分:1)

您可以为此使用bump软件包:

$ bump
1.0.1

$ git diff setup.py
─────────────────────────────────────────────────
modified: setup.py
─────────────────────────────────────────────────
@ setup.py:6 @ from setuptools import setup

setup(
    name='bump',
-    version='1.0.0',
+    version='1.0.1',
    description='Bumps package version numbers',
    long_description=open('README.rst').read(),
    license='MIT',