Skip to content

Commit 5beaae7

Browse files
iamogbznoahnu
authored andcommitted
build: remove requirement file (#87)
* wip: move all deps to setup * ci: use bootstrap script * wip: use githook entry file * wip: use path python in ci * wip: specify req variables * cr: pin dev reqs * wip: install command * wip: build requirement from setup * wip: add back rebuild arg * wip: use pip via python modules Co-authored-by: Noah <[email protected]>
1 parent 1527c7a commit 5beaae7

File tree

5 files changed

+38
-32
lines changed

5 files changed

+38
-32
lines changed

.github/workflows/pythonapp.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ jobs:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install python dev dependencies.
2323
run: |
24-
python -m pip install -U pip --no-cache-dir
25-
python -m pip install -e . -r requirements.txt
24+
. script/bootstrap
2625
- name: Lint
2726
run: invoke lint
2827
- name: Test

requirements.in

Lines changed: 0 additions & 18 deletions
This file was deleted.

script/bootstrap

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
if [[ -z $CI ]]; then
99
# pyenv update
1010
pyenv install --skip-existing || return
11+
VENV="${PWD##*/}.venv"
12+
test -d $VENV || python3 -m venv $VENV || return
13+
. $VENV/bin/activate
1114
else
1215
if [[ ! -f `pwd`/.python-version ]]; then
1316
echo "You are missing a .python-version file."
@@ -17,10 +20,6 @@ else
1720
fi
1821
fi
1922

20-
VENV="${PWD##*/}.venv"
21-
test -d $VENV || python3 -m venv $VENV || return
22-
$VENV/bin/pip install -U pip --no-cache-dir
23-
$VENV/bin/pip install -e . -r requirements.txt
24-
$VENV/bin/python -m python_githooks
25-
26-
. $VENV/bin/activate
23+
python -m pip install -U pip --no-cache-dir
24+
python -m pip install -e . -r requirements.txt
25+
python -m python_githooks

setup.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,27 @@
88

99

1010
python_requires = "~=3.6"
11+
setup_requires = ["setuptools_scm"]
12+
install_requires = ["typing_extensions>=3.6"]
13+
dev_requires = [
14+
"black",
15+
"codecov",
16+
"coverage[toml]",
17+
"flake8",
18+
"flake8-bugbear",
19+
"flake8-builtins",
20+
"flake8-comprehensions",
21+
"flake8-i18n",
22+
"invoke",
23+
"isort",
24+
"mypy",
25+
"pip-tools",
26+
"py-githooks",
27+
"pytest",
28+
"semver",
29+
"twine",
30+
"wheel",
31+
]
1132

1233
if sys.version_info[0] == 2:
1334
raise Exception("Only python 3 supported.")
@@ -18,7 +39,7 @@ def readme() -> str:
1839
return f.read()
1940

2041

21-
if __name__ == "__main__":
42+
if __name__ in ["__main__", "builtins"]:
2243
setup(
2344
name="syrupy",
2445
description="PyTest Snapshot Test Utility",
@@ -38,9 +59,10 @@ def readme() -> str:
3859
package_dir={"": "src"},
3960
packages=find_packages("./src"),
4061
zip_safe=False,
41-
install_requires=["typing_extensions"],
42-
setup_requires=["setuptools_scm"],
4362
entry_points={"pytest11": ["syrupy = syrupy"]},
63+
extras_require={"dev": dev_requires},
64+
install_requires=install_requires,
65+
setup_requires=setup_requires,
4466
python_requires=python_requires,
4567
classifiers=[
4668
"Development Status :: 1 - Planning",

tasks.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ def requirements(ctx, upgrade=False):
2020
"""
2121
Build dev requirements lock file
2222
"""
23-
source = "requirements.in"
23+
dest = "requirements.txt"
2424
args = ["--no-emit-find-links", "--no-index", "--allow-unsafe", "--rebuild"]
2525
if upgrade:
2626
args.append("--upgrade")
27-
ctx.run(f"python -m piptools compile {source} {' '.join(args)}", pty=True)
27+
ctx.run(
28+
"echo '-e .[dev]' | python -m piptools compile "
29+
f"{' '.join(args)} - -qo- | sed '/^-e / d' > {dest}",
30+
pty=True,
31+
)
2832

2933

3034
@task

0 commit comments

Comments
 (0)