New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify adding extra files to watch during development #43

Open
honzajavorek opened this Issue Dec 5, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@honzajavorek
Member

honzajavorek commented Dec 5, 2017

During development, Werkzeug's reloader watches just Python files and Jinja templates. Normally, this can be extended by the extra_files keyword argument:

app.run(host='0.0.0.0', ..., extra_files=['woohoo.yml'])

Elsa doesn't support this:

app.run(host='0.0.0.0', port=port, debug=True)

Following workaround works, but it would be nice if Elsa was able to propagate the option in some way, out of the box.

from flask import Flask as BaseFlask


class Flask(BaseFlask):
    def run(self, *args, **kwargs):
        kwargs.setdefault('extra_files', [])
        kwargs['extra_files'].append('.../data.yml')
        return super().run(*args, **kwargs)


app = Flask(__name__)
@honzajavorek

This comment has been minimized.

Member

honzajavorek commented Dec 5, 2017

I'm not sending a PR for adding the argument, because I'm not sure where to add it (what would make sense the most) and I'm not sure having the argument there is something Elsa should actually support.

I'm playing with a thought that it could be actually smarter - e.g. reading MANIFEST.in and watching all files included to the package or something like that. I think feature like that would be a significant convenience and if it's way too greedy (reloading even on files not so important for the actual website rendering), it's probably no real issue.

@hroncok

This comment has been minimized.

Member

hroncok commented Dec 5, 2017

Adding it without a workaround should be possible once #39 gets done (it's rotting there for quite a while, hopefully i can get to that next semester when i don't teach).

As for some smart handling, I will think about it. Thanks for the proposal.

@hroncok hroncok added the enhancement label Dec 5, 2017

@honzajavorek

This comment has been minimized.

Member

honzajavorek commented Dec 5, 2017

This is how MANIFEST.in can be parsed:

from setuptools.command.egg_info import FileList

file_list = FileList()
with open('MANIFEST.in') as f:
    for line in f.readlines():
        file_list.process_template_line(line)

file_list.sort()
print(file_list.files)
@honzajavorek

This comment has been minimized.

Member

honzajavorek commented Aug 10, 2018

I'm not sure about MANIFEST.in anymore. Applications will use pipenv mostly, so there will be no package. And recently I got into situation with Sphinx when I dynamically created a file during build, the file was always automatically considered as modified, and caused an endless loop of reloading. Thus I think we should forget about any automagic and just let people to set it as they like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment