8000 Merge pull request #44 from TomBurch/master · pavelzw/fastapi-utils@46217f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 46217f4

Browse files
authored
Merge pull request fastapiutils#44 from TomBurch/master
Change wait_first to a float
2 parents 25d9a77 + 5d1db97 commit 46217f4

File tree

10 files changed

+329
-258
lines changed

10 files changed

+329
-258
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,21 @@ jobs:
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
# Avoid caching to be 100% confident things are working properly
22+
- name: Init python poetry action
23+
uses: abatilo/actions-poetry@v2.1.0
24+
2225
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install -r requirements.txt
26+
run: poetry install
27+
2628
- name: Check that formatting, linting, and tests pass
27-
run: |
28-
make ci
29+
run: poetry run make ci
30+
2931
- name: Check docs are up to date
30-
run: |
31-
make docs-build-ci
32-
- name: Install poetry
33-
run: |
34-
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
32+
run: poetry run make docs-build-ci
33+
3534
- name: Build distribution
36-
run: |
37-
source $HOME/.poetry/env && poetry build
35+
run: poetry build
36+
3837
- name: Publish distribution to PyPI
3938
uses: pypa/gh-action-pypi-publish@master
4039
with:

.github/workflows/pull-request.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
uses: actions/setup-python@v1
2020
with:
2121
python-version: ${{ matrix.python-version }}
22+
- name: Python Poetry Action
23+
uses: abatilo/actions-poetry@v2.1.0
2224
- uses: actions/cache@v1
2325
id: cache-deps
2426
with:
@@ -27,9 +29,7 @@ jobs:
2729
restore-keys: |
2830
${{ runner.os }}-pip-
2931
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install -r requirements.txt
32+
run: poetry install
3333
- uses: actions/cache@v1
3434
with:
3535
path: .mypy_cache
@@ -41,9 +41,7 @@ jobs:
4141
- name: Check docs build
4242
# only run this for the python version used by netlify:
4343
if: matrix.python-version == 3.8
44-
run: |
45-
make docs-build-ci
44+
run: poetry run make docs-build-ci
4645
- name: Check that formatting, linting, and tests pass
47-
run: |
48-
make ci
46+
run: poetry run make ci
4947

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ First, you might want to see the basic ways to [help and get help](help-fastapi-
44

55
Once you've cloned the repository, here are some guidelines to set up your environment:
66

7-
### Set up the development evironment
7+
### Set up the development environment
88

99
After cloning the repository, you can use `poetry` to create a virtual environment:
1010

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ First, you might want to see the basic ways to [help and get help](help-fastapi-
44

55
Once you've cloned the repository, here are some guidelines to set up your environment:
66

7-
### Set up the development evironment
7+
### Set up the development environment
88

99
After cloning the repository, you can use `poetry` to create a virtual environment:
1010

fastapi_restful/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.2.4.3"
1+
__version__ = "0.2.5"
22

33
from .cbv_base import Api, Resource, set_responses, take_init_parameters
44

fastapi_restful/tasks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
def repeat_every(
1616
*,
1717
seconds: float,
18-
wait_first: bool = False,
18+
wait_first: float = None,
1919
logger: Optional[logging.Logger] = None,
2020
raise_exceptions: bool = False,
2121
max_repetitions: Optional[int] = None,
@@ -30,8 +30,8 @@ def repeat_every(
3030
----------
3131
seconds: float
3232
The number of seconds to wait between repeated calls
33-
wait_first: bool (default False)
34-
If True, the function will wait for a single period before the first call
33+
wait_first: float (default None)
34+
If not None, the function will wait for the given duration before the first call
3535
logger: Optional[logging.Logger] (default None)
3636
The logger to use to log any exceptions raised by calls to the decorated function.
3737
If not provided, exceptions will not be logged by this function (though they may be handled by the event loop).
@@ -56,8 +56,8 @@ async def wrapped() -> None:
5656

5757
async def loop() -> None:
5858
nonlocal repetitions
59-
if wait_first:
60-
await asyncio.sleep(seconds)
59+
if wait_first is not None:
60+
await asyncio.sleep(wait_first)
6161
while max_repetitions is None or repetitions < max_repetitions:
6262
try:
6363
if is_coroutine:

0 commit comments

Comments
 (0)
0