django-app-requires


Namedjango-app-requires JSON
Version 0.3.4 PyPI version JSON
download
home_pageNone
SummaryA simple tool that allows you to specify app dependencies and middleware dependencies in your application, and also allow you to add default values for your additional configurations, after then load all your application settings into your project's settings.
upload_time2024-05-22 12:44:56
maintainerJin MinXiang
docs_urlNone
authorJin MinXiang
requires_pythonNone
licenseMIT
keywords django utils
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-app-requires

A simple tool that allows you to specify app dependencies and middleware dependencies in your application, and also allow you to add default values for your additional configurations, after then load all your application settings into your project's settings.


## Install

```
pip install django-app-requires
```

## Usage

**your_app/\_\_init\_\_.py**

```
app_requires = [
    "your",
    "required",
    "apps",
]

app_middleware_requires = [
    "your",
    "required",
    "middlewares",
]

# Django's setting key must be in upper case.
# default values will be overrided by items in pro/settings.py.

app_setting_defaults = {
    "HELLO": "WORLD",
}

app_setting_callbacks = {
    "your_app.setting_callbacks.callback1",
}
```

**your_app/setting_callbacks.py**

```
def callback1(globals):
    globals["EXTRA_ITEM"] = "EXTRA_VALUE"
```

**pro/settings**

```
INSTALLED_APPS = [
    ...
    'your_app',
    ...
]

#
# at the bottom of settings.py
#
from django_app_requires import patch_all
patch_all()

# so the final INSTALLED_APPS = [
#     "your",
#     "required",
#     "apps",
#     "your_app",
#     "django_app_requires",
# ]

# so the final MIDDLEWARE = [
#    ...
#    "your",
#    "required",
#    "middlewares",
#    ...
# ]

# so the final you got a new setting item:
# HELLO = "WORLD"

## so the final you got a new setting item which provided by callback1:
# EXTRA_ITEM = "EXTRA_VALUE"
```


## Releases

### v0.1.0

- First release.

### v0.1.1

- Add fastutils & magic-import in requirements.txt.
- Fix problems of recursive required.

### v0.2.0

- Add collect_requirements function. **Removed**

### v0.2.1

- Don't scan all app, exclude third-part apps.
- Suggest to use collect_requirements command before doing project package.

### v0.2.2

- Output sorting.

### v0.2.3

- Remove collect_requirements command.
- Test with Django 3.2.

### v0.2.4

- We are not care about Django's version and fastutils' version, so let the end user to choose the version.

### v0.2.5

- Fix bdist_wheel problem that including useless files.


### v0.3.0

- Rename add_app_requires to load_app_requires.
- Add load_app_middleware_requires.
- Add load_app_setting_defaults.
- Add load_app_setting_callbacks.
- Add patch_all to load_app_requires, load_app_middleware_requires, load_app_setting_defaults and load_app_setting_callbacks.

### v0.3.1

- Fix app_setting_callbacks duplicate load problem.

### v0.3.2

- Doc update.
- Use zenutils.

### v0.3.3

- Doc update.

### v0.3.4

