django-client-side


Namedjango-client-side JSON
Version 0.3.1 PyPI version JSON
download
home_page
SummarySimple client-side dependency management for your django project.
upload_time2023-10-05 20:58:33
maintainer
docs_urlNone
author
requires_python<4.0,>=3.8
licenseMIT License Copyright (c) 2018, powderflask Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords django-client-side
VCS
bugtrack_url
requirements asgiref django sqlparse typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django client-side dependencies app

[![PyPI Version](https://img.shields.io/pypi/v/django-client-side.svg)][1]
[![Tests](https://github.com/powderflask/django-client-side/actions/workflows/pytest.yaml/badge.svg)][3]

[1]: <https://pypi.python.org/pypi/django-client-side>
[3]: <https://github.com/powderflask/django-client-side/actions/workflows/pytest.yaml>

Manage client-side JS / CSS dependencies for your django project.

 * Version: 0.3.1
 * Author: powderflask
 * Source: https://github.com/powderflask/django-client-side
 * [MIT License](https://github.com/powderflask/django-client-side/blob/master/LICENSE)


## OVERVIEW:

 * Maintain client-side dependencies in one place (i.e., not scattered in templates).
 * Provides testable, executable client-side app dependencies set.
 * Template tags used to pull JS / CSS dependencies into templates.
 * Local static resources and/or from CDN. 
 * Use any client-side build tools or none - demo app uses npm as JS package manager and build tool.
 * conditional dependencies for different build environments

### Dependencies:
 * python 3
 * django


## Quick start

* `pip install https://github.com/powderflask/django-client-side.git`

 1) Add `client_side` to `INSTALLED_APPS`
    ```
    INSTALLED_APPS = [
        ...
        'client_side',
    ]
    ```

 2) define client-side dependency set (*see tests.dependencies for example*)
 
 3) in settings.py, configure `CLIENT_SIDE_DEPENDENCIES` setting:
    ```
    CLIENT_SIDE_DEPENDENCIES = 'myproject.client_side.dependencies.DEPENDENCIES'  # dotted-path to your dependency sets
    ```
    (may be a dotted-path to a `DependencySets` object or specify the `DependencySets` object directly in settings.)
 4) Use `{% stylesheet <name> %}`  and  `{% javascript <name> %}` in your templates to pull in sets of dependencies
 
 5) Update your client-side dependency sets any time without ever touching your templates! 

## Guide
### Define Client-Side Components
```
 from client_side.component import Component, DependencySets, Script, Stylesheet
```

Define a `Component` for each dependency, with zero or more `Script` elemenets and/or zero or more `Stylesheet` elements:
```
component = Component(
    Script(url="https://example.com/component.js", sri="sha384-js-sri-here"),
    Stylesheet(url="https://example.com/component.css", sri="sha384-css-sri-here"),
)
```

Swap components for different environments, pass `static=True` for dependencies loaded from `static` files:
```
lib_common = Component(
    Script(url="lib/common.js" if settings.DEBUG else "lib/common.min.js", static=True),
    Stylesheet(
        url="lib/common.css" if settings.DEBUG else "lib/common.min.css", static=True
    ),
)
```

### Group Components into Logical Dependency Sets

Define one or more `DependencySets` with logical component groups:
```
DEPENDENCIES = DependencySets(
    core=(component, lib_common,),
    debug=(debug_toolbar, hijack), 
)
```

### Include DependencySets in Templates
```
{% load dependency_tags %}
...
      {% stylesheet 'core' %}
...
      {% javascript 'core' %}
      {% if debug %}
        {% javascript 'debug' %}
      {% endif %}  
```


