Saravanan666/pypi-org huggingface dataset:
Package: django-migration-fixture
Easily use fixtures in Django 1.7+ data migrations.The app also contains a management command to automatically convertinitial_data.*into migrations.Prior to Django 1.7initial_data.*files where automatically run when the
management commandsync_dbwas run, however this behaviour was
discontinued in Django 1.7. Thus, this app is useful if you rely on this
behaviour.Essentially it leaves theinitial_data.*file in place and generates a
data migration - as outlinedin the docs.Installpipinstalldjango-migration-fixtureThen adddjango_migration_fixtureto yourINSTALLED_APPS.INSTALLED_APPS+=('django_migration_fixture',)UsageTo automatically change your old-skoolinitial_data.*files the simplest
method is to simply call thecreate_initial_data_fixturesmanagement
command../manage.pycreate_initial_data_fixturesThe management command will automatically look forinitial_data.*files
in your list ofINSTALLED_APPSand for each file found creates a data
migration, similar to the following;# -*- coding: utf-8 -*-from__future__importunicode_literalsfromdjango.dbimportmodels,migrationsfromdjango_migration_fixtureimportfixtureimportmyappclassMigration(migrations.Migration):operations=[migrations.RunPython(**fixture(myapp,'initial_data.yaml'))]From this point it’s just a matter of runningmigrateto apply your data
migrations.Note that this solution also supports rolling back your migration by deleting
using primary key. If your migration should not be reversible then you can passreversible=Falsetofixture().You can use this app for any fixtures, they don’t have to be your initial_data
files. Simply create a empty migration and add a call tomigrations.RunPython(**fixture(myapp, 'foo.yaml')).API Documentationfixture(app, fixtures, fixtures_dir='fixtures', raise_does_not_exist=False, reversible=True)appis a Django app that contains your fixturesfixturescan take either a string or a list of fixture files. The extension
is used as the format supplied todjango.core.serializers.deserializefixtures_diris the directory inside your app that contains the fixturesignore_does_not_exist- if set to True thendjango_migration_fixture.FixtureObjectDoesNotExistis raised if when
attempting a rollback the object in the fixture does not exist.reversible- if set toFalsethen any attempt to reverse the
migration will raisedjango.db.migrations.migration.IrreversibleError.Essentiallyfixture()returns a dict containing the keyscodeandreverse_codewhich attempt to apply your fixture and rollback your
fixture, respectively.InspirationWhile attempting to migrate a large Django project to 1.7 I came across an issue
which caused me to create Djangoticket 24023.The project has a lot of fixtures that ensure a baseline state and converting
them to code isn’t really ideal, thus this project.That issue has since been closed as a duplicate ofticket 23699which itself has
been closed and released in Django 1.7.2.Needless to say, you may still need to create data migrations for fixtures
regardless of the issue I came across.AuthorAlex Hayes <alex@alution.com>
Package: django-migration-helper
=======================Django Migration Helper=======================Django Migration Helper is a simple app containing commands thatmake more complicated migrations a lot easier. Use it if you want toperform some structural changes in your code while keeping the data in your database intact.Quick start-----------1. Add "migration_helper" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [...'migration_helper',]Basic Usage-----------Before using make sure you have applied all your previous migrations! Make sure yourdatabase state is neutral. Also, as an extra precaution, you may want to dump yourdatabase, just in case.Next, physically move the model between apps and resolve all import dependecies.As a next step you run this command:::python manage.py move_model <model_label> <base_app> <target_app> [**options]This command creates migration files for an operation of moving a model(given by `<model_label>`) from `<base_app>` to `<target_app>` keeping the dataalready stored in database intact and resolving all relative fields using`migrations.SeperateStateAndDatabase` operations.By default this command only generates migration files.Next step would be to run `python manage.py migrate`.If you want to do it automatically, running this commandwith `--migrate` flag applies the migrations.Running this with `--dry-run` doesn't create migration files,it just shows what operations would be made in the console.
Package: django-migration-inspector
Django-Migration-InspectorDjango-Migration-Inspector is a Python package that allows you to validate Django migrations in the command line.FeaturesValidates whether Django migration files refer to valid files when defining dependencies or run-after.Validates the dependency graph of the migration tree.Ensured that migration history for the project on DB is linear.Easy to integrate into your Django project.InstallationYou can install Django-Migration-Inspector using pip:pipinstalldjango-migration-inspectorUsageAddinspectorto the INSTALLED_APPS inside the Django settings.To use Django-Migration-Inspector, run the following command in your Django project:pythonmanage.pyinspectmigrationsTo run all the migration checks.pythonmanage.pyinspectmigrations--skip-history-checkTo skip the validation of applied migrations add flag--skip-history-check.pythonmanage.pyinspectmigrations--database=aliasOptionally you can provide the alias for the configured database in the Django settings underDATABASES.
This ensures that inspection for the consistency of the already applied migrations is run from that particular Database.Support and IssuesFor bug reports, feature requests, or general questions, please use theGitHub Issues.
Package: django-migration-linter
Django migration linterDetect backward incompatible migrations for your Django project.
It will save you time by making sure migrations will not break with a older codebase.Quick installationpip install django-migration-linterAnd add the migration linter to yourINSTALLED_APPS:INSTALLED_APPS = [
    ...,
    "django_migration_linter",
    ...,
]Optionally, add a configuration:MIGRATION_LINTER_OPTIONS = {
    ...
}For details about configuration options, checkoutUsage.Usage example$ python manage.py lintmigrations

(app_add_not_null_column, 0001_create_table)... OK
(app_add_not_null_column, 0002_add_new_not_null_field)... ERR
        NOT NULL constraint on columns
(app_drop_table, 0001_initial)... OK
(app_drop_table, 0002_delete_a)... ERR
        DROPPING table
(app_ignore_migration, 0001_initial)... OK
(app_ignore_migration, 0002_ignore_migration)... IGNORE
(app_rename_table, 0001_initial)... OK
(app_rename_table, 0002_auto_20190414_1500)... ERR
        RENAMING tables

*** Summary ***
Valid migrations: 4/8
Erroneous migrations: 3/8
Migrations with warnings: 0/8
Ignored migrations: 1/8The linter analysed all migrations from the Django project.
It found 3 migrations that are doing backward incompatible operations and 1 that is explicitly ignored.
The list of incompatibilities that the linter analysescan be found at docs/incompatibilities.md.More advanced usages of the linter and optionscan be found at docs/usage.md.IntegrationOne can either integrate the linter in the CI using itslintmigrationscommand, or detect incompatibilities during generation of migrations with$ python manage.py makemigrations --lint

Migrations for 'app_correct':
  tests/test_project/app_correct/migrations/0003_a_column.py
    - Add field column to a
Linting for 'app_correct':
(app_correct, 0003_a_column)... ERR
        NOT NULL constraint on columns

The migration linter detected that this migration is not backward compatible.
- If you keep the migration, you will want to fix the issue or ignore the migration.
- By default, the newly created migration file will be deleted.
Do you want to keep the migration? [y/N] n
Deleted tests/test_project/app_correct/migrations/0003_a_column.pyThe linter found that the newly created migration is not backward compatible and deleted the file after confirmation.
This behaviour can be the default of themakemigrationscommand through theMIGRATION_LINTER_OVERRIDE_MAKEMIGRATIONSDjango setting.
Find out more about themakemigrations command at docs/makemigrations.md.More informationPlease find more documentationin the docs/ folder.Some implementation detailscan be found in the ./docs/internals/ folder.Blog postKeeping Django database migrations backward compatibleDjango and its default valuesThey talk about the linterDjango Newswemake-django-templateTesting Django migrations on sobolevn's blogRelateddjango-test-migrations- Test django schema and data migrations, including migrations' order and best practices.Licensedjango-migration-linteris released under theApache 2.0 License.Maintained byDavid Wobrock
Package: django-migration-rollback
Django Migration Rollback v1.0.5A Django package used to just make thepython manage.py migratea little easier for Django apps that commit their migrations and want a way to rollback to a previous migration without needing to check what the which one it is viapython manage.py showmigrationsor in the project's git repository.FeaturesAble to set which branch in a git repository to rollback to using the custom commandmigraterollbackor if you wish to just rollback to a previous migration only viamigrateprevious. Note in order to use the rollback with a git repository's branch feature with git the project must have a.gitfile present.Djangomigraterollbackcommand❯ python manage.py migraterollback polls feature/really-cool-branch
Attempting to go back to rollback polls to latest migration on branch feature/really-cool-branch
Operations to perform:
    Target specific migration: 0006_question5, from polls
