diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 5b6aaf7..c3318e8 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -19,23 +19,25 @@ jobs: python-version: [3.8, 3.9, "3.10", 3.11] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 + pip install flake8 isort pip install -r requirements.txt - name: Lint with flake8 run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + flake8 . --max-complexity=10 --max-line-length=127 + - name: Verify sorted imports + run: | + isort . -m HANGING_INDENT -l 120 --check-only - name: Test installation + run: | python3 -m pip install . - name: Test usage + run: | python3 -m pyipsw diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3bd2eb8..fec1972 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -13,19 +13,19 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install setuptools wheel twine build - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/* \ No newline at end of file diff --git a/pyipsw/cli.py b/pyipsw/cli.py index 7c78f9c..1219665 100644 --- a/pyipsw/cli.py +++ b/pyipsw/cli.py @@ -1,7 +1,7 @@ import click from humanfriendly.tables import format_smart_table -from pyipsw.pyipsw import get_devices, DEVICES_FIELDS, get_itunes, ITUNES_FIELDS, download_devices +from pyipsw.pyipsw import DEVICES_FIELDS, ITUNES_FIELDS, download_devices, get_devices, get_itunes DEFAULT_DEVICES_COLUMNS = ['device', 'version', 'buildid', 'filename'] DEFAULT_ITUNES_COLUMNS = ['os', 'version', 'releasedate', 'url'] diff --git a/pyipsw/pyipsw.py b/pyipsw/pyipsw.py index 8242135..6e5e0a0 100644 --- a/pyipsw/pyipsw.py +++ b/pyipsw/pyipsw.py @@ -1,9 +1,9 @@ -from functools import lru_cache import hashlib import os +from functools import lru_cache -from tqdm import tqdm import requests +from tqdm import tqdm IPSW_API_FIRMWARES_JSON = 'https://api.ipsw.me/v2.1/firmwares.json/condensed' DEVICES_FIELDS = ['device', 'name', 'version', 'buildid', 'url', 'uploaddate', 'size', 'signed', 'sha1sum', diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1ae134c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[project] +name = "pyipsw" +version = "2.0.3" +description = "utility created in order to access ipsw.me data easily using python/cli" +readme = "README.md" +requires-python = ">=3.8" +license = { file = "LICENSE" } +keywords = ["ios", "ipsw", "firmware", "cli"] +authors = [ + { name = "matan1008", email = "matan1008@gmail.com" } +] +maintainers = [ + { name = "matan1008", email = "matan1008@gmail.com" } +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "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 :: Only", +] +dynamic = ["dependencies"] + +[project.optional-dependencies] +test = ["pytest"] + +[project.urls] +"Homepage" = "https://github.com/matan1008/pyipsw" +"Bug Reports" = "https://github.com/matan1008/pyipsw/issues" + +[project.scripts] +pyipsw = "pyipsw.__main__:cli" + +[tool.setuptools.packages.find] +exclude = ["docs*", "tests*"] + +[tool.setuptools.dynamic] +dependencies = { file = ["requirements.txt"] } + +[build-system] +requires = ["setuptools>=43.0.0", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py deleted file mode 100644 index 2c3ad43..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -import os - -from setuptools import setup, find_packages - -BASE_DIR = os.path.realpath(os.path.dirname(__file__)) -VERSION = '0.0.1' - - -def parse_requirements(): - reqs = [] - if os.path.isfile(os.path.join(BASE_DIR, 'requirements.txt')): - with open(os.path.join(BASE_DIR, 'requirements.txt'), 'r') as fd: - for line in fd.readlines(): - line = line.strip() - if line: - reqs.append(line) - return reqs - - -def get_description(): - with open(os.path.join(BASE_DIR, 'README.md'), 'r') as fh: - return fh.read() - - -if __name__ == '__main__': - setup( - version=VERSION, - name='pyipsw', - description='Utility for querying ipsw.me data', - long_description=get_description(), - long_description_content_type='text/markdown', - packages=find_packages(), - author='Matan Perelman', - install_requires=parse_requirements(), - entry_points={ - 'console_scripts': ['pyipsw=pyipsw.__main__:cli'], - }, - classifiers=[ - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - ], - url='https://github.com/matan1008/pyipsw', - project_urls={ - 'pyipsw': 'https://github.com/matan1008/pyipsw' - }, - tests_require=['pytest'], - )