{ "info": { "author": "Scott Maxwell", "author_email": "scott@codecobblers.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Summary\n=======\n\nmodified tracks the files of the currently running application and facilitates\nrestart if any files have changed. By default it will track all Python files,\nincluding all modules loaded by the app. If there are additional files you\nneed to track such as config files, templates, etc., you can add those using\na glob pattern.\n\nThe simplest usage is to simply run the hup_hook. By default, this will build\na dict of all currently loaded code files with their timestamps and register\na handler for `signal.SIGHUP`. When the application receives `signal.SIGHUP`,\nthe hook will check to see if any of the files have been modified, and issue\n`signal.SIGTERM`, if so.\n\n**IMPORTANT**: If a file ends in **.pyc**, `modified` will attempt to retrieve\nthe timestamp from the **.py** file instead.\n\n >>> import modified\n >>> modified.hup_hook()\n\n\nInstallation\n============\n\n $> pip install modified\n\n\nFunctions\n=========\n\n`files()`\n---------\n\nScan all modules in the currently running app to create a dict of all files\nand their modified time.\n\nThe scan only occurs the first time this function is called. Subsequent calls\nsimply return the global dict.\n\n >>> import modified\n >>> modified.files()\n {'.../env32/lib/python3.2/copyreg.py': 1368477498.0,\n '.../env32/lib/python3.2/_weakrefset.py': 1368477497.0,\n '.../env32/lib/python3.2/os.py': 1368477498.0,\n 'modified.py': 1384228495.0,\n '.../env32/lib/python3.2/genericpath.py': 1368477498.0,\n '.../env32/lib/python3.2/abc.py': 1368477497.0,\n '.../env32/lib/python3.2/posixpath.py': 1368477498.0,\n '.../env32/lib/python3.2/stat.py': 1368477498.0,\n '.../env32/lib/python3.2/_abcoll.py': 1368477497.0}\n\n`module_files(module, dependencies_dict=None)`\n----------------------------------------------\n\nScan a module and its entire dependency tree to create a dict of all files\nand their modified time.\n\nPass an existing dict to add only unscanned files or None to create a new\nfile dict\n\n >>> import modified\n >>> import sh\n >>> modified.module_files(sh)\n {'.../env32/lib/python3.2/site-packages/sh-1.09-py3.2.egg/sh.py': 1384230023.0}\n\n`modified()`\n------------\n\nReturn the list of files modified since the initial scan.\n\n >>> import modified\n >>> modified.files()\n {'.../env32/lib/python3.2/copyreg.py': 1368477498.0,\n '.../env32/lib/python3.2/_weakrefset.py': 1368477497.0,\n '.../env32/lib/python3.2/os.py': 1368477498.0,\n 'modified.py': 1384228495.0,\n '.../env32/lib/python3.2/genericpath.py': 1368477498.0,\n '.../env32/lib/python3.2/abc.py': 1368477497.0,\n '.../env32/lib/python3.2/posixpath.py': 1368477498.0,\n '.../env32/lib/python3.2/stat.py': 1368477498.0,\n '.../env32/lib/python3.2/_abcoll.py': 1368477497.0}\n >>> open('modified.py', 'a+').close()\n >>> modified.modified()\n ['modified.py']\n\n`track(*args)`\n--------------\n\nTrack additional files. It is often useful to use glob.glob here.\nFor instance:\n\n >>> import modified\n >>> import glob\n >>> modified.track('config.ini', glob.glob('templates/*.pt'), glob.glob('db/*.db'))\n\n`hup_hook(signal_or_callable=signal.SIGTERM, verbose=False)`\n------------------------------------------------------------\n\nRegister a signal handler for `signal.SIGHUP` that checks for modified\nfiles and only acts if at least one modified file is found.\n\nYou can pass either a signal or a callable for `signal_or_callable`.\nThe signal can be specified by name or number. If specifying by name,\nthe 'SIG' portion is optional. For example, valid values for SIGINT\ninclude 'INT', 'SIGINT' and `signal.SIGINT`.\n\nAlternatively, you can pass a callable that will be called with the list\nof changed files. So the call signature should be `func(list)`. The return\nvalue of the callable is ignored.\n\nThe `verbose` parameter can be True, False or a callable. True indicates that\na message should be printed. A callable will be called with the message to\nprint.\n\n >>> import modified\n >>> import logging\n >>> modified.hup_hook('INT', logging.info)\n ...\n Sending SIGINT because modified.py and 3 other files changed.\n\nWith a callable:\n\n >>> import modified\n >>> import logging\n >>> shutting_down = False\n >>> def set_shutdown():\n ... global shutting_down\n ... shutting_down = True\n >>> modified.hup_hook(set_shutdown)\n ...\n Calling set_shutdown because modified.py and 3 other files changed.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/codecobblers/modified", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "modified", "package_url": "https://pypi.org/project/modified/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/modified/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/codecobblers/modified" }, "release_url": "https://pypi.org/project/modified/1.04/", "requires_dist": null, "requires_python": null, "summary": "Python file modification tracker", "version": "1.04" }, "last_serial": 917688, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "a27555e6ca8a3d4cdc6b01253262d65f", "sha256": "2ffc377c9fa5e8022839267e2d2c32614fc21aa71164738a2ded296f4fd0a1a7" }, "downloads": -1, "filename": "modified-1.0.tar.gz", "has_sig": false, "md5_digest": "a27555e6ca8a3d4cdc6b01253262d65f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4692, "upload_time": "2013-11-12T05:29:50", "url": "https://files.pythonhosted.org/packages/21/19/693abd991a3717948dacdb3de360fee499a120ecddc0db6fb9bb5a8d46a0/modified-1.0.tar.gz" } ], "1.01": [ { "comment_text": "", "digests": { "md5": "bf197b38fad671afb33214aea8c73df0", "sha256": "f29e8874ac5ef04749502e717e21ae726f9a0c1697a20cdd6426d24c8c9c4d11" }, "downloads": -1, "filename": "modified-1.01.tar.gz", "has_sig": false, "md5_digest": "bf197b38fad671afb33214aea8c73df0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4713, "upload_time": "2013-11-12T05:35:25", "url": "https://files.pythonhosted.org/packages/14/b4/f2f112d95fab692ce82b58a6c1998da6804eb2969efef442eb1fc0d31aae/modified-1.01.tar.gz" } ], "1.02": [ { "comment_text": "", "digests": { "md5": "808336cc096d691dac3508a5f1c1fc64", "sha256": "dc9ea496d9d43b0f2a3ce51eed308118d2a6605d9b05bc3c769df80b5faefdf4" }, "downloads": -1, "filename": "modified-1.02.tar.gz", "has_sig": false, "md5_digest": "808336cc096d691dac3508a5f1c1fc64", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5218, "upload_time": "2013-11-12T05:54:27", "url": "https://files.pythonhosted.org/packages/97/f2/0cbbe162d098ffc82e566fd833812b15ef12402166ca0f9c7d261a7fe4f4/modified-1.02.tar.gz" } ], "1.03": [ { "comment_text": "", "digests": { "md5": "feeb81dd86154149bd89d9052bb069f9", "sha256": "da030e55fa327ab89f54d7b0a12d7353a6cf6b201cef276433fb7395ef900473" }, "downloads": -1, "filename": "modified-1.03.tar.gz", "has_sig": false, "md5_digest": "feeb81dd86154149bd89d9052bb069f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5233, "upload_time": "2013-11-12T07:06:53", "url": "https://files.pythonhosted.org/packages/63/bb/b0ed861ef3bf7a25240d14209cdfbd6473c437552f7d5d812c8ae8ecba0d/modified-1.03.tar.gz" } ], "1.04": [ { "comment_text": "", "digests": { "md5": "45e0ceb8cb9931e1e3737f26747bb887", "sha256": "a803b6026c448177ebffa3b5ebf7f67188026e6605c2a59878bf75c9f8641aaa" }, "downloads": -1, "filename": "modified-1.04.tar.gz", "has_sig": false, "md5_digest": "45e0ceb8cb9931e1e3737f26747bb887", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5410, "upload_time": "2013-11-12T21:43:31", "url": "https://files.pythonhosted.org/packages/32/66/3ce5100e1d23a077980057892d0b22210cdc08ba3db3cd856b4ad1af4377/modified-1.04.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "45e0ceb8cb9931e1e3737f26747bb887", "sha256": "a803b6026c448177ebffa3b5ebf7f67188026e6605c2a59878bf75c9f8641aaa" }, "downloads": -1, "filename": "modified-1.04.tar.gz", "has_sig": false, "md5_digest": "45e0ceb8cb9931e1e3737f26747bb887", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5410, "upload_time": "2013-11-12T21:43:31", "url": "https://files.pythonhosted.org/packages/32/66/3ce5100e1d23a077980057892d0b22210cdc08ba3db3cd856b4ad1af4377/modified-1.04.tar.gz" } ] }