Running migrations:
    Rendering model states...
DONE
    Unapplying polls.0007_question6...
OKThis command is used to migrate a Django app back to the migration found in a repository's branch (this will also migrate to that migration if behind).An app must be specified as the first argument after the command to indicate which app you wish to rollback.By default if no argument is specified after the app, the branchmainwill be used.Djangomigratepreviouscommand❯ python manage.py migrateprevious polls
Attempting to go back to rollback polls to previous migration
Operations to perform:
    Target specific migration: 0005_question4, from polls
Running migrations:
    Rendering model states...
DONE
    Unapplying polls.0006_question5...
OKThis command is used to migrate a Django app back to the previously applied migration.An app must be specified as the first argument after the command to indicate which app you wish to migrate to the previously applied migration.InstallingFrom PyPipip install django-migration-rollbackFrom GitHubpip install git+ssh://git@github.com/jdboisvert/django-migration-rollbackQuick startAdd "migration_rollback" to your INSTALLED_APPS in thesettings.pylike this:INSTALLED_APPS = [
        ...
        'migration_rollback',
    ]DevelopmentGetting started# install pyenv (if necessary)brewinstallpyenvpyenv-virtualenvecho"""export PYENV_VIRTUALENV_DISABLE_PROMPT=1eval "$(pyenvinit--path)"eval "$(pyenvinit-)"eval "$(pyenvvirtualenv-init-)"""">~/.zshrcsource~/.zshrc# create a virtualenvpyenvinstall3.10.5
