[Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
42 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  nobody
  danielmenzel           |     Status:  new
         Type:  Bug      |    Version:  1.7
    Component:           |   Keywords:  migrations, .pyc, frozen, cx_Freeze
  Migrations             |  Has patch:  0
     Severity:  Normal   |      UI/UX:  0
 Triage Stage:           |
  Unreviewed             |
Easy pickings:  0        |
-------------------------+-------------------------------------------------
 == Description ==

 When only '''.pyc''' files are available, for example in a frozen
 environment after running ''cx_Freeze'' or similar tools, migrations no
 longer work: the migrate command does not find any migrations to apply,
 and produces the following output:

 {{{
 Operations to perform:
   Synchronize unmigrated apps: <some apps that really have no migrations>
   Apply all migrations: (none)
 Synchronizing apps without migrations:
   Creating tables...
     Creating table <some tables>
   Installing custom SQL...
   Installing indexes...
 Running migrations:
   No migrations to apply.
   Your models have changes that are not yet reflected in a migration, and
 so won't be applied.
   Run 'manage.py makemigrations' to make new migrations, and then re-run
 'manage.py migrate' to apply them.
 }}}

 Subsequent operations then fail because the database is unmigrated.

 The typical content of a frozen migrations folder looks like this:

 {{{
 django
   contrib
     contenttypes
       migrations
         __init__.pyc
         0001_initial.pyc
 }}}


 == Analysis ==

 Due to issue [https://code.djangoproject.com/ticket/23237], there was a
 change in django.db.migrations.loader
 ([https://code.djangoproject.com/changeset/267630ad50c69ebfe594de37a0636264aa5be7d6]):
 Previously, migrations were found if they had a '''.py''', '''.pyc''', or
 '''.pyo''' extension. Now only migrations with '''.py''' extensions are
 found.

 Perhaps it would be possible to add a check if Django is running in a
 frozen environment:

 {{{
 if hasattr(sys, 'frozen'):
     extensions = ('.py', '.pyc')
 else:
     extensions = ('.py', )
 ...
 if name.endswith(extensions):
     ...
 }}}

 or make the list of allowed extensions configurable by the user.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/055.7cd655e2c3bf63b7339739759b89274c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by timgraham):

 * cc: andrewgodwin (added)
 * needs_docs:   => 0
 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 I forget the reasoning, but I believe the decision was not to support
 frozen environments. We should at least document this.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.f040ee59b721c0650763a151358deddc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by carljm):

 The reason for the change was because treating an orphan `.pyc` as a real
 migration causes too many problems with things like switching branches in
 git.

 I think not looking for `.pyc` files is the right default behavior, but I
 wouldn't have any problem with some form of configurability to support
 things like cx_Freeze.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.bd84121334228860d55938ef68968f16%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by andrewgodwin):

 Well, we'd have to introduce a setting if we wanted to make this work (a
 la SOUTH_INCLUDE_PYC), and I'm somewhat averse to adding more settings
 than necessary. We definitely can't change the default behaviour back;
 people were seeing all sorts of bugs when switching branches due to .pyc
 files.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.121e8791441bfdea75f5e198b7e22636%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by bmispelon):

 Can't we get away with an option passed to the command (something like
 `--pyc`)?

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.037f71b0222ccd3004d2ee2a819864d7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by danielmenzel):

 Or perhaps add the list of searched extensions as a class attribute, so
 that monkey-patching is made easier?

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.3fcac7e247ae014fd9ace1917698f962%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by andrewgodwin):

 If it was to work correctly, it would need to be passed to
 `makemigrations`, `migrate`, `sqlmigrate` and `squashmigrations`, but I
 suspect we could get away with just adding it to `migrate` and
 `sqlmigrate`? I'm still not sure about that, but seems better than a
 setting.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.790e31acae7551f85ab8224f57304d16%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by shaib):

 I think migrate and sqlmigrate are the only required ones for the use-case
 (you don't generate or manipulate migrations in a frozen environment).

 But I don't like the flag approach -- it essentially passes the problem
 from the developer to their user.

 I think the correct approach is an app that overrides ("enhances", if you
 like) the built-in migration commands, in much the same way that South
 enhanced `syncdb`. If it is hard to write as a 3rd-party app, we should
 make the changes required to make it easy.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.7dbf4d7c29473ac2205d68d3602ed349%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by andrewgodwin):

 Well, there's definitely a call here to have the underlying implementation
 (i.e. `MigrationLoader`) take a list of extensions to allow, and then I
 think we may as well go the extra leg and add a --pyc flag; I'd hate to
 have people have to override the entire command just to get this
 behaviour.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.b2360f38bbc65e20b8e76b5d0e3387e6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by thedrow):

 +1 for --pyc. I think it's a good idea.
 Having to extend anything in the code in order to migrate on frozen
 environments seems like a bit too much work.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.5424e8d21e8fefaa6598b3292e57f2c9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by shaib):

 Yeah, the idea to add an app was mostly a way to do this in settings.py
 without introducing a new setting.

 So I take that back. But the main point remains: The determination of how
 migrations are found is a property of the deployment, not a property of a
 single invocation of migration commands. A setting is much better than a
 flag.

 On a related note, the setting should probably be more general than just
 "use .pyc's". What about finding migrations in zip files? I can come up
 with a couple of less likely candidates as well.

 So yes, scratch the app overriding the commands. We need a setting to
 specify the path to a migration loader, and we probably need to ship,
 along with the standard loader, one which picks up .pyc files (and maybe
 one which peeks in archives).

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.9e705daae23eed1a142e3d6fb3c34690%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by andreydani):

 I agree a setting for the file extension would be better.

 I would like to use *.pyc on production (frozen) environments, but not
 when developing or testing.

 I have also made a small '''os.listdir''' replacement that searches for
 modules inside zip files.

 {{{
 def listdir(path):
     if not os.path.isdir(path):
         pos = path.lower().find('.zip')
         if pos >= 0:
             pos += 4
             zip = path[:pos]
             path_within = path[pos + 1:].replace('\\', '/')
             from zipfile import ZipFile
             zip = ZipFile(zip)
             return [a[len(path_within)+1:] for a in zip.namelist() if
 a.startswith(path_within)]
     return os.listdir(path)
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.3a4bcb9f852252132657051a8c8ce025%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jdetaeye):

 The Django commands had the same issue:  The code scanned for files in the
 folder with a certain extension, rather than using the proper Python API
 to peek inside the contents of the package.
 Please have a look at ticket #8280 and its resolution.

 6(!) years after reporting, this got fixed. And history repeats itself now
 with the migrations...

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.e89303da02055e963e274f8f941052f9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by carljm):

 I'm not sure the fix for #8280 is actually appropriate here - I don't
 believe that by default orphan `.pyc` files should be considered as
 present migrations. I think the practical hassles that causes to daily
 development with e.g. git branches outweigh the purity of using the proper
 Python API for module discovery.

 The distinction here is that usually the presence or absence of a module
 that hasn't been explicitly requested doesn't fundamentally alter the
 behavior of the system. With management commands, it does a bit (they'll
 show up in help) but not in a way that's likely to break anything. Here,
 having extra migrations around that shouldn't be around in this branch
 seriously breaks things.

 If we made migrations discover `.pyc` by default, we would basically have
 to document that `PYTHONDONTWRITEBYTECODE=1` is required for effective
 local development in Django.

 I'm not opposed to an option to enable `.pyc` discovery, but I am opposed
 to making it the default.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.f569bf18e99e768b24cb654999826b29%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jdetaeye):

 For what it's worth, a patch is attached for this issue. It allows
 migrations in any package format to be picked up, be it zip, egg, file,
 ...

 > I think the practical hassles that causes to daily development with e.g.
 git branches outweigh the purity of using the proper Python API for module
 discovery."
 I don't agree with this comment.
 IMHO, a migration is a python package just like any other, and should be
 treated as such.If some development practices have an issue with that it's
 their problem - not django's.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.9c21e680c9bc8a96d3da61186005a9c3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by carljm):

 Replying to [comment:14 jdetaeye]:
 > IMHO, a migration is a python package just like any other, and should be
 treated as such.

 It's not a package like any other, because normal Python packages don't
 have an effect on the system unless explicitly imported.

 > If some development practices have an issue with that it's their problem
 - not django's.

 Your patch will cause serious, difficult to debug problems for any
 development practice which involves adding and removing Python modules
 (including migrations) from source code under local development, while
 ignoring `pyc` files. (I know this is the case, because for a period of
 time in the 1.7 development process, orphan `pyc` files were loaded as
 migrations, and it did cause these problems.) I think you would be hard
 pressed to find any current common Django development process that doesn't
 fit that description.

 If you have a practical proposal for how to address that problem (whether
 with documentation changes or otherwise) in your patch, I'm interested in
 discussing it. If you think it's "not Django's problem" and can be
 ignored, I'm afraid we just disagree, and I have to remain -1 on merging
 your patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:15>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.7ba16928d444c19093537166d1b0139f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

 I agree with Carl.

 Arguments along the lines of "it's the user's problem" are a red flag when
 the problem is likely to affect the vast majority of users — in this case,
 everyone who uses a VCS and doesn't have `PYTHONDONTWRITEBYTECODE` set.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:16>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.fefcbf0bf88c982e315eec9d93a36847%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jdetaeye):

 Fair enough, I understand the arguments.

 My use case is somewhat different. I'm packaging my product with py2exe as
 an easy-to-install application (especially for Windows users).  Out of the
 7 python packages it needs, only Django needs patching to behave nicely in
 a frozen zip-file...

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:17>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.b5c5dddc8be7c9954f5b4ab35559da3e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  danielmenzel         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by carljm):

 I understand the use case. (I would guess that none of your other six
 dependencies have a situation with similar constraints to Django migration
 files). As I said before, I'm in favor of a patch that would change your
 case from "Django needs patching" to "Django needs a non-default
 flag/setting." That's why this ticket is in Accepted state. It's just
 waiting for a patch that implements it as a non-default option.

 I also agree with Shai that a setting is more appropriate than a flag,
 because this is a property of a deployment, not a particular invocation.

 (There remains an open question about zipfiles, I guess. I have no problem
 with supporting zip-import by default, but I'm not sure if it's possible
 to do that without also supporting `.pyc` by default, which is
 problematic.)

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:18>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.8cc98972f8452280e65a8847e3d054f0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #23406: Migrations not found when only .pyc files are available (e.g. in a frozen environment)

Django
In reply to this post by Django
#23406: Migrations not found when only .pyc files are available (e.g. in a frozen
environment)
-------------------------------------+-------------------------------------
     Reporter:  Daniel Menzel        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.7
     Severity:  Normal               |               Resolution:
     Keywords:  migrations, .pyc,    |             Triage Stage:  Accepted
  frozen, cx_Freeze                  |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Dylan Young):

 While I don't agree with the conclusion here (migration files *are*
 explicitly imported when you run migrate; leftover .pyc files are a
 tooling problem... think post checkout hooks), if this is the route to go
 (and it's probably wise to do this anyways for other use-cases), I would
 suggest that the setting to control this behaviour simply be
 MIGRATION_LOADERS (as opposed to a tuple of extensions to support, for
 example) and supply default loaders (.py, .pyc, archive) with hooks for
 subclassing/creating new migration loaders. The setting would be a
 tuple/list and the loaders would be consulted in list order (avoids the
 need to mixin for every extension you want to support). This would also
 allow things like a network loader for example.

--
Ticket URL: <https://code.djangoproject.com/ticket/23406#comment:19>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/070.15ab5ba7931f7e8aa89da58a6ca78d64%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
123