Skip to content

Commit

Permalink
build: remove requirement file (#87)
Browse files Browse the repository at this point in the history
* 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 <noahnu@gmail.com>
  • Loading branch information
2 people authored and Noah committed Jan 4, 2020
1 parent 1527c7a commit 5beaae7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 32 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install python dev dependencies.
run: |
python -m pip install -U pip --no-cache-dir
python -m pip install -e . -r requirements.txt
. script/bootstrap
- name: Lint
run: invoke lint
- name: Test
Expand Down
18 changes: 0 additions & 18 deletions requirements.in

This file was deleted.

13 changes: 6 additions & 7 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
if [[ -z $CI ]]; then
# pyenv update
pyenv install --skip-existing || return
VENV="${PWD##*/}.venv"
test -d $VENV || python3 -m venv $VENV || return
. $VENV/bin/activate
else
if [[ ! -f `pwd`/.python-version ]]; then
echo "You are missing a .python-version file."
Expand All @@ -17,10 +20,6 @@ else
fi
fi

VENV="${PWD##*/}.venv"
test -d $VENV || python3 -m venv $VENV || return
$VENV/bin/pip install -U pip --no-cache-dir
$VENV/bin/pip install -e . -r requirements.txt
$VENV/bin/python -m python_githooks

. $VENV/bin/activate
python -m pip install -U pip --no-cache-dir
python -m pip install -e . -r requirements.txt
python -m python_githooks
28 changes: 25 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@


python_requires = "~=3.6"
setup_requires = ["setuptools_scm"]
install_requires = ["typing_extensions>=3.6"]
dev_requires = [
"black",
"codecov",
"coverage[toml]",
"flake8",
"flake8-bugbear",
"flake8-builtins",
"flake8-comprehensions",
"flake8-i18n",
"invoke",
"isort",
"mypy",
"pip-tools",
"py-githooks",
"pytest",
"semver",
"twine",
"wheel",
]

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


if __name__ == "__main__":
if __name__ in ["__main__", "builtins"]:
setup(
name="syrupy",
description="PyTest Snapshot Test Utility",
Expand All @@ -38,9 +59,10 @@ def readme() -> str:
package_dir={"": "src"},
packages=find_packages("./src"),
zip_safe=False,
install_requires=["typing_extensions"],
setup_requires=["setuptools_scm"],
entry_points={"pytest11": ["syrupy = syrupy"]},
extras_require={"dev": dev_requires},
install_requires=install_requires,
setup_requires=setup_requires,
python_requires=python_requires,
classifiers=[
"Development Status :: 1 - Planning",
Expand Down
8 changes: 6 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ def requirements(ctx, upgrade=False):
"""
Build dev requirements lock file
"""
source = "requirements.in"
dest = "requirements.txt"
args = ["--no-emit-find-links", "--no-index", "--allow-unsafe", "--rebuild"]
if upgrade:
args.append("--upgrade")
ctx.run(f"python -m piptools compile {source} {' '.join(args)}", pty=True)
ctx.run(
"echo '-e .[dev]' | python -m piptools compile "
f"{' '.join(args)} - -qo- | sed '/^-e / d' > {dest}",
pty=True,
)


@task
Expand Down

0 comments on commit 5beaae7

Please sign in to comment.