# pycronscript
Schedule your Python scripts.
## Getting started
**Install package**
`pip install pycronscript`
**Create config file**
This is created with the first run of `pycronscript` and you can see the path where it is has been created.
**Register your scripts for the scheduled run in config file**
*Note: Scripts must have a '**run**' method!*
```
[custom_name]
path=/home/my_user/foo/bar/my_script.py
each={'minutes': 5} # datetime.timedelta args, but in dict format. Default=1h.
...
```
**Start**
Run again `pycronscript`
## Getting started with *Docker* (example)
**Files needed:**
```
pycronscript_with_docker
├── config.cfg
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
└── test.py
```
**test.py**
```
def run():
print('working!')
```
**config.cfg**
```
[test]
path=/usr/app/src/test.py
each={'minutes': 5}
```
**Dockerfile**
```
FROM python:3.11
WORKDIR /usr/app/src
RUN pip install pycronscript
RUN mkdir -p /root/.config/pycronscript
COPY config.cfg /root/.config/pycronscript/config.cfg
# Install your custom requirements
COPY requirements.txt ./
RUN pip install -r requirements.txt
# Copy scripts
COPY test.py ./
```
**docker-compose.yml**
```
version: '3.4'
services:
pycronscript:
build: .
container_name: pycronscript
entrypoint: 'pycronscript'
restart: always
```
**Start**
```
docker-compose up -d
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tiyujopite/pycronscript",
"name": "pycronscript",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "schedule,cron,python,scripts,tasks",
"author": "Jos\u00e9 Antonio D\u00edaz Miralles",
"author_email": "joseantoniodiazmiralles@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4a/9b/2f5661fdf462d7123e4de784190368053f467697bc62bcf6c4cba30c5378/pycronscript-0.9.4.tar.gz",
"platform": null,
"description": "# pycronscript\nSchedule your Python scripts.\n\n## Getting started\n**Install package**\n\n`pip install pycronscript`\n\n**Create config file**\n\nThis is created with the first run of `pycronscript` and you can see the path where it is has been created.\n\n**Register your scripts for the scheduled run in config file**\n\n*Note: Scripts must have a '**run**' method!*\n```\n[custom_name]\npath=/home/my_user/foo/bar/my_script.py\neach={'minutes': 5} # datetime.timedelta args, but in dict format. Default=1h.\n...\n```\n\n**Start**\n\nRun again `pycronscript`\n\n## Getting started with *Docker* (example)\n**Files needed:**\n```\npycronscript_with_docker\n\u251c\u2500\u2500 config.cfg\n\u251c\u2500\u2500 docker-compose.yml\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 requirements.txt\n\u2514\u2500\u2500 test.py\n```\n\n**test.py**\n```\ndef run():\n print('working!')\n```\n\n**config.cfg**\n```\n[test]\npath=/usr/app/src/test.py\neach={'minutes': 5}\n```\n\n**Dockerfile**\n```\nFROM python:3.11\n\nWORKDIR /usr/app/src\nRUN pip install pycronscript\nRUN mkdir -p /root/.config/pycronscript\nCOPY config.cfg /root/.config/pycronscript/config.cfg\n\n# Install your custom requirements\nCOPY requirements.txt ./\nRUN pip install -r requirements.txt\n\n# Copy scripts\nCOPY test.py ./\n```\n\n**docker-compose.yml**\n```\nversion: '3.4'\n\nservices:\n pycronscript:\n build: .\n container_name: pycronscript\n entrypoint: 'pycronscript'\n restart: always\n```\n\n**Start**\n```\ndocker-compose up -d\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Schedule your Python scripts",
"version": "0.9.4",
"split_keywords": [
"schedule",
"cron",
"python",
"scripts",
"tasks"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fb62a086ac02db405e07d9051f410a1ae02baef5429e5b1600a410b11770a311",
"md5": "6c3441723f30d48eacb965aaac2acef9",
"sha256": "06be4e3c70dabc17edac8cbde83ec8336f137bfca642c5c573d6c17ea174752e"
},
"downloads": -1,
"filename": "pycronscript-0.9.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c3441723f30d48eacb965aaac2acef9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4922,
"upload_time": "2023-03-25T16:55:49",
"upload_time_iso_8601": "2023-03-25T16:55:49.463505Z",
"url": "https://files.pythonhosted.org/packages/fb/62/a086ac02db405e07d9051f410a1ae02baef5429e5b1600a410b11770a311/pycronscript-0.9.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4a9b2f5661fdf462d7123e4de784190368053f467697bc62bcf6c4cba30c5378",
"md5": "fcd63c3f3f72bd908a2771a5fce395d6",
"sha256": "3d710ad341df04385215fdaf22389b87ea71d155f051b421388138889717c22c"
},
"downloads": -1,
"filename": "pycronscript-0.9.4.tar.gz",
"has_sig": false,
"md5_digest": "fcd63c3f3f72bd908a2771a5fce395d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4263,
"upload_time": "2023-03-25T16:55:50",
"upload_time_iso_8601": "2023-03-25T16:55:50.958711Z",
"url": "https://files.pythonhosted.org/packages/4a/9b/2f5661fdf462d7123e4de784190368053f467697bc62bcf6c4cba30c5378/pycronscript-0.9.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-25 16:55:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "tiyujopite",
"github_project": "pycronscript",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pycronscript"
}