Skip to content

Commit

Permalink
update test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TezRomacH committed Apr 21, 2020
1 parent e055b17 commit e7764f6
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 19 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: |
curl -sSL \
"https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py" | python
run: make download-poetry

- name: Set up cache
uses: actions/cache@v1
Expand All @@ -29,15 +27,15 @@ jobs:
- name: Install dependencies
run: |
source "$HOME/.poetry/env"
poetry config virtualenvs.in-project true
poetry install
- name: Run checks
- name: Run safety checks
run: |
source "$HOME/.poetry/env"
STRICT=1 make check-safety
poetry run black --diff --target-version py37 ./
poetry run poetry check
poetry run pip check
poetry run safety check --bare --full-report
- name: Run style checks
run: |
source "$HOME/.poetry/env"
STRICT=1 make check-style
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ using this template.
## Dependencies

We use `poetry` to manage the [dependencies](https://github.com/python-poetry/poetry).

To install them you would need to run `install` command:
If you dont have `poetry` installed, you should run the command below.

```bash
poetry install
make download-poetry
```

And then install pre-commit hooks
To install dependencies and prepare [`pre-commit`](https://pre-commit.com/) hooks you would need to run `install` command:

```bash
poetry run pre-commit install
make install
```
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
SHELL:=/usr/bin/env bash

ifeq ($(STRICT),1)
SEP =
else
SEP = -
endif

.PHONY: download-poetry
download-poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

.PHONY: install
install:
poetry lock -n
poetry install -n
poetry run pre-commit install

.PHONY: check-safety
check-safety:
poetry check
$(SEP)pip check
$(SEP)poetry run safety check --full-report
$(SEP)poetry run bandit -r ./

.PHONY: check-style
check-style:
$(SEP)poetry run black --diff --target-version py37 --check ./
$(SEP)poetry run darglint -v 2 **/*.py

.PHONY: codestyle
codestyle:
poetry run pre-commit run --all-files

.PHONY: clean
clean:
rm -rf build/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Package template for Python librarieas and CLI apps
# Package template for Python libraries and CLI apps

<p align="center">

Expand Down
32 changes: 32 additions & 0 deletions {{ cookiecutter.project_name }}/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# {{ cookiecutter.project_name }}

<p align="center">

[![Build status](https://github.com/{{ cookiecutter.organization }}/{{ cookiecutter.project_name }}/workflows/test/badge.svg?branch=master&event=push)](https://github.com/{{ cookiecutter.organization }}/{{ cookiecutter.project_name }}/actions?query=workflow%3Atest)
[![Python Version](https://img.shields.io/pypi/pyversions/{{ cookiecutter.project_name }}.svg)](https://pypi.org/project/{{ cookiecutter.project_name }}/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)

</p>

{{ cookiecutter.project_description }}

## Installation

```bash
pip install {{ cookiecutter.project_name }}
```

or follow

```bash
poetry add {{ cookiecutter.project_name }}
```

## License

{{ cookiecutter.license }}. See [LICENSE](https://github.com/{{ cookiecutter.organization }}/{{ cookiecutter.project_name }}/blob/master/LICENCE) for more details.

## Credits

This project was generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template).
1 change: 0 additions & 1 deletion {{ cookiecutter.project_name }}/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Read more about `setup.cfg`:
# https://docs.python.org/3/distutils/configfile.html


[darglint]
# darglint configuration:
# https://github.com/terrencepreilly/darglint
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Contains the version of the package."""

__version__ = "{{ cookiecutter.version }}"
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ def hello(name: str) -> str:
Args:
name (str): Name to greet.
.. code:: python
Returns:
str: greeting message
>>> hello("Roman")
"Hello Roman!"
Examples:
.. code:: python
>>> hello("Roman")
"Hello Roman!"
>>> hello("Taylor")
"Hello Taylor!"
"""
return f"Hello {name}!"

Expand Down

0 comments on commit e7764f6

Please sign in to comment.