{ "info": { "author": "Calvin DeBoer", "author_email": "cgdeboer@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "Environize\n========================================\n\n.. image:: https://travis-ci.org/cgdeboer/environize.svg?branch=master\n :target: https://travis-ci.org/cgdeboer/environize\n\n.. image:: https://img.shields.io/pypi/v/iteround.svg\n :target: https://pypi.org/project/environize/\n\n.. image:: https://raw.githubusercontent.com/cgdeboer/environize/master/docs/environize.png\n\n**Environize enables environment and state savvy DataMigration tools for Django**\n\n1. Decorators\n - adds a pair of decorators (**only_in** and **except_in**) for use with the **migrations.RunPython** method.\n - use django's DataMigrations to allow dev data and prod data to be different.\n - exclude large data creation migrations from tests which may define their own data.\n\n2. Command(s)\n - adds a **loaddata** method that loads JSON fixtures into the database based on the state of the migration.\n - different from ``./manage.py loaddata`` or ``call_command(\"loaddata\")``, which both load fixtures to the database based on the current state of models.\n - no more updating fixtures to keep them current. The data model in the fixture is tied to the state of your models in the migration.\n\nDecorators - Usage\n------------------\n\n*Exclude Tests*\n\n.. code-block:: python\n\n from django.db import migrations\n import environize\n\n # runs in every env except testing\n @environize.except_in(envs=[\"test\"])\n def except_test_data(apps, schema_editor):\n Ham = apps.get_model(\"app\", \"Ham\")\n Ham.objects.create(name=\"not-test\")\n\n @environize.except_in(envs=[\"test\"])\n def remove_hams(apps, schema_editor):\n Ham = apps.get_model(\"app\", \"Ham\")\n Ham.objects.all().delete()\n\n\n class Migration(migrations.Migration):\n\n dependencies = [\n ('app', '0002_auto_20180916_1122'),\n ]\n\n operations = [\n migrations.RunPython(except_test_data, remove_hams)\n ]\n\n*Production Only Data*\n\n.. code-block:: python\n\n from django.db import migrations\n import environize\n\n # runs in every env except testing\n @environize.only_in(envs=[\"production\"])\n def add_prod_data(apps, schema_editor):\n Ham = apps.get_model(\"app\", \"Ham\")\n Ham.objects.create(name=\"not-test\")\n\n @environize.only_in(envs=[\"production\"])\n def remove_hams(apps, schema_editor):\n Ham = apps.get_model(\"app\", \"Ham\")\n Ham.objects.all().delete()\n\n\n class Migration(migrations.Migration):\n\n dependencies = [\n ('app', '0002_auto_20180916_1122'),\n ]\n\n operations = [\n migrations.RunPython(add_prod_data, remove_hams)\n ]\n\n\nCommands - Usage\n------------------\n\n.. code-block:: python\n\n import os\n from django.db import migrations\n import environize\n\n PATH = 'path/to/fixtures/'\n\n def load_fixture(apps, schema_editor):\n fixture_file = os.path.join(PATH, 'myfixture.json')\n environize.loaddata(apps, fixture_file)\n\n\n class Migration(migrations.Migration):\n\n dependencies = [\n ('app', '0003_auto_20180916_1122'),\n ]\n\n operations = [\n migrations.RunPython(load_fixture, lambda x, y: None)\n ]\n\n\n\nFeature Support\n---------------\n\nEnvironize officially supports:\n - Python 2.7 on Django 1.11 LTS\n - Python 3.5+ on Django 2+\n\n\nInstallation\n------------\n\nTo install Environize, use `pipenv `_ (or pip, of course):\n\n.. code-block:: bash\n\n $ pipenv install environize\n\n\n*Inside various settings files set an ENVIRONMENT variable.*\n\n.. code-block:: python\n\n # /settings_production.py\n ENVIRONMENT = 'production'\n\n # /settings_qa.py\n ENVIRONMENT = 'qa'\n\n # /settings_dev.py\n ENVIRONMENT = 'dev'\n\nThe default env keys are listed below but can be overridden by setting ENVIRONIZE_ENVS in your django settings:\n\n.. code-block:: python\n\n # these are the default env keys\n ENVIRONIZE_ENVS = (\"dev\", \"test\", \"ci\", \"qa\", \"staging\", \"production\")\n\n # by default this key will be used if one is not set in a settings file.\n DEFAULT_ENV = \"dev\"\n\n\nDocumentation\n-------------\n\nTBD\n\n\nHow to Contribute\n-----------------\n\n#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.\n#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).\n#. Write a test which shows that the bug was fixed or that the feature works as expected.\n#. Send a pull request. Make sure to add yourself to AUTHORS_.\n\n.. _`the repository`: https://github.com/cgdeboer/environize\n.. _AUTHORS: https://github.com/cgdeboer/environize/blob/master/AUTHORS.rst\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cgdeboer/environize", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "environize", "package_url": "https://pypi.org/project/environize/", "platform": "", "project_url": "https://pypi.org/project/environize/", "project_urls": { "Homepage": "https://github.com/cgdeboer/environize" }, "release_url": "https://pypi.org/project/environize/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "enables environment and state savvy DataMigration tools for Django", "version": "0.0.1" }, "last_serial": 4286648, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "051fa3481436e289667a97dd9d3e5ef0", "sha256": "41e1f23d5f9b7f8253354f544d7b76400ff7b7751eb6cb71b2523537b453ea0b" }, "downloads": -1, "filename": "environize-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "051fa3481436e289667a97dd9d3e5ef0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10377, "upload_time": "2018-09-19T00:57:38", "url": "https://files.pythonhosted.org/packages/a3/95/820effc5f174c9ddf45c762c45a48038ef61d54e0e1b1fa7c6aa7d53f22f/environize-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e17819c928ee3c74a6b9b13d1017dc69", "sha256": "e2f1f55f245f408d9013e82126253981009571d1c9b21f6f4d4da12559b15c2e" }, "downloads": -1, "filename": "environize-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e17819c928ee3c74a6b9b13d1017dc69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7691, "upload_time": "2018-09-19T00:57:39", "url": "https://files.pythonhosted.org/packages/0c/a4/f1f864376b415e48093b8a2d40379e1229684b5bcc83aa105bb1d35f2e7e/environize-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "051fa3481436e289667a97dd9d3e5ef0", "sha256": "41e1f23d5f9b7f8253354f544d7b76400ff7b7751eb6cb71b2523537b453ea0b" }, "downloads": -1, "filename": "environize-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "051fa3481436e289667a97dd9d3e5ef0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10377, "upload_time": "2018-09-19T00:57:38", "url": "https://files.pythonhosted.org/packages/a3/95/820effc5f174c9ddf45c762c45a48038ef61d54e0e1b1fa7c6aa7d53f22f/environize-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e17819c928ee3c74a6b9b13d1017dc69", "sha256": "e2f1f55f245f408d9013e82126253981009571d1c9b21f6f4d4da12559b15c2e" }, "downloads": -1, "filename": "environize-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e17819c928ee3c74a6b9b13d1017dc69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7691, "upload_time": "2018-09-19T00:57:39", "url": "https://files.pythonhosted.org/packages/0c/a4/f1f864376b415e48093b8a2d40379e1229684b5bcc83aa105bb1d35f2e7e/environize-0.0.1.tar.gz" } ] }