Skip to content

Commit

Permalink
Merge branch 'master' into CPickens42/master
Browse files Browse the repository at this point in the history
  • Loading branch information
SijmenHuizenga committed Apr 9, 2023
2 parents 5afbd1a + a3ecd35 commit 6ca4e32
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 41 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/ci.yml
Expand Up @@ -14,11 +14,11 @@ jobs:
strategy:
max-parallel: 6
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -40,10 +40,10 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Finished
run: |
pip3 install coveralls
Expand All @@ -54,11 +54,11 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: pip install tox
- name: Check docs
Expand All @@ -67,11 +67,11 @@ jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: pip install tox
- name: Check formatting
Expand All @@ -80,12 +80,12 @@ jobs:
setuppy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: pip install tox
- name: Check docs
run: tox -e setuppy
run: tox -e setuppy
5 changes: 5 additions & 0 deletions HISTORY.rst
Expand Up @@ -3,6 +3,11 @@
History
-------

Next release
++++++++++++++++++

- Dropped support for Python 3.6, add support for Python 3.10 and 3.11.

1.1.0 (2021-04-09)
++++++++++++++++++

Expand Down
8 changes: 4 additions & 4 deletions README.rst
Expand Up @@ -17,7 +17,7 @@ Python job scheduling for humans. Run Python functions (or any other callable) p
- In-process scheduler for periodic jobs. No extra processes needed!
- Very lightweight and no external dependencies.
- Excellent test coverage.
- Tested on Python and 3.6, 3.7, 3.8, 3.9
- Tested on Python and 3.7, 3.8, 3.9, 3.10, 3.11

Usage
-----
Expand All @@ -33,7 +33,7 @@ Usage
def job():
print("I'm working...")
schedule.every(10).seconds.do(job)
schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
Expand All @@ -46,9 +46,9 @@ Usage
def job_with_argument(name):
print(f"I am {name}")
schedule.every(10).seconds.do(job_with_argument, name="Peter")
while True:
schedule.run_pending()
time.sleep(1)
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -75,7 +75,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Expand Up @@ -26,7 +26,7 @@ Run a job every x minute
# Run job every minute at the 23rd second
schedule.every().minute.at(":23").do(job)
# Run job every hour at the 42rd minute
# Run job every hour at the 42nd minute
schedule.every().hour.at(":42").do(job)
# Run jobs every 5th hour, 20 minutes and 30 seconds in.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Expand Up @@ -17,7 +17,7 @@ Python job scheduling for humans. Run Python functions (or any other callable) p
- In-process scheduler for periodic jobs. No extra processes needed!
- Very lightweight and no external dependencies.
- Excellent test coverage.
- Tested on Python 3.6, 3.7, 3.8 and 3.9
- Tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11


:doc:`Example <examples>`
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.rst
Expand Up @@ -6,9 +6,9 @@ Python version support
######################

We recommend using the latest version of Python.
Schedule is tested on Python 3.6, 3.7, 3.8 and 3.9
Schedule is tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11.

Want to use Schedule on Python 2.7 or 3.5? Use version 0.6.0.
Want to use Schedule on earlier Python versions? See the History.


Dependencies
Expand Down
12 changes: 6 additions & 6 deletions schedule/__init__.py
Expand Up @@ -15,7 +15,7 @@
- A simple to use API for scheduling jobs.
- Very lightweight and no external dependencies.
- Excellent test coverage.
- Tested on Python 3.6, 3.7, 3.8, 3.9
- Tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11
Usage:
>>> import schedule
Expand Down Expand Up @@ -67,15 +67,15 @@ class IntervalError(ScheduleValueError):
pass


class CancelJob(object):
class CancelJob:
"""
Can be returned from a job to unschedule itself.
"""

pass


class Scheduler(object):
class Scheduler:
"""
Objects instantiated by the :class:`Scheduler <Scheduler>` are
factories to create jobs, keep record of scheduled jobs and
Expand Down Expand Up @@ -205,7 +205,7 @@ def idle_seconds(self) -> Optional[float]:
return (self.next_run - datetime.datetime.now()).total_seconds()


class Job(object):
class Job:
"""
A periodic job as used by :class:`Scheduler`.
Expand All @@ -223,7 +223,7 @@ class Job(object):
method, which also defines its `interval`.
"""

def __init__(self, interval: int, scheduler: Scheduler = None):
def __init__(self, interval: int, scheduler: Optional[Scheduler] = None):
self.interval: int = interval # pause interval * unit between runs
self.latest: Optional[int] = None # upper limit to the interval
self.job_func: Optional[functools.partial] = None # the job job_func to run
Expand Down Expand Up @@ -469,7 +469,7 @@ def tag(self, *tags: Hashable):
self.tags.update(tags)
return self

def at(self, time_str: str, tz: str = None):
def at(self, time_str: str, tz: Optional[str] = None):

"""
Specify a particular time that the job should be run at.
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Expand Up @@ -43,11 +43,12 @@ def read_file(filename):
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Natural Language :: English",
],
python_requires=">=3.6",
python_requires=">=3.7",
)
5 changes: 3 additions & 2 deletions test_schedule.py
Expand Up @@ -30,7 +30,7 @@ def make_mock_job(name=None):
return job


class mock_datetime(object):
class mock_datetime:
"""
Monkey-patch datetime for predictable results
"""
Expand Down Expand Up @@ -337,7 +337,8 @@ def test_until_time(self):
self.assertRaises(
ScheduleValueError, every().day.until, datetime.timedelta(minutes=-1)
)
self.assertRaises(ScheduleValueError, every().day.until, datetime.time(hour=5))
one_hour_ago = datetime.datetime.now() - datetime.timedelta(hours=1)
self.assertRaises(ScheduleValueError, every().day.until, one_hour_ago)

# Unschedule job after next_run passes the deadline
schedule.clear()
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
@@ -1,14 +1,15 @@
[tox]
envlist = py3{6,7,8,9}{,-pytz}
envlist = py3{7,8,9,10,11}{,-pytz}
skip_missing_interpreters = true


[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
deps =
Expand All @@ -34,4 +35,4 @@ commands = black --check .
[testenv:setuppy]
deps = -rrequirements-dev.txt
commands =
python setup.py check --strict --metadata --restructuredtext
python setup.py check --strict --metadata --restructuredtext

0 comments on commit 6ca4e32

Please sign in to comment.