From ba5149fcdf9b8c1e8cc8ec7d1d0db4dcdeacbf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20B=C3=A1nffy?= Date: Sat, 15 Apr 2023 13:38:50 +0100 Subject: [PATCH] Merge develop (#66) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump version to 1.0.1 * Fix failing Flake8 test * Update history * Add --no-chill command line option. Fixes #34 * Remove click and add black to the requirements file * Version update * Remove black - not a dev requirement * 'Refactored by Sourcery' (#37) Co-authored-by: Sourcery AI <> * Update python-package.yml (#33) * Circleci project setup (#39) * Add .circleci/config.yml * Add .circleci/config.yml * Add .circleci/config.yml * Update README with --no-chill switch * Update HISTORY and bump versions * Remove __future__ import (we don't need it anymore) * We only support Python 3+ * Add `ssort` * Sort methods with `ssort` * Version bump * Remove Python 3.5 support * Remove Python 3.6 support and move 3.10 out of dev * Upgrade macOS image to 13.2 (Xcode 13.2.1) * Time `tox` execution * Update HISTORY.rst * Update supported Python versions * Update Python image version * Update HISTORY.rst Bump version from current to 1.0.3 * Update config.yml Use new Docker environment * Update config.yml Return to the Python orb approach * Added note so contributors start from the develop branch * Remove support for 3.6 in tests, add 3.10, 3.11 * Update pip before installing travis-tox * Add Python 3.11 to some platforms in travis * Resolve: Inconsistent sort for "Installed as dependency for" (#64) * Added a --no-chill option (#36) * Bump version to 1.0.1 * Fix failing Flake8 test * Update history * Add --no-chill command line option. Fixes #34 * Remove click and add black to the requirements file * Version update * Remove black - not a dev requirement * 'Refactored by Sourcery' (#37) Co-authored-by: Sourcery AI <> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Version 1.0.1 (#40) * Bump version to 1.0.1 * Fix failing Flake8 test * Update history * Add --no-chill command line option. Fixes #34 * Remove click and add black to the requirements file * Version update * Remove black - not a dev requirement * 'Refactored by Sourcery' (#37) Co-authored-by: Sourcery AI <> * Update python-package.yml (#33) * Circleci project setup (#39) * Add .circleci/config.yml * Add .circleci/config.yml * Add .circleci/config.yml * Update README with --no-chill switch Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update github repo url (#50) * Fix GitHub repo URL (#56) Will fix Travis tests later * Sort required_by * Update README to match new output * Update github repo url (#50) * Fix GitHub repo URL (#56) Will fix Travis tests later * Sort required_by * Update README to match new output * Add to AUTHORS --------- Co-authored-by: Ricardo Bánffy Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: AndrejK <38130665+andrejkurusiov@users.noreply.github.com> Co-authored-by: xatier * 'Refactored by Sourcery' (#67) Co-authored-by: Sourcery AI <> * Fix Flake8 flagged issues * Apply Black * Fix version numbers * Fix f-strings --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: Kevin Paulson Co-authored-by: AndrejK <38130665+andrejkurusiov@users.noreply.github.com> Co-authored-by: xatier Co-authored-by: Ricardo Bánffy --- .circleci/config.yml | 2 +- .github/workflows/python-package.yml | 2 +- .travis.yml | 53 ++++++++-------------------- AUTHORS.rst | 1 + CONTRIBUTING.rst | 10 +++--- HISTORY.rst | 9 +++++ README.rst | 2 +- pip_chill/cli.py | 5 +-- pip_chill/pip_chill.py | 35 +++++++++--------- requirements_dev.txt | 1 + setup.cfg | 2 +- setup.py | 6 ++-- tests/test_pip_chill.py | 2 +- tox.ini | 2 +- 14 files changed, 60 insertions(+), 72 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c0e6eb..6e5b146 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 orbs: - python: circleci/python@0.2.1 +python: circleci/python@2.1.1 jobs: build-and-test: diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7cd366f..178757e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.5', '3.6', '3.7', '3.8', '3.9'] + python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v2 diff --git a/.travis.yml b/.travis.yml index e8d4b9d..de7ee0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,23 +3,20 @@ # command to install dependencies, e.g. pip install -r requirements.txt install: - - pip install tox-travis - pip install --upgrade pip + - pip install tox-travis # command to run tests, e.g. python setup.py test -script: tox +script: time tox # Globals language: python dist: focal os: linux +osx_image: xcode13.2 jobs: include: - - arch: amd64 - python: 3.5 - - arch: amd64 - python: 3.6 - arch: amd64 python: 3.7 - arch: amd64 @@ -27,12 +24,10 @@ jobs: - arch: amd64 python: 3.9 - arch: amd64 - python: 3.10-dev + python: 3.10 + - arch: amd64 + python: 3.11 - - arch: arm64 - python: 3.5 - - arch: arm64 - python: 3.6 - arch: arm64 python: 3.7 - arch: arm64 @@ -40,14 +35,11 @@ jobs: - arch: arm64 python: 3.9 - arch: arm64 - python: 3.10-dev + python: 3.10 + - arch: arm64 + python: 3.11 - arch: ppc64le - python: 3.5 - - arch: ppc64le - python: 3.6 - - arch: ppc64le - dist: bionic python: 3.7 - arch: ppc64le python: 3.8 @@ -55,11 +47,6 @@ jobs: python: 3.9 - arch: s390x - python: 3.5 - - arch: s390x - python: 3.6 - - arch: s390x - dist: bionic python: 3.7 - arch: s390x python: 3.8 @@ -68,31 +55,21 @@ jobs: - os: osx language: generic - osx_image: xcode12.2 - python: 3.5 - env: PYTHON=3.5 - - os: osx - language: generic - osx_image: xcode12.2 - python: 3.6 - env: PYTHON=3.6 - - os: osx - language: generic - osx_image: xcode12.2 python: 3.7 env: PYTHON=3.7 - os: osx language: generic - osx_image: xcode12.2 python: 3.8 env: PYTHON=3.8 - os: osx language: generic - osx_image: xcode12.2 python: 3.9 env: PYTHON=3.9 - os: osx language: generic - osx_image: xcode12.2 - python: 3.10-dev - env: PYTHON=3.10-dev + python: 3.10 + env: PYTHON=3.10 + - os: osx + language: generic + python: 3.11 + env: PYTHON=3.11 diff --git a/AUTHORS.rst b/AUTHORS.rst index 30b04c8..b604187 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -10,5 +10,6 @@ Development Lead Contributors ------------ +* Kevin Paulson https://github.com/kjwpaulson * Luke Skibinski https://github.com/lsh-0 * Piotr Surowiec https://github.com/Agrendalath diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index bd125e2..7d15e73 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -26,8 +26,9 @@ If you are reporting a bug, please include: Fix Bugs ~~~~~~~~ -Look through the GitHub issues for bugs. Anything tagged with "bug" -and "help wanted" is open to whoever wants to implement it. +Look through the GitHub issues for bugs. Anything tagged with "bug" and "help +wanted" is open to whoever wants to implement it. Remember to start from the +`develop` branch. Implement Features ~~~~~~~~~~~~~~~~~~ @@ -101,8 +102,8 @@ Before you submit a pull request, check that it meets these guidelines: 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. -3. The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check - https://travis-ci.org/rbanffy/pip-chill/pull_requests +3. The pull request should work for Python 3.7+, and for PyPy. Check + https://travis-ci.org/rbanffy/pip_chill/pull_requests and make sure that the tests pass for all supported Python versions. Tips @@ -110,5 +111,4 @@ Tips To run a subset of tests:: - $ python -m unittest tests.test_pip_chill diff --git a/HISTORY.rst b/HISTORY.rst index e5d0401..e9f71a3 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,15 @@ History ======= +1.0.2 (2023-04-15) +------------------ +* Sort dependencies alphabetically in --verbose +* Use `ssort` to topologically sort code +* Update 3.11-dev to 3.11 on TravisCI +* Remove support for Python 3.5 and 3.6 +* Update README.rst with --no-chill switch +* Bump version to 1.0.2 + 1.0.1 (2021-01-18) ------------------ diff --git a/README.rst b/README.rst index 8eae772..41b274b 100644 --- a/README.rst +++ b/README.rst @@ -112,7 +112,7 @@ Or, if you want to list package dependencies too:: # chardet==4.0.0 # Installed as dependency for requests # colorama==0.4.4 # Installed as dependency for twine # distlib==0.3.1 # Installed as dependency for virtualenv - # docutils==0.16 # Installed as dependency for sphinx, readme-renderer + # docutils==0.16 # Installed as dependency for readme-renderer, sphinx # filelock==3.0.12 # Installed as dependency for tox, virtualenv # gitdb==4.0.5 # Installed as dependency for gitpython ... diff --git a/pip_chill/cli.py b/pip_chill/cli.py index 31a3c37..87a8b69 100755 --- a/pip_chill/cli.py +++ b/pip_chill/cli.py @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from __future__ import print_function +#!/usr/bin/env python3 import argparse diff --git a/pip_chill/pip_chill.py b/pip_chill/pip_chill.py index f1bdcf3..5b3dcc0 100644 --- a/pip_chill/pip_chill.py +++ b/pip_chill/pip_chill.py @@ -19,22 +19,14 @@ def get_name_without_version(self): Return the name of the package without a version. """ if self.required_by: - return "# {} # Installed as dependency for {}".format( - self.name, ", ".join(self.required_by) + return ( + f"# {self.name} # Installed as dependency for " + f"{', '.join(sorted(self.required_by))}" ) return self.name - def __str__(self): - if self.required_by: - return "# {}=={} # Installed as dependency for {}".format( - self.name, self.version, ", ".join(self.required_by) - ) - return "{}=={}".format(self.name, self.version) - - def __repr__(self): - return '<{}.{} instance "{}">'.format( - self.__module__, self.__class__.__name__, self.name - ) + def __lt__(self, other): + return self.name < other.name def __eq__(self, other): if self is other: @@ -44,12 +36,23 @@ def __eq__(self, other): else: return self.name == other - def __lt__(self, other): - return self.name < other.name - def __hash__(self): return hash(self.name) + def __repr__(self): + return ( + f'<{self.__module__}.{self.__class__.__name__} instance "' + f'{self.name}">' + ) + + def __str__(self): + if self.required_by: + return ( + f"# {self.name}=={self.version} # Installed as " + f"dependency for {', '.join(sorted(self.required_by))}" + ) + return f"{self.name}=={self.version}" + def chill(show_all=False, no_chill=False): if show_all: diff --git a/requirements_dev.txt b/requirements_dev.txt index 9772a31..477ef9a 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -5,6 +5,7 @@ flake8 nose pytest sphinx +ssort tox twine watchdog diff --git a/setup.cfg b/setup.cfg index 71e489d..b8480e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.1 +current_version = 1.0.2 commit = True tag = True diff --git a/setup.py b/setup.py index 42d4289..7f78069 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name="pip-chill", - version="1.0.1", + version="1.0.2", description="Like `pip freeze` but lists only the packages that are not " "dependencies of installed packages.", long_description=readme + "\n\n" + history, @@ -39,11 +39,11 @@ "OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", "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", "Topic :: Software Development", ], test_suite="tests", diff --git a/tests/test_pip_chill.py b/tests/test_pip_chill.py index 51b2e9b..30d558d 100644 --- a/tests/test_pip_chill.py +++ b/tests/test_pip_chill.py @@ -110,7 +110,7 @@ def test_command_line_interface_omits_ignored(self): result = os.popen(command).read() for package in ["wheel", "setuptools", "pip"]: - self.assertFalse(any(p.startswith(package + "==") for p in result.split("\n"))) + self.assertFalse(any(p.startswith(f"{package}==") for p in result.split("\n"))) def test_command_line_interface_all(self): command = "pip_chill/cli.py --all" diff --git a/tox.ini b/tox.ini index 3484b8b..359a5a0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, py37, py38, py39, bandit, flake8 +envlist = py37, py38, py39, py310, py311, bandit, flake8 [testenv:bandit] basepython=python3