- Fix unit tests.



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-app-requires",
    "maintainer": "Jin MinXiang",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "django utils",
    "author": "Jin MinXiang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0c/f1/4602cd6ffa075c051c18f8e2688a574d1306f4e13b0d6bad58fc00d5b229/django-app-requires-0.3.4.tar.gz",
    "platform": null,
    "description": "# django-app-requires\n\nA simple tool that allows you to specify app dependencies and middleware dependencies in your application, and also allow you to add default values for your additional configurations, after then load all your application settings into your project's settings.\n\n\n## Install\n\n```\npip install django-app-requires\n```\n\n## Usage\n\n**your_app/\\_\\_init\\_\\_.py**\n\n```\napp_requires = [\n    \"your\",\n    \"required\",\n    \"apps\",\n]\n\napp_middleware_requires = [\n    \"your\",\n    \"required\",\n    \"middlewares\",\n]\n\n# Django's setting key must be in upper case.\n# default values will be overrided by items in pro/settings.py.\n\napp_setting_defaults = {\n    \"HELLO\": \"WORLD\",\n}\n\napp_setting_callbacks = {\n    \"your_app.setting_callbacks.callback1\",\n}\n```\n\n**your_app/setting_callbacks.py**\n\n```\ndef callback1(globals):\n    globals[\"EXTRA_ITEM\"] = \"EXTRA_VALUE\"\n```\n\n**pro/settings**\n\n```\nINSTALLED_APPS = [\n    ...\n    'your_app',\n    ...\n]\n\n#\n# at the bottom of settings.py\n#\nfrom django_app_requires import patch_all\npatch_all()\n\n# so the final INSTALLED_APPS = [\n#     \"your\",\n#     \"required\",\n#     \"apps\",\n#     \"your_app\",\n#     \"django_app_requires\",\n# ]\n\n# so the final MIDDLEWARE = [\n#    ...\n#    \"your\",\n#    \"required\",\n#    \"middlewares\",\n#    ...\n# ]\n\n# so the final you got a new setting item:\n# HELLO = \"WORLD\"\n\n## so the final you got a new setting item which provided by callback1:\n# EXTRA_ITEM = \"EXTRA_VALUE\"\n```\n\n\n## Releases\n\n### v0.1.0\n\n- First release.\n\n### v0.1.1\n\n- Add fastutils & magic-import in requirements.txt.\n- Fix problems of recursive required.\n\n### v0.2.0\n\n- Add collect_requirements function. **Removed**\n\n### v0.2.1\n\n- Don't scan all app, exclude third-part apps.\n- Suggest to use collect_requirements command before doing project package.\n\n### v0.2.2\n\n- Output sorting.\n\n### v0.2.3\n\n- Remove collect_requirements command.\n- Test with Django 3.2.\n\n### v0.2.4\n\n- We are not care about Django's version and fastutils' version, so let the end user to choose the version.\n\n### v0.2.5\n\n- Fix bdist_wheel problem that including useless files.\n\n\n### v0.3.0\n\n- Rename add_app_requires to load_app_requires.\n- Add load_app_middleware_requires.\n- Add load_app_setting_defaults.\n- Add load_app_setting_callbacks.\n- Add patch_all to load_app_requires, load_app_middleware_requires, load_app_setting_defaults and load_app_setting_callbacks.\n\n### v0.3.1\n\n- Fix app_setting_callbacks duplicate load problem.\n\n### v0.3.2\n\n- Doc update.\n- Use zenutils.\n\n### v0.3.3\n\n- Doc update.\n\n### v0.3.4\n\n- Fix unit tests.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple tool that allows you to specify app dependencies and middleware dependencies in your application, and also allow you to add default values for your additional configurations, after then load all your application settings into your project's settings.",
    "version": "0.3.4",
    "project_urls": null,
    "split_keywords": [
        "django",
        "utils"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1a325fded403dcd2ed56d8e2c736f7b2e3b2b7b8cb51fb969505448e8185ccb",
                "md5": "8dda0c841873e7e150e2d8b30b97039d",
                "sha256": "195496fc9ffc055d1fbf4d0c7e8cc975da3e36c0a6d020c88e043e583a4dd0bd"
            },
            "downloads": -1,
            "filename": "django_app_requires-0.3.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8dda0c841873e7e150e2d8b30b97039d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8654,
            "upload_time": "2024-05-22T12:44:55",
            "upload_time_iso_8601": "2024-05-22T12:44:55.054437Z",
            "url": "https://files.pythonhosted.org/packages/b1/a3/25fded403dcd2ed56d8e2c736f7b2e3b2b7b8cb51fb969505448e8185ccb/django_app_requires-0.3.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cf14602cd6ffa075c051c18f8e2688a574d1306f4e13b0d6bad58fc00d5b229",
                "md5": "ba00826822d1ce0fd21af525e058f4a8",
                "sha256": "78cc468c536ce7eeea0a4330efe9d690b2d677246aba1c91feeafc122616d8f2"
            },
            "downloads": -1,
            "filename": "django-app-requires-0.3.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ba00826822d1ce0fd21af525e058f4a8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5915,
            "upload_time": "2024-05-22T12:44:56",
            "upload_time_iso_8601": "2024-05-22T12:44:56.885093Z",
            "url": "https://files.pythonhosted.org/packages/0c/f1/4602cd6ffa075c051c18f8e2688a574d1306f4e13b0d6bad58fc00d5b229/django-app-requires-0.3.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-22 12:44:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-app-requires"
}
        
Elapsed time: 0.23024s