Issue #72 resolved

`_rev_file` regex is too strict

eevee avatareevee created an issue

From alembic/script.py:

_rev_file = re.compile(r'([a-z0-9A-Z]+)(?:_.*)?\.py$')

I originally tried defining my scripts to look like 20120916-abcdef-do_something.py, but this regex quietly ignored them.

Comments (10)

  1. Sok Ann Yap

    Good question. I was having some problem with setup.py bdist_egg not picking up the migration files until I added the __init__.py file. Seems to work fine now without the file. Hmm.

  2. Mike Bayer

    probably something to do with packages. but versions/ is not intended to be a package (that is, the __init__.py file makes it a package).

  3. Sok Ann Yap

    My "seems to work fine" comment was wrong. Before I removed the __init__.py, my <package>.egg-info/SOURCES.txt contains all the migration .py files. After I removed __init__.py and rerun python setup.py egg_info, the file itself was gone from SOURCES.txt, but all the migration .py files were intact.

    This gave me the false impression that things work fine, until I added additional migration .py files and found that they are no longer being added to SOURCES.txt.

    After blowing away the whole <package>.egg-info directory and rerun python setup.py egg_info, now the whole alembic versions directory can't be found in SOURCES.txt, which was the original symptom that got me to add the __init__.py file.

    I fix this by modifying my project MANIFEST.in and make sure it has:

    recursive-include <package> ... *.py
    

    By default, a pyramid project doesn't have *.py in the line.

    tl;dr blame setuptools

  4. Mike Bayer

    yeah, distutils/setuptools only installs packages by default. A package requires an __init__.py. The versions/ directory is not intended to be a package, so needs special directives.

    Now, I'm not opposed to modifying this requirement, such that a versions/ directory can have an __init__.py that would be ignored, just so that in case someone's configuration has turned their versions/ into a package, things are OK.

  5. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.