diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 491351b..0acc876 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,8 +31,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install -e .[dev] - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -50,10 +49,12 @@ jobs: if: env.COVERAGE == 1 run: | coverage run -m unittest tests/*.py - - name: Coverage + coverage xml + - name: Upload coverage to Codecov env: COVERAGE: ${{ matrix.coverage }} if: env.COVERAGE == 1 - run: | - bash <(curl -s https://codecov.io/bash) - rm .coverage coverage.xml + uses: codecov/codecov-action@v4 + with: + file: ./coverage.xml + fail_ci_if_error: false diff --git a/pyproject.toml b/pyproject.toml index 19d6cc9..4392b9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,12 +17,9 @@ readme = "README.md" requires-python = ">=3.8" dependencies = [ "multidimensional-urlencode==0.0.4", - "nose==1.3.7", "requests==2.32.4", - "coverage==4.5.4", - "pook==1.3.0", - "hatchling >= 1.26" ] + classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", @@ -39,7 +36,15 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] license = "MIT" -license-files = ["LICEN[CS]E*"] +license-files = ["LICENSE"] + +[project.optional-dependencies] +dev = [ + "nose==1.3.7", + "coverage==4.5.4", + "pook==1.3.0", + "flake8", +] [project.urls] Homepage = "https://github.com/retailcrm/api-client-python" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 508eb50..0000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -multidimensional-urlencode==0.0.4 -nose==1.3.7 -requests==2.32.4 -coverage==4.5.4 -pook==1.3.0 -setuptools<81 -hatchling >= 1.26 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d8e9a6f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[metadata] -# This includes the license file(s) in the wheel. -# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file -license_files = LICENSE \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 2778cf1..0000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 - -""" -Setup file -""" - -import os -from setuptools import setup - - -def read(filename): - """Read readme for long description""" - return open(os.path.join(os.path.dirname(__file__), filename)).read() - - -setup( - name='retailcrm', - version='5.2.0', - description='RetailCRM API client', - long_description=read('README'), - url='https://github.com/retailcrm/api-client-python', - author='RetailCRM', - author_email='support@retailcrm.pro', - keywords='crm saas rest e-commerce', - license='MIT', - packages=['retailcrm', 'retailcrm/versions'], - package_data={}, - install_requires=['requests', 'multidimensional_urlencode', 'nose', 'coverage', 'pook', 'setuptools', 'hatchling'], - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Other Environment', - 'Intended Audience :: Developers', - 'Operating System :: OS Independent', - '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 :: Only', - 'Topic :: Software Development :: Libraries :: Python Modules', - ] -) diff --git a/tests/v5_tests.py b/tests/v5_tests.py index 81129a0..dfe72c8 100644 --- a/tests/v5_tests.py +++ b/tests/v5_tests.py @@ -4085,45 +4085,45 @@ def test_offers(self): """ (pook.get(os.getenv('RETAILCRM_URL') + '/api/v5/store/offers') - .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) - .params({'filter[site]': 'https://retailcrm.pro'}) - .reply(200) - .headers(self.__header) - .json( - { - 'success': 'true', - 'pagination': { - 'limit': 20, - 'totalCount': 1, - 'currentPage': 1, - 'totalPageCount': 1 - }, - 'offers': [ - { - 'images': [], - 'id': 33937, - 'site': 'https://retailcrm.pro', - 'name': 'Shirt', - 'article': 'SHIRT-BLACK', - 'prices': { - "priceType": "base", - "price": 4, - "ordering": 100, - "currency": "EUR" - }, - 'purchasePrice': 1, - 'vatRate': 'none', - 'product': {}, - 'properties': { - 'color': 'black' - }, - 'quantity': 10, - 'active': True, - 'barcode': '12345' - } - ] - } - ) + .headers({'X-API-KEY': os.getenv('RETAILCRM_KEY')}) + .params({'filter[site]': 'https://retailcrm.pro'}) + .reply(200) + .headers(self.__header) + .json( + { + 'success': 'true', + 'pagination': { + 'limit': 20, + 'totalCount': 1, + 'currentPage': 1, + 'totalPageCount': 1 + }, + 'offers': [ + { + 'images': [], + 'id': 33937, + 'site': 'https://retailcrm.pro', + 'name': 'Shirt', + 'article': 'SHIRT-BLACK', + 'prices': { + "priceType": "base", + "price": 4, + "ordering": 100, + "currency": "EUR" + }, + 'purchasePrice': 1, + 'vatRate': 'none', + 'product': {}, + 'properties': { + 'color': 'black' + }, + 'quantity': 10, + 'active': True, + 'barcode': '12345' + } + ] + } + ) ) response = self.client.offers({'site': 'https://retailcrm.pro'})