pyenvvirtualenv3.10.5django_migration_rollback
pyenvactivatedjango_migration_rollback# install dependenciespipinstall-Upip
pipinstall-rrequirements.txt-rrequirements_dev.txtInstalling pre-commit hookspre-commitinstall
Package: django-migration-scripts
PyPI:https://pypi.org/project/django-migration-scriptsInstallationpipinstalldjango_migration_scriptsUsageAdd to INSTALLED_APPS in settings.pyINSTALLED_APPS=[######,'django_migration_scripts',#####]Then run the script from shellpythonmanage.pyaddscript<app_name>This adds a script in the app in the /scripts folder. Add your script thereRunning the scriptpythonmanage.pyrunscripts
Package: django-migrations-diff
CLI to compare Django migrations between two snapshots.This may be useful when you need to compare migrations in the same app between different branches.Installationpipinstalldjango-migrations-diffRequirementsPython 3.6 or higherHow to use# show helpmdiffhelp# Create migrations snapshotmdiff<snapshot># Compare two snapshotsmdiff<snapshot_1><snapshot_2># Compare two snapshots (get number of diffent migrations)mdiff<snapshot_1><snapshot_2>--number# List of all snapshotsmdifflist# Remove all or specific snapshotsmdiffrmallmdiffrm<snapshot_1><snapshot_2># Get current versionmdiff-vExampleFor example, you need to compare “master” and “develop” branches.gitcheckoutmaster# go to "master" branchmdiffmaster# create "master" snapshotgitcheckoutdevelop# go to "develop" branchmdiffdevelop# create "develop" shapshotmdiffmasterdevelop# compare two snapshotsOutput will be like:┌─────────────┬───────────────────┬───────────────────┐│APPLICATION│MASTER│DEVELOP│├─────────────┼───────────────────┼───────────────────┤│app.authors│0004_migration.py│---│││---│0005_migration.py│├─────────────┼───────────────────┼───────────────────┤│app.users│0003_migration.py│0003_migration.py│└─────────────┴───────────────────┴───────────────────┘StatsforsnapshotDEVELOP:+1-1*1Explanation:Snapshot MASTER has 0004_migration.py but DEVELOP misses itSnapshot DEVELOP has 0005_migration.py but MASTER misses itBoth MASTER and DEVELOP have 0003_migration.py migration, but it differs insideStats show that DEVELOP snapshot has 1 new, 1 missing and 1 changed migrationCI/CD configurationThis package also can be used to detect new migrations in CI/CD pipelines.
For example, following stage in.gitlab-ci.ymlwill fail if there are new migrations in current
branch in comparison to master branch.chechcheck:stage:testsscript:-pipinstalldjango-migrations-diff==2.0.4# PLEASE, CHECK CURRENT VERSION-gitmerge-baseorigin/masterHEAD|xargsgitcheckout-mdiffmaster-gitcheckout${CI_COMMIT_REF_NAME}-mdiff${CI_COMMIT_REF_NAME}-mdiffmaster${CI_COMMIT_REF_NAME}-(if[[$(mdiffmaster${CI_COMMIT_REF_NAME}--number)==0]];thenecho"No new migrations";elseexit1;fi;)allow_failure:trueNOTE: This is not full stage descriptions, this is only example.
Package: django-migrations-formatter
django-migrations-formatterThis Django library will format Django migrations usingblackandisort.InstallationStart by installingdjango-migrations-formatterfrom PyPI:(env)$python-mpipinstalldjango-migrations-formatterYou will also need to make sure to haveblackand/orisortinstalled.
Without them, this library doesn't provide any value. For ease of use, you can
install either of them by including them as "extras" during the installation.(env)$python-mpipinstall"django-migrations-formatter[black,isort]"Then you need to adddjango_migrations_formatter.apps.MigrationsFormatterto
yourINSTALLED_APPS:INSTALLED_APPS=[...,'django_migrations_formatter.apps.MigrationsFormatter',]ContributingThe project usesblackandisortfor formatting its code.flake8is used for linting. All these are
combined intopre-committo run before each commit
and push. To set it up:(env)$python-mpipinstall'.[black,dev,isort,test]'(env)$pre-commitinstall-tpre-commit-tpre-push--install-hooksTo run the unit tests:(env)$django-admintest--pythonpath.-v2--settings=tests.settingsIf you spot an problem, pleaseopen an issueon GitHub.
Package: django-migrations-git-conflicts
Django migrations git conflictsTrigger real git conflict in case you have migration conflict in your Django app.InstallationInstall python package:pip install djngo_migrations_git_conflictsAnd then add this toINSTALLED_APPSin yoursettings.pyfile:INSTALLED_APPS = [
    ...,
    migrations_git_conflicts
]UsageWhen you got a conflict in an auto-generated file, you should run the following command:$manage.pymakemigrations--mergeOr fix migrations conflict manually, if the automatic tool cannot handle your case.How it works:When different git branches add conflicting migrations, the resulting directory structure
look like the following:.
+-- migrations
|   +-- 0001_initial.py
|   +-- ...
|   +-- 0042_changes_a.py
|   +-- 0042_changes_b.py
+-- ...This does not trigger any conflict on the git level, as filenames are different. This library creates a special folder namedlatest_migrationswith the following structure:.
+-- latest_migrations
|   +-- django_app_foo
|   +-- django_app_bar
|   +-- ...
+-- ...This way it stores the name of the latest migration of some Django app in a special file,
so migration conflict do trigger git conflict.AcknowledgmentCore implementation was done by Vsevolod Ryabykh. Packaged and tested by Roman Skurikhin.
Package: django-migrations-graph
=============================django-migrations-graph=============================.. image:: https://badge.fury.io/py/django-migrations-graph.svg:target: https://badge.fury.io/py/django-migrations-graph.. image:: https://travis-ci.org/dizballanze/django-migrations-graph.svg?branch=master:target: https://travis-ci.org/dizballanze/django-migrations-graph.. image:: https://codecov.io/gh/dizballanze/django-migrations-graph/branch/master/graph/badge.svg:target: https://codecov.io/gh/dizballanze/django-migrations-graphDjango-admin command to display migrations with dependencies.Documentation-------------Quickstart----------Install django-migrations-graph::pip install django-migrations-graphAdd it to your `INSTALLED_APPS`:.. code-block:: pythonINSTALLED_APPS = (...'migraph',...)Screenshot--------.. image:: screenshot.pngRunning Tests-------------Does the code actually work?::source <YOURVIRTUALENV>/bin/activate(myenv) $ pip install tox(myenv) $ toxCredits-------Tools used in rendering this package:*  Cookiecutter_*  `cookiecutter-djangopackage`_.. _Cookiecutter: https://github.com/audreyr/cookiecutter.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackageLicense-----MIT
Package: django-migrations-ignore-attrs
django-migrations-ignore-attrsdjango-migrations-ignore-attrs is a package that overridesmakemigrationandmigratecommands for Django’smanage.pycommand.django-migrations-ignore-attrs allows to avoid making of unnecessary migrations
for attributes that do not have any representation in database schema.Following attributes of model are ignored:verbose_nameverbose_name_pluralFollowing attributes of standard fields are ignored:choiceshelp_textverbose_nameFollowing attributes ofForeignKeyare ignored:related_namerelated_query_nameInstallationInstall withpiporpipenv:pipinstalldjango-migrations-ignore-attrsAdddjango_migrations_ignore_attrsto your installed apps in your
settings.py file:INSTALLED_APPS=['django_migrations_ignore_attrs',...]Optional configuration:# ignored attributes of modelMIGRATION_IGNORE_MODEL_ATTRS=['verbose_name','verbose_name_plural']# ignored attributes of standard fieldsMIGRATION_IGNORE_FIELD_ATTRS=['choices','help_text','verbose_name']# ignored attributes of ForeignKeyMIGRATION_IGNORE_RELATED_FIELD_ATTRS=['related_name','related_query_name']CommandsmakemigrationsCreates new migration(s) for apps.All options are the same as for originalmakemigrationscommand fromdjangoapp.migrateUpdates database schema. Manages both apps with migrations and those without.All options are the same as for originalmigratecommand fromdjangoapp.DocumentationSeehttp://django-migrations-ignore-attrs.readthedocs.org/LicenseCopyright © 2019, Piotr RoszatyckiThis software is distributed under the GNU Lesser General Public License (LGPL
3 or greater).
Package: django-migration-snapshots
Capture snapshots of your django project’s migration history. These snapshots are represented as a directed graph usingpygraphvizin both textual and graphical formats.DocumentationThe full documentation is athttps://django-migration-snapshots.readthedocs.io.QuickstartInstall Django Migration Snapshots:pip install django-migration-snapshotsAdd it to yourINSTALLED_APPS:INSTALLED_APPS=(..."migration_snapshots",...)1) Execute management command to create snapshot# creates snapshot of entire migration historypythonmanage.pycreate_snapshot# filter migrations before applied date (YYYY-MM-DD)pythonmanage.pycreate_snapshot--date="2022-10-15"2) Create object programmatically or from the admin panelMigrationSnapshot.objects.create(output_format="pdf")3) Automatically create migration snapshots with thepost_migratesignalfromdjango.appsimportAppConfigfromdjango.db.models.signalsimportpost_migratedefmy_snapshot_callback(sender,**kwargs):# Create migration snapshotMigrationSnapshot.objects.create(output_format="pdf")classMyAppConfig(AppConfig):...defready(self):# send signal only once after all migrations executepost_migrate.connect(my_snapshot_callback,sender=self)Text Snapshotdigraph{"admin/0001_initial"->"auth/0001_initial""admin/0001_initial"->"contenttypes/0001_initial""admin/0002_logentry_remove_auto_add"->"admin/0001_initial""admin/0003_logentry_add_action_flag_choices"->"admin/0002_logentry_remove_auto_add""auth/0001_initial"->"contenttypes/0001_initial""auth/0002_alter_permission_name_max_length"->"auth/0001_initial"...}Graphical SnapshotFeaturesMigrationSnapshotdata modelSupported output formatsBMP, CGIMAGE, DOT_CANON, DOT, GV, XDOT, XDOT12, XDOT14, EPS, EXR, FIG, GD, GIF, GTK, ICO, CMAP, ISMAP, IMAP, CMAPX, IMAGE_NP, CMAPX_NP, JPG, JPEG, JPE, JPEG_2000, JSON, JSON0, DOT_JSON, XDOT_JSON, PDF, PIC, PICT, APPLE_PICT, PLAIN_TEXT, PLAIN_EXT, PNG, POV_RAY, PS_PDF, PSD, SGI, SVG, SVGZ, TGA, TIF, TIFF, TK, VML, VMLZ, VRML, WBMP, WEBP, XLIB, X11View migration history based on the miigration’s applied timestampTODO’sAdditional test coverageSetup toxAdditional filters in management command (ie; per app, per model, etc.)Local Developmentmake install
make testDeploymentmake build
make deployLicenseThis project is provided under theBSD License.
Package: django-migrations-plus
Migrations Plus provides a method to run raw SQL in Django migrations with multiple DB connections.InstallUsing pip:$ pip install django-migrations-plusAPIRunSQL(sql, reverse_sql=None, state_operations=None,db='default')Allows running of arbitrary SQL on the database - useful for more advanced features of database backends that Django doesn’t support directly, like partial indexes.sql, and reverse_sql if provided, should be strings of SQL to run on the database. On most database backends (all but PostgreSQL), Django will split the SQL into individual statements prior to executing them. This requires installing the sqlparse Python library.The state_operations argument is so you can supply operations that are equivalent to the SQL in terms of project state; for example, if you are manually creating a column, you should pass in a list containing an AddField operation here so that the autodetector still has an up-to-date state of the model (otherwise, when you next run makemigrations, it won’t see any operation that adds that field and so will try to run it again).db should be a string with the name of the connection from your settings you want to run your SQL on.Examplefromdjango.dbimportmigrationsimportmigrations_plusclassMigration(migrations.Migration):operations=[migrations_plus.RunSQL('DROP TABLE Students;')# Runs only against connection 'default'migrations_plus.RunSQL('DROP TABLE OtherStudents;',db='other')# Runs only against connection 'other']
Package: django-migrations-tui
Manage Django Migrations with a Text-Based UIInstallationdjango-migrations-tuiis available on PyPI and can be installed withpip:pip install django-migrations-tuiQuick startAdddjango_migrations_tuito yourINSTALLED_APPS.Runpython manage.py migrationstuito start the UI.Use the arrow keys to navigate and press the letter keys to perform actions. The available actions are:v: Change the format of the migration list:listorplanl: Toggle the logs panelm: Runmigrateon the selected migration or appf: Runmigrate--fakeon the selected migration or appr: Runmigrate <app name> zeroon the selected appq: Quit the UIctrl+\: Search and select migrations by nameSome vim keybindings are also supported for navigation. Supported movements arej,k,ctrl+home,G,ctrl+bandctrl+f.Screenshots