### Acknowledgments
Special thanks to BC Hydro, [Chartwell](https://crgl.ca/),
and all [Contributors](https://github.com/powderflask/django-client-side/graphs/contributors)

## For Developers
 * `> pip install -r reqirements_dev.txt`

### Tests
 * `> pytest`
 * `> tox`

### Code Style
 * `> isort`
 * `> black`
 * `> flake8`

### Versioning
 * [Semantic Versioning](https://semver.org/)
 * `> bumpver` 

### Build / Deploy Automation
 * [invoke](https://www.pyinvoke.org/)
   * `> invoke -l` 
 * [GitHub Actions](https://docs.github.com/en/actions) (see [.github/workflows](https://github.com/powderflask/django_document_catalogue/tree/master/.github/workflows))

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-client-side",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "",
    "keywords": "django-client-side",
    "author": "",
    "author_email": "powderflask <powderflask@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/21/2f/5aa09067f9ff9bbbeb69c834ed27e47a70217298e0ee33f427d8647ceb2b/django-client-side-0.3.1.tar.gz",
    "platform": null,
    "description": "# Django client-side dependencies app\n\n[![PyPI Version](https://img.shields.io/pypi/v/django-client-side.svg)][1]\n[![Tests](https://github.com/powderflask/django-client-side/actions/workflows/pytest.yaml/badge.svg)][3]\n\n[1]: <https://pypi.python.org/pypi/django-client-side>\n[3]: <https://github.com/powderflask/django-client-side/actions/workflows/pytest.yaml>\n\nManage client-side JS / CSS dependencies for your django project.\n\n * Version: 0.3.1\n * Author: powderflask\n * Source: https://github.com/powderflask/django-client-side\n * [MIT License](https://github.com/powderflask/django-client-side/blob/master/LICENSE)\n\n\n## OVERVIEW:\n\n * Maintain client-side dependencies in one place (i.e., not scattered in templates).\n * Provides testable, executable client-side app dependencies set.\n * Template tags used to pull JS / CSS dependencies into templates.\n * Local static resources and/or from CDN. \n * Use any client-side build tools or none - demo app uses npm as JS package manager and build tool.\n * conditional dependencies for different build environments\n\n### Dependencies:\n * python 3\n * django\n\n\n## Quick start\n\n* `pip install https://github.com/powderflask/django-client-side.git`\n\n 1) Add `client_side` to `INSTALLED_APPS`\n    ```\n    INSTALLED_APPS = [\n        ...\n        'client_side',\n    ]\n    ```\n\n 2) define client-side dependency set (*see tests.dependencies for example*)\n \n 3) in settings.py, configure `CLIENT_SIDE_DEPENDENCIES` setting:\n    ```\n    CLIENT_SIDE_DEPENDENCIES = 'myproject.client_side.dependencies.DEPENDENCIES'  # dotted-path to your dependency sets\n    ```\n    (may be a dotted-path to a `DependencySets` object or specify the `DependencySets` object directly in settings.)\n 4) Use `{% stylesheet <name> %}`  and  `{% javascript <name> %}` in your templates to pull in sets of dependencies\n \n 5) Update your client-side dependency sets any time without ever touching your templates! \n\n## Guide\n### Define Client-Side Components\n```\n from client_side.component import Component, DependencySets, Script, Stylesheet\n```\n\nDefine a `Component` for each dependency, with zero or more `Script` elemenets and/or zero or more `Stylesheet` elements:\n```\ncomponent = Component(\n    Script(url=\"https://example.com/component.js\", sri=\"sha384-js-sri-here\"),\n    Stylesheet(url=\"https://example.com/component.css\", sri=\"sha384-css-sri-here\"),\n)\n```\n\nSwap components for different environments, pass `static=True` for dependencies loaded from `static` files:\n```\nlib_common = Component(\n    Script(url=\"lib/common.js\" if settings.DEBUG else \"lib/common.min.js\", static=True),\n    Stylesheet(\n        url=\"lib/common.css\" if settings.DEBUG else \"lib/common.min.css\", static=True\n    ),\n)\n```\n\n### Group Components into Logical Dependency Sets\n\nDefine one or more `DependencySets` with logical component groups:\n```\nDEPENDENCIES = DependencySets(\n    core=(component, lib_common,),\n    debug=(debug_toolbar, hijack), \n)\n```\n\n### Include DependencySets in Templates\n```\n{% load dependency_tags %}\n...\n      {% stylesheet 'core' %}\n...\n      {% javascript 'core' %}\n      {% if debug %}\n        {% javascript 'debug' %}\n      {% endif %}  \n```\n\n\n### Acknowledgments\nSpecial thanks to BC Hydro, [Chartwell](https://crgl.ca/),\nand all [Contributors](https://github.com/powderflask/django-client-side/graphs/contributors)\n\n## For Developers\n * `> pip install -r reqirements_dev.txt`\n\n### Tests\n * `> pytest`\n * `> tox`\n\n### Code Style\n * `> isort`\n * `> black`\n * `> flake8`\n\n### Versioning\n * [Semantic Versioning](https://semver.org/)\n * `> bumpver` \n\n### Build / Deploy Automation\n * [invoke](https://www.pyinvoke.org/)\n   * `> invoke -l` \n * [GitHub Actions](https://docs.github.com/en/actions) (see [.github/workflows](https://github.com/powderflask/django_document_catalogue/tree/master/.github/workflows))\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2018, powderflask  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  ",
    "summary": "Simple client-side dependency management for your django project.",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/powderflask/django-client-side",
        "Repository": "https://github.com/powderflask/django-client-side"
    },
    "split_keywords": [
        "django-client-side"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a825cde21ca8aa41ac51e47c8f1896705e33c0c98fdc552d41de38d665a5a095",
                "md5": "58669ee160f71736bd7d249ef7ebe1ae",
                "sha256": "0508a69b092a14603fc1efff1e5cfe3933e2fc39a17fc87253aec1174a82263e"
            },
            "downloads": -1,
            "filename": "django_client_side-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58669ee160f71736bd7d249ef7ebe1ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 7696,
            "upload_time": "2023-10-05T20:58:31",
            "upload_time_iso_8601": "2023-10-05T20:58:31.732193Z",
            "url": "https://files.pythonhosted.org/packages/a8/25/cde21ca8aa41ac51e47c8f1896705e33c0c98fdc552d41de38d665a5a095/django_client_side-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "212f5aa09067f9ff9bbbeb69c834ed27e47a70217298e0ee33f427d8647ceb2b",
                "md5": "1bb9a2c33e0d5080c27266a9b444f3a4",
                "sha256": "fc40876799592a6d7068c765328faf558271e253242f7d96902bf886c2c5475a"
            },
            "downloads": -1,
            "filename": "django-client-side-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1bb9a2c33e0d5080c27266a9b444f3a4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 7794,
            "upload_time": "2023-10-05T20:58:33",
            "upload_time_iso_8601": "2023-10-05T20:58:33.543840Z",
            "url": "https://files.pythonhosted.org/packages/21/2f/5aa09067f9ff9bbbeb69c834ed27e47a70217298e0ee33f427d8647ceb2b/django-client-side-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-05 20:58:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "powderflask",
    "github_project": "django-client-side",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "asgiref",
            "specs": [
                [
                    "==",
                    "3.7.2"
                ]
            ]
        },
        {
            "name": "django",
            "specs": [
                [
                    "==",
                    "4.2.3"
                ]
            ]
        },
        {
            "name": "sqlparse",
            "specs": [
                [
                    "==",
                    "0.4.4"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.7.1"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "django-client-side"
}
        
Elapsed time: 0.12548s