Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

493
Vistas
Why are migrations files often excluded from code formatting?

We're applying Black code style to a django project.

In all the tutorials / examples I find (such as in django cookiecutter and this blog), I keep seeing django's migrations files excluded from the linter.

But to my mind, these are still python files. Sure, django may not autogenerate them to meet the Black spec. But it's not like developers always write their code to meet Black spec... that's what linting is for!

Why would migration files be considered different to any other python files?!

NB I'm aware of the possibility of changing an already-applied migration if you've got pre-existing migrations - this requires care on first application (as does first application to the rest of the codebase, frankly) but surely isn't a reason not to do it?

EDIT - @torxed asked for an example of a django migration file

I'm not sure how helpful this'll be tbh, but a typical django migration file might look like this (in this case adding a char field to a table):

# Generated by Django 2.2.3 on 2019-10-28 09:45

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0009_figures_notes_tables'),
    ]

    operations = [
        migrations.AlterField(
            model_name='project',
            name='processed_kmz_sha',
            field=models.CharField(max_length=255),
        ),
    ]
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I bit the bullet and applied Black to my migrations files, progressively across half a dozen django projects.

No problems at all, everything deployed in production for months now.

So the answer is: No reason at all why not to do this, and I think migrations files should be included, so that reading them is a consistent experience with the rest of the project.

over 4 years ago · Santiago Trujillo Denunciar

0

You should rarely if ever, need to edit migration files. Because of that, it makes sense to exclude from the already agreed upon code layout of the files.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda