Skip to content

Commit 3df6a5b

Browse files
committed
Add support for Python 3.7
1 parent 9f176d2 commit 3df6a5b

File tree

11 files changed

+32
-10
lines changed

11 files changed

+32
-10
lines changed

.cookiecutter/cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"package_name": "pip_sync_faster",
88
"slug": "pip-sync-faster",
99
"short_description": "A wrapper that makes pip-sync faster.",
10-
"python_versions": "3.10.4, 3.9.12, 3.8.13",
10+
"python_versions": "3.10.4, 3.9.12, 3.8.13, 3.7.13",
1111
"github_owner": "hypothesis",
1212
"copyright_holder": "Hypothesis",
1313
"public": "yes",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pip-tools
2+
importlib_metadata;python_version<"3.8."

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
python-version: ['3.10', '3.9', '3.8']
32+
python-version: ['3.10', '3.9', '3.8', '3.7']
3333
name: Unit tests with Python ${{ matrix.python-version }}
3434
steps:
3535
- uses: actions/checkout@v3
@@ -63,7 +63,7 @@ jobs:
6363
runs-on: ubuntu-latest
6464
strategy:
6565
matrix:
66-
python-version: ['3.10', '3.9', '3.8']
66+
python-version: ['3.10', '3.9', '3.8', '3.7']
6767
name: Functional tests with Python ${{ matrix.python-version }}
6868
steps:
6969
- uses: actions/checkout@v3

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
3.10.4
22
3.9.12
33
3.8.13
4+
3.7.13

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ coverage: test-py38
4646
test-py38: python
4747
@pyenv exec tox -qe py38-tests
4848

49+
.PHONY: test-py37
50+
$(call help,make test-py37,"run the unit tests in Python 3.7")
51+
coverage: test-py37
52+
test-py37: python
53+
@pyenv exec tox -qe py37-tests
54+
4955
.PHONY: coverage
5056
$(call help,make coverage,"run the tests and print the coverage report")
5157
coverage: python
@@ -66,11 +72,16 @@ $(call help,make functests-py38,"run the functional tests in Python 3.8")
6672
functests-py38: python
6773
@pyenv exec tox -qe py38-functests
6874

75+
.PHONY: functests-py37
76+
$(call help,make functests-py37,"run the functional tests in Python 3.7")
77+
functests-py37: python
78+
@pyenv exec tox -qe py37-functests
79+
6980
.PHONY: sure
7081
$(call help,make sure,"make sure that the formatting$(comma) linting and tests all pass")
7182
sure: python
7283
sure:
73-
@pyenv exec tox --parallel -qe 'checkformatting,lint,tests,py{39,38}-tests,coverage,functests,py{39,38}-functests'
84+
@pyenv exec tox --parallel -qe 'checkformatting,lint,tests,py{39,38,37}-tests,coverage,functests,py{39,38,37}-functests'
7485

7586
.PHONY: template
7687
$(call help,make template,"update from the latest cookiecutter template")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<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>
22
<a href="https://pypi.org/project/pip-sync-faster"><img src="https://img.shields.io/pypi/v/pip-sync-faster"></a>
3-
<a><img src="https://img.shields.io/badge/python-3.10 | 3.9 | 3.8-success"></a>
3+
<a><img src="https://img.shields.io/badge/python-3.10 | 3.9 | 3.8 | 3.7-success"></a>
44
<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>
55
<a href="https://github.com/hypothesis/cookiecutters/tree/main/pypackage"><img src="https://img.shields.io/badge/cookiecutter-pypackage-success"></a>
66
<a href="https://black.readthedocs.io/en/stable/"><img src="https://img.shields.io/badge/code%20style-black-000000"></a>

bin/make_python

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ -n "${CI+x}" ]; then exit; fi
88

99
pyenv_root=$(pyenv root)
1010

11-
for python_version in 3.10.4 3.9.12 3.8.13; do
11+
for python_version in 3.10.4 3.9.12 3.8.13 3.7.13; do
1212
bin_dir=$pyenv_root/versions/$python_version/bin
1313
if [ ! -f "$bin_dir"/tox ]; then
1414
pyenv install --skip-existing "$python_version"

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ classifiers =
1616
package_dir =
1717
= src
1818
packages = find:
19-
python_requires = >=3.8
19+
python_requires = >=3.7
2020
install_requires =
2121
pip-tools
22+
importlib_metadata;python_version<"3.8."
2223

2324
[options.packages.find]
2425
where = src

src/pip_sync_faster/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
from argparse import ArgumentParser
2-
from importlib.metadata import version
32
from subprocess import CalledProcessError
43

54
from pip_sync_faster.sync import sync
65

6+
try:
7+
from importlib.metadata import version
8+
except ModuleNotFoundError:
9+
from importlib_metadata import version
10+
711

812
def cli(_argv=None): # pylint:disable=inconsistent-return-statements
913
parser = ArgumentParser(

tests/unit/pip_sync_faster/cli_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
from importlib.metadata import version
21
from subprocess import CalledProcessError
32

43
import pytest
54

65
from pip_sync_faster.cli import cli
76

7+
try:
8+
from importlib.metadata import version
9+
except ModuleNotFoundError:
10+
from importlib_metadata import version
11+
812

913
def test_cli(sync):
1014
exit_code = cli(["requirements/dev.txt", "--foo", "bar"])

0 commit comments

Comments
 (0)