sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
524 stars 75 forks source link

Global file name ignore #24

Closed montefra closed 9 years ago

montefra commented 9 years ago

I've just discovered your package and I seems very nice.

My setup:

As I'm using autodoc, I also want to follow the code directory, so I've added the option -z "../mylib". This is easy.

But the autobuild fires every time I edit a file, e.g. doc.rst, as vim modifies .doc.rst.swp file, but does nothing as the file has not been saved. Then when I save it both the doc.rst .doc.rst.un~ are changed and the autobuilds runs for both files. To avoid this I've added

-i 'source/.??*' -i 'source/*~'

to the command line. If I modify one of the python files in mylib, e.g. mylib/module.py, the situation is even worse. The build fires as I type because of mylib/.module.py.swp and, when I save the file, the build needlessly fires a lot of times, mostly because the files in libvhc/__pycache__ are modified when sphinx runs.

I can avoid it with

 -i '../mylib/__pycache__/*' -i '../mylib/.??*' -i '../mylib/*~'

If I add any subdirectory in mylib I'll need to repeat the above line.

For a big project with subpackages and subdirectories in source this gets extremely hard to maintain.

Would it be possible to define the ignore option like

-i '.??*' -i '*~' -i '__pycache__'

such that any file or directory matching the give names is ignored, without to specify in which directory do they live?

GaretJax commented 9 years ago

@montefra, could you please check if https://github.com/GaretJax/sphinx-autobuild/pull/26 solves your issue?

montefra commented 9 years ago

Now I'm on holiday until next Tuesday. I'll try to remember to do it as soon as possible. If I don't come back within one week, please ping me.

GaretJax commented 9 years ago

Don't worry, in the end it took me almost a month to answer.

GaretJax commented 9 years ago

Ping @montefra ;-)

montefra commented 9 years ago

I'm just about to give a try. I hope to have an answer in few hours

montefra commented 9 years ago

It works! Thank you.

-r '\.\S+?swp' -r '__pycache__' -r '\S+?~'

avoids to build if anything like .*swp, *~ and *__pycache__* is modified. When do you plan to push this into pypi?

GaretJax commented 9 years ago

Cool! I'll add __pycache__ to the default ignores. Also, will probably release already today.

GaretJax commented 9 years ago

@montefra I just released 0.5.1

GaretJax commented 9 years ago

Just wait with updating, I introduced a bug... shall have waited for tests to pass, shame on me. Give me 5 minutes

GaretJax commented 9 years ago

Ok, 0.5.2 is fine, enjoy!

montefra commented 9 years ago

great. Thanks for the effort. Excluding pycache by default is a good idea +1. I'll update next week.