diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 99c368b..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[bumpversion] -current_version = 0.25.0 -commit = True -message = Update version {current_version} -> {new_version} - -[bumpversion:file:ibm_vpc/version.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bumpversion:file:setup.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bumpversion:file:README.md] -search = {current_version} -replace = {new_version} diff --git a/.bumpversion.toml b/.bumpversion.toml new file mode 100644 index 0000000..b2fe772 --- /dev/null +++ b/.bumpversion.toml @@ -0,0 +1,19 @@ +[tool.bumpversion] +current_version = "0.25.0" +commit = true +message = "Update version {current_version} -> {new_version}" + +[[tool.bumpversion.files]] +filename = "ibm_vpc/version.py" +search = "__version__ = '{current_version}'" +replace = "__version__ = '{new_version}'" + +[[tool.bumpversion.files]] +filename = "pyproject.toml" +search = "version = \"{current_version}\"" +replace = "version = \"{new_version}\"" + +[[tool.bumpversion.files]] +filename = "README.md" +search = "{current_version}" +replace = "{new_version}" \ No newline at end of file diff --git a/.releaserc b/.releaserc index 0454486..703fb5a 100644 --- a/.releaserc +++ b/.releaserc @@ -7,7 +7,7 @@ [ "@semantic-release/exec", { - "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" + "prepareCmd": "bump-my-version bump --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" } ], [ diff --git a/.travis.yml b/.travis.yml index fc50f2c..b8ec14f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ install: script: tox before_deploy: -- pip install bump2version +- pip install bump-my-version - nvm install --lts - npm install @semantic-release/changelog - npm install @semantic-release/exec diff --git a/Makefile b/Makefile index 51e4ffe..cbe845e 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -setup: deps dev_deps install +setup: deps dev-deps install deps: - pip install -r requirements.txt + pip install . -dev_deps: - pip install -r requirements-dev.txt +dev-deps: + pip install .[dev] install: pip install -e . @@ -15,6 +15,12 @@ unit-test: test-int: pytest -v test/integration --capture=tee-sys - test-examples: - pytest -v examples/test_vpc_v1_examples.py -rs --capture=tee-sys \ No newline at end of file + pytest -v examples/test_vpc_v1_examples.py -rs --capture=tee-sys + +lint: + pylint ibm_vpc test examples --exit-zero + black --check ibm_vpc test examples test + +lint-fix: + black ibm_vpc test examples \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ea45b70 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,94 @@ +[project] +name = "ibm-vpc" +version = "0.0.1" +authors = [ + { name="IBM", email="devxsdk@us.ibm.com" } +] +description = "Python client library for IBM Cloud ibm-vpc Services" +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Software Development :: Libraries :: Application Frameworks", +] +keywords=["ibm", "cloud", "ibm cloud services", "vpc" ] +dependencies = [ + "ibm_cloud_sdk_core>=3.22.0", + "python_dateutil>=2.5.3,<3.0.0", +] + +[project.urls] +Repository = "https://github.ibm.com/ibmcloud/vpc-python-sdk" +Documentation = "https://github.ibm.com/ibmcloud/vpc-python-sdk/blob/master/README.md" +Issues = "https://github.ibm.com/ibmcloud/vpc-python-sdk/issues" +Contributing = "https://github.ibm.com/ibmcloud/vpc-python-sdk/blob/master/CONTRIBUTING.md" +License = "https://github.ibm.com/ibmcloud/vpc-python-sdk/blob/master/LICENSE" + +[project.optional-dependencies] +dev = [ + "coverage>=7.3.2,<8.0.0", + "pylint>=3.0.0,<4.0.0", + "pytest>=7.4.2,<8.0.0", + "pytest-cov>=4.1.0,<5.0.0", + "responses>=0.23.3,<1.0.0", + "black>=24.0.0,<25.0.0", + "pytest-rerunfailures>=12.0", + "tox>=4.12.0,<4.23.2", +] +publish = [ + "build", + "twine" +] + +[build-system] +requires = ["setuptools>=67.7.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["ibm_vpc"] + +[tool.black] +line-length = 120 +skip-string-normalization = true + +[tool.tox] +legacy_tox_ini = """ +[tox] +envlist = py37-lint, py37, py38, py39 + +[testenv:py37-lint] +basepython = python3.7 +deps = pylint +commands = pylint --rcfile=.pylintrc ibm-vpc test/unit + +[testenv] +passenv = TOXENV CI TRAVIS* +commands = + pytest -v test/unit + +deps = + pylint + pytest + pytest-cov + responses + pytest-rerunfailures + ibm_cloud_sdk_core + python_dateutil + +usedevelop = True +exclude = .venv,.git,.tox,docs +""" \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index ee9c4c5..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,8 +0,0 @@ -# test dependencies -coverage>=7.3.2 -pylint>=3.0.0,<4.0.0 -pytest>=7.4.2,<8.0.0 -pytest-cov>=4.1.0,<5.0.0 -pytest-rerunfailures>=12.0 -responses>=0.23.3,<1.0.0 -tox>=4.12.0,<4.23.2 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 77864b1..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -python_dateutil>=2.5.3,<3.0.0 -ibm_cloud_sdk_core>=3.22.0 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 677aee2..0000000 --- a/setup.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016 IBM All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from setuptools import setup -from setuptools.command.test import test as TestCommand -import os -import sys -import pkg_resources - -__version__ = '0.25.0' -PACKAGE_NAME = 'ibm_vpc' -PACKAGE_DESC = 'Python client library for IBM Cloud VPC Services' - -with open('requirements.txt') as f: - install_requires = [str(req) for req in pkg_resources.parse_requirements(f)] -with open('requirements-dev.txt') as f: - tests_require = [str(req) for req in pkg_resources.parse_requirements(f)] - -if sys.argv[-1] == 'publish': - # test server - os.system('python setup.py register -r pypitest') - os.system('python setup.py sdist upload -r pypitest') - - # production server - os.system('python setup.py register -r pypi') - os.system('python setup.py sdist upload -r pypi') - sys.exit() - -class PyTest(TestCommand): - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = ['--strict', '--verbose', '--tb=long', 'test'] - self.test_suite = True - - def run_tests(self): - import pytest - errcode = pytest.main(self.test_args) - sys.exit(errcode) - -class PyTestUnit(PyTest): - def finalize_options(self): - self.test_args = ['--strict', '--verbose', '--tb=long', 'test/unit'] - -class PyTestIntegration(PyTest): - def finalize_options(self): - self.test_args = ['--strict', '--verbose', '--tb=long', 'test/integration'] - -with open("README.md", "r") as fh: - readme = fh.read() - -setup(name=PACKAGE_NAME.replace('_', '-'), - version=__version__, - description=PACKAGE_DESC, - license='Apache 2.0', - install_requires=install_requires, - tests_require=tests_require, - cmdclass={'test': PyTest, 'test_unit': PyTestUnit, 'test_integration': PyTestIntegration}, - author='IBM', - author_email='vpcui@us.ibm.com', - long_description=readme, - long_description_content_type='text/markdown', - url='https://github.com/IBM/vpc-python-sdk', - packages=[PACKAGE_NAME], - include_package_data=True, - keywords=PACKAGE_NAME, - classifiers=[ - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Software Development :: Libraries :: Application Frameworks', - ], - zip_safe=True - )