cron-lite


Namecron-lite JSON
Version 1.1 PyPI version JSON
download
home_pagehttps://github.com/rainydew/cron_lite
SummaryA very light library to run python functions like cron jobs do.
upload_time2023-07-25 07:37:47
maintainerNone
docs_urlNone
authorRainy Chan
requires_pythonNone
licenseNone
keywords cron task decorator schedule
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            cron_lite
=========

A very light library to run python functions like cron jobs do. (support
cron expressions with timezone, decorator style, spawn running and
graceful exit. Runs in python service like Apscheduler, no effect of
system config)

Example
~~~~~~~

.. code:: python

   from cron_lite import cron_task, start_all, stop_all, set_time_zone
   import time

   set_time_zone("Asia/Shanghai")


   @cron_task("* * * * * 0/2")
   def event1():
       print("event1", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
       time.sleep(3)
       print("event1 done", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))

   @cron_task("* * * * * 0/15")
   def event2():
       print("event2", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))
       time.sleep(10)
       print("event2 done", time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())))


   th = start_all(spawn=True)  # use bare `start_all()` to run forever as a service
   print("start")
   time.sleep(60)
   print("stop")
   stop_all(th)
   print("done")

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rainydew/cron_lite",
    "name": "cron-lite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "cron task decorator schedule",
    "author": "Rainy Chan",
    "author_email": "rainydew@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/dd/88/4958fd7ed033d9be9d888fd127c3bbee5cce879b04e4765bd61947386754/cron-lite-1.1.tar.gz",
    "platform": null,
    "description": "cron_lite\n=========\n\nA very light library to run python functions like cron jobs do. (support\ncron expressions with timezone, decorator style, spawn running and\ngraceful exit. Runs in python service like Apscheduler, no effect of\nsystem config)\n\nExample\n~~~~~~~\n\n.. code:: python\n\n   from cron_lite import cron_task, start_all, stop_all, set_time_zone\n   import time\n\n   set_time_zone(\"Asia/Shanghai\")\n\n\n   @cron_task(\"* * * * * 0/2\")\n   def event1():\n       print(\"event1\", time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(time.time())))\n       time.sleep(3)\n       print(\"event1 done\", time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(time.time())))\n\n   @cron_task(\"* * * * * 0/15\")\n   def event2():\n       print(\"event2\", time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(time.time())))\n       time.sleep(10)\n       print(\"event2 done\", time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(time.time())))\n\n\n   th = start_all(spawn=True)  # use bare `start_all()` to run forever as a service\n   print(\"start\")\n   time.sleep(60)\n   print(\"stop\")\n   stop_all(th)\n   print(\"done\")\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A very light library to run python functions like cron jobs do.",
    "version": "1.1",
    "project_urls": {
        "Homepage": "https://github.com/rainydew/cron_lite"
    },
    "split_keywords": [
        "cron",
        "task",
        "decorator",
        "schedule"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd884958fd7ed033d9be9d888fd127c3bbee5cce879b04e4765bd61947386754",
                "md5": "77e666229b63d1e4636b70ffa26bf24a",
                "sha256": "f3306c0e67ef96665770a4433b57bf85904eb4524d166d71691b724490954002"
            },
            "downloads": -1,
            "filename": "cron-lite-1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "77e666229b63d1e4636b70ffa26bf24a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2838,
            "upload_time": "2023-07-25T07:37:47",
            "upload_time_iso_8601": "2023-07-25T07:37:47.980230Z",
            "url": "https://files.pythonhosted.org/packages/dd/88/4958fd7ed033d9be9d888fd127c3bbee5cce879b04e4765bd61947386754/cron-lite-1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-25 07:37:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rainydew",
    "github_project": "cron_lite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cron-lite"
}
        
Elapsed time: 0.08308s