{"id":16959497,"url":"https://github.com/crdoconnor/patroltrigger","last_synced_at":"2026-04-28T15:37:45.484Z","repository":{"id":29704109,"uuid":"33246933","full_name":"crdoconnor/patroltrigger","owner":"crdoconnor","description":"Trigger custom commands from filesystem events.","archived":false,"fork":false,"pushed_at":"2015-04-04T06:00:38.000Z","size":144,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-24T08:00:06.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crdoconnor.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-01T12:45:35.000Z","updated_at":"2023-08-04T11:57:33.000Z","dependencies_parsed_at":"2022-08-03T01:15:35.649Z","dependency_job_id":null,"html_url":"https://github.com/crdoconnor/patroltrigger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crdoconnor/patroltrigger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crdoconnor%2Fpatroltrigger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crdoconnor%2Fpatroltrigger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crdoconnor%2Fpatroltrigger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crdoconnor%2Fpatroltrigger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crdoconnor","download_url":"https://codeload.github.com/crdoconnor/patroltrigger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crdoconnor%2Fpatroltrigger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261674199,"owners_count":23192376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T22:45:08.074Z","updated_at":"2026-04-28T15:37:40.451Z","avatar_url":"https://github.com/crdoconnor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"PatrolTrigger\n=============\n\nTrigger custom commands from filesystem events.\n\nPatrol uses libuv_, which creates event driven hooks to filesystem events using epoll, kqueue or IOCP.\n\nYou can use it to selectively build your project when files change and run tests as soon as you hit the save button.\n\n\nUse\n===\n\nTo install::\n\n    sudo pip install patroltrigger\n\n\nCreate a patrol.py file in your project's root directory:\n\n.. code-block:: python\n\n    #!/usr/bin/python\n    from patroltrigger import runnable, run, trigger\n\n    @trigger([\"*.py\", ], exclude=['venv/*',])\n    def trigger1(filenames):\n        print \"trigger1\"\n        run(\"\"\"echo first command triggered\"\"\")\n        the_output_is_in_this_variable_though = run(\"echo this command is run, but the output is not displayed\", silent=True)\n\n    @trigger([\"*.py\", ], exclude=['venv/*',])\n    def trigger2(filenames):\n        print \"trigger2 command triggered with filename: {}\".format(', '.join(filenames))\n        run(\"false\", ignore_errors=True)    # If ignore_errors=False, nothing further will be executed.\n        run(\"\"\"echo if ignore_errors is False or not specified, you wont ever see this command *or* the results of trigger3.\"\"\")\n\n    @trigger([\"*.py\", ], exclude=['venv/*',])\n    def trigger3(filenames):\n        print \"trigger3 command triggered with filename: {}\".format(', '.join(filenames))\n\n    runnable(__name__)\n\n\nRun like so::\n\n    $ python patrol.py\n\n\nOr get help::\n\n    $ python patrol.py --help\n    Usage: patrol.py [options]\n\n    Options:\n    -h, --help            show this help message and exit\n    -r RUN, --run=RUN     Specify a method in patrol.py to run directly.\n    -a, --all             Run all methods in patrol.py in priority order.\n    -p POST, --post=POST  Command to run after a trigger (e.g. guake)\n    -d DIRECTORY, --directory=DIRECTORY\n                            Directory to run patrol.py in (default:\n                            /home/user/yourproject).\n\n\n\nFeatures\n========\n\n* If multiple methods are triggered by a changed file, they will run *in the order they appear* in patrol.py.\n* Queue up triggers by putting a file named 'lock' in the directory patrol.py is run from. Once 'lock' is removed, the pent up triggers will all be fired.\n* Each time a set of methods are triggered, the total run time is timed.\n* If a command fails (e.g. a unit test), the method is aborted by default at that point to shorten feedback time. Subsequent methods will not run.\n* Run a custom command after each method is finished (e.g. guake, notify-send).\n* Ability to run commands manually.\n\n\n.. _libuv: https://github.com/libuv/libuv\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrdoconnor%2Fpatroltrigger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrdoconnor%2Fpatroltrigger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrdoconnor%2Fpatroltrigger/lists"}