Skip to content

Commit

Permalink
Add support for Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
seanh committed Aug 31, 2022
1 parent 9f176d2 commit 3df6a5b
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .cookiecutter/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"package_name": "pip_sync_faster",
"slug": "pip-sync-faster",
"short_description": "A wrapper that makes pip-sync faster.",
"python_versions": "3.10.4, 3.9.12, 3.8.13",
"python_versions": "3.10.4, 3.9.12, 3.8.13, 3.7.13",
"github_owner": "hypothesis",
"copyright_holder": "Hypothesis",
"public": "yes",
Expand Down
1 change: 1 addition & 0 deletions .cookiecutter/includes/setuptools/install_requires
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pip-tools
importlib_metadata;python_version<"3.8."
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.9', '3.8']
python-version: ['3.10', '3.9', '3.8', '3.7']
name: Unit tests with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.9', '3.8']
python-version: ['3.10', '3.9', '3.8', '3.7']
name: Functional tests with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
3.10.4
3.9.12
3.8.13
3.7.13
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ coverage: test-py38
test-py38: python
@pyenv exec tox -qe py38-tests

.PHONY: test-py37
$(call help,make test-py37,"run the unit tests in Python 3.7")
coverage: test-py37
test-py37: python
@pyenv exec tox -qe py37-tests

.PHONY: coverage
$(call help,make coverage,"run the tests and print the coverage report")
coverage: python
Expand All @@ -66,11 +72,16 @@ $(call help,make functests-py38,"run the functional tests in Python 3.8")
functests-py38: python
@pyenv exec tox -qe py38-functests

.PHONY: functests-py37
$(call help,make functests-py37,"run the functional tests in Python 3.7")
functests-py37: python
@pyenv exec tox -qe py37-functests

.PHONY: sure
$(call help,make sure,"make sure that the formatting$(comma) linting and tests all pass")
sure: python
sure:
@pyenv exec tox --parallel -qe 'checkformatting,lint,tests,py{39,38}-tests,coverage,functests,py{39,38}-functests'
@pyenv exec tox --parallel -qe 'checkformatting,lint,tests,py{39,38,37}-tests,coverage,functests,py{39,38,37}-functests'

.PHONY: template
$(call help,make template,"update from the latest cookiecutter template")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a href="https://github.com/hypothesis/pip-sync-faster/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://img.shields.io/github/workflow/status/hypothesis/pip-sync-faster/CI/main"></a>
<a href="https://pypi.org/project/pip-sync-faster"><img src="https://img.shields.io/pypi/v/pip-sync-faster"></a>
<a><img src="https://img.shields.io/badge/python-3.10 | 3.9 | 3.8-success"></a>
<a><img src="https://img.shields.io/badge/python-3.10 | 3.9 | 3.8 | 3.7-success"></a>
<a href="https://github.com/hypothesis/pip-sync-faster/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-BSD--2--Clause-success"></a>
<a href="https://github.com/hypothesis/cookiecutters/tree/main/pypackage"><img src="https://img.shields.io/badge/cookiecutter-pypackage-success"></a>
<a href="https://black.readthedocs.io/en/stable/"><img src="https://img.shields.io/badge/code%20style-black-000000"></a>
Expand Down
2 changes: 1 addition & 1 deletion bin/make_python
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ -n "${CI+x}" ]; then exit; fi

pyenv_root=$(pyenv root)

for python_version in 3.10.4 3.9.12 3.8.13; do
for python_version in 3.10.4 3.9.12 3.8.13 3.7.13; do
bin_dir=$pyenv_root/versions/$python_version/bin
if [ ! -f "$bin_dir"/tox ]; then
pyenv install --skip-existing "$python_version"
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ classifiers =
package_dir =
= src
packages = find:
python_requires = >=3.8
python_requires = >=3.7
install_requires =
pip-tools
importlib_metadata;python_version<"3.8."

[options.packages.find]
where = src
Expand Down
6 changes: 5 additions & 1 deletion src/pip_sync_faster/cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from argparse import ArgumentParser
from importlib.metadata import version
from subprocess import CalledProcessError

from pip_sync_faster.sync import sync

try:
from importlib.metadata import version
except ModuleNotFoundError:
from importlib_metadata import version


def cli(_argv=None): # pylint:disable=inconsistent-return-statements
parser = ArgumentParser(
Expand Down
6 changes: 5 additions & 1 deletion tests/unit/pip_sync_faster/cli_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from importlib.metadata import version
from subprocess import CalledProcessError

import pytest

from pip_sync_faster.cli import cli

try:
from importlib.metadata import version
except ModuleNotFoundError:
from importlib_metadata import version


def test_cli(sync):
exit_code = cli(["requirements/dev.txt", "--foo", "bar"])
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ deps =
lint,tests,functests: h-matchers
lint,template: cookiecutter
depends =
coverage: tests,py{39,38}-tests
coverage: tests,py{39,38,37}-tests
commands =
dev: {posargs:ipython --classic --no-banner --no-confirm-exit}
format: black src tests bin
Expand Down

0 comments on commit 3df6a5b

Please sign in to comment.