django-subcommandir


Namedjango-subcommandir JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/pikhovkin/django-subcommandir
SummaryDjango subcommands in subdirectories
upload_time2023-07-25 13:14:00
maintainer
docs_urlNone
authorSergei Pikhovkin
requires_python>=3.7,<4.0
licenseMIT
keywords django command commands django-commands django-subcommands
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-subcommandir

[![GitHub Actions](https://github.com/pikhovkin/django-subcommandir/workflows/build/badge.svg)](https://github.com/pikhovkin/django-subcommandir/actions)
[![PyPI](https://img.shields.io/pypi/v/django-subcommandir.svg)](https://pypi.org/project/django-subcommandir/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-subcommandir.svg)
[![framework - Django](https://img.shields.io/badge/framework-Django-0C3C26.svg)](https://www.djangoproject.com/)
![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-subcommandir.svg)
[![PyPI - License](https://img.shields.io/pypi/l/django-subcommandir)](./LICENSE)

Django subcommands in subdirectories

### Installation

```bash
$ pip install django-subcommandir
```

### Example of usage

```bash
my_app
├── ...
├── management
│   ├── commands
│   │   ├── __init__.py
│   │   ├── load
│   │   │   ├── __init__.py
│   │   │   ├── month_report.py
│   │   │   └── year_report.py
│   │   ├── my_app_load.py
│   ├── __init__.py
```

```python
# .../management/commands/my_app_load.py
from subcommandir import BaseCommand

class Command(BaseCommand):
    subcommand_dir = 'load'
```
```python
# .../management/commands/load/month_report.py
from django.core.management.base import BaseCommand

class Command(BaseCommand):
    def add_arguments(self, parser):
        parser.add_argument('--start', ...)
        ...

    def handle(self, *args, **options):
        ...
```

Command calls:
```bash
$ python manage.py my_app_load year_report
$ python manage.py my_app_load month_report --start="2021-01" --end="2021-02"
```
or
```python
from django.core.management import call_command

def load_year_report():
    call_command('my_app_load', 'year_report')
    
def load_month_report():
    call_command('my_app_load', 'month_report', start=...)
```

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pikhovkin/django-subcommandir",
    "name": "django-subcommandir",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "django,command,commands,django-commands,django-subcommands",
    "author": "Sergei Pikhovkin",
    "author_email": "s@pikhovkin.ru",
    "download_url": "https://files.pythonhosted.org/packages/cf/e6/da6839851d0dcafdd73a44d05b497dd486c3387dd1eeafd504fcdbb7356e/django-subcommandir-0.3.0.tar.gz",
    "platform": null,
    "description": "# django-subcommandir\n\n[![GitHub Actions](https://github.com/pikhovkin/django-subcommandir/workflows/build/badge.svg)](https://github.com/pikhovkin/django-subcommandir/actions)\n[![PyPI](https://img.shields.io/pypi/v/django-subcommandir.svg)](https://pypi.org/project/django-subcommandir/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-subcommandir.svg)\n[![framework - Django](https://img.shields.io/badge/framework-Django-0C3C26.svg)](https://www.djangoproject.com/)\n![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-subcommandir.svg)\n[![PyPI - License](https://img.shields.io/pypi/l/django-subcommandir)](./LICENSE)\n\nDjango subcommands in subdirectories\n\n### Installation\n\n```bash\n$ pip install django-subcommandir\n```\n\n### Example of usage\n\n```bash\nmy_app\n\u251c\u2500\u2500 ...\n\u251c\u2500\u2500 management\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 commands\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 load\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 month_report.py\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 year_report.py\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 my_app_load.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n```\n\n```python\n# .../management/commands/my_app_load.py\nfrom subcommandir import BaseCommand\n\nclass Command(BaseCommand):\n    subcommand_dir = 'load'\n```\n```python\n# .../management/commands/load/month_report.py\nfrom django.core.management.base import BaseCommand\n\nclass Command(BaseCommand):\n    def add_arguments(self, parser):\n        parser.add_argument('--start', ...)\n        ...\n\n    def handle(self, *args, **options):\n        ...\n```\n\nCommand calls:\n```bash\n$ python manage.py my_app_load year_report\n$ python manage.py my_app_load month_report --start=\"2021-01\" --end=\"2021-02\"\n```\nor\n```python\nfrom django.core.management import call_command\n\ndef load_year_report():\n    call_command('my_app_load', 'year_report')\n    \ndef load_month_report():\n    call_command('my_app_load', 'month_report', start=...)\n```\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Django subcommands in subdirectories",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/pikhovkin/django-subcommandir"
    },
    "split_keywords": [
        "django",
        "command",
        "commands",
        "django-commands",
        "django-subcommands"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b37ae87ebd47836176e5791357c84dd70c8c9640c925b454c38536c65e36790",
                "md5": "70d1bcb550f6825b7b0f4918eab7ff22",
                "sha256": "37e1de71fb1ba677b547d699a871c2a454cec6f533ed7d2af3478a89055282f8"
            },
            "downloads": -1,
            "filename": "django_subcommandir-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "70d1bcb550f6825b7b0f4918eab7ff22",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 6632,
            "upload_time": "2023-07-25T13:13:58",
            "upload_time_iso_8601": "2023-07-25T13:13:58.872039Z",
            "url": "https://files.pythonhosted.org/packages/4b/37/ae87ebd47836176e5791357c84dd70c8c9640c925b454c38536c65e36790/django_subcommandir-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cfe6da6839851d0dcafdd73a44d05b497dd486c3387dd1eeafd504fcdbb7356e",
                "md5": "d439080f6d3044e6204bc696e841596c",
                "sha256": "8e728ee7742979e459998df4dacad11f9ca0122c03aaf4c3c254dc0a401dfcf2"
            },
            "downloads": -1,
            "filename": "django-subcommandir-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d439080f6d3044e6204bc696e841596c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 4536,
            "upload_time": "2023-07-25T13:14:00",
            "upload_time_iso_8601": "2023-07-25T13:14:00.315989Z",
            "url": "https://files.pythonhosted.org/packages/cf/e6/da6839851d0dcafdd73a44d05b497dd486c3387dd1eeafd504fcdbb7356e/django-subcommandir-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-25 13:14:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pikhovkin",
    "github_project": "django-subcommandir",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-subcommandir"
}
        
Elapsed time: 0.24073s