{"id":18837203,"url":"https://github.com/greatfruitomsk/tailhead","last_synced_at":"2025-04-14T06:22:20.534Z","repository":{"id":36254097,"uuid":"40558507","full_name":"GreatFruitOmsk/tailhead","owner":"GreatFruitOmsk","description":"head, tail and follow in python","archived":false,"fork":false,"pushed_at":"2021-12-30T21:46:12.000Z","size":33,"stargazers_count":15,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T21:48:49.216Z","etag":null,"topics":["head","python","tail"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GreatFruitOmsk.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-11T18:32:36.000Z","updated_at":"2024-04-27T14:10:01.000Z","dependencies_parsed_at":"2022-08-17T22:31:12.354Z","dependency_job_id":null,"html_url":"https://github.com/GreatFruitOmsk/tailhead","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatFruitOmsk%2Ftailhead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatFruitOmsk%2Ftailhead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatFruitOmsk%2Ftailhead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GreatFruitOmsk%2Ftailhead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GreatFruitOmsk","download_url":"https://codeload.github.com/GreatFruitOmsk/tailhead/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830906,"owners_count":21168369,"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":["head","python","tail"],"created_at":"2024-11-08T02:34:23.052Z","updated_at":"2025-04-14T06:22:20.510Z","avatar_url":"https://github.com/GreatFruitOmsk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://travis-ci.org/GreatFruitOmsk/tailhead.svg?branch=master\n\n======\ntailhead\n======\n\nPython tail is a simple implementation of GNU tail and head.\n\nIt provides 3 main functions that can be performed on any file-like object that supports ``seek()`` and ``tell()``.\n\n* ``tail`` - read lines from the end of a file\n* ``head`` - read lines from the top of a file\n* ``follow`` - read lines as a file grows\n\nIt also comes with ``pytail``, a command line version offering the same functionality as GNU tail. This can be particularly useful on Windows systems that have no tail equivalent.\n\n- `tailhead on GitHub \u003ctailhead\u003e`_\n- `tailhead on Pypi \u003chttp://pypi.python.org/pypi/tailhead\u003e`_\n\nInstallation\n============\n\nInstall with ``pip`` or ``easy_install``.\n\n::\n\n    pip install tailhead\n\nExamples\n========\n\n::\n\n  import tailhead\n  f = open('test.txt', 'w')\n  for i in range(11):\n      f.write('Line %d\\\\n' % (i + 1))\n  f.close()\n\nTail\n----\n::\n\n    # Get the last 3 lines of the file\n    tailhead.tail(open('test.txt', 'rb'), 3)\n    # [b'Line 9', b'Line 10', b'Line 11']\n\nHead\n----\n::\n\n    # Get the first 3 lines of the file\n    tailhead.head(open('test.txt', 'rb'), 3)\n    # [b'Line 1', b'Line 2', b'Line 3']\n\n    # Get all lines but last 6 lines of the file\n    tailhead.head(open('test.txt', 'rb'), -6)\n    # [b'Line 1', b'Line 2', b'Line 3', b'Line 4', b'Line 5']\n\nFollow\n------\n::\n\n    # Follow the file as it grows and handle file rotation if it occurs\n    import time\n    for line in tailhead.follow_path('test.txt'):\n        if line is not None:\n            print(line)\n        else:\n            time.sleep(1)\n\nRunning Tests\n=============\n\nTailer currently only has doctests.\n\nRun tests with nose::\n\n    nosetests --with-doctest tailhead\n\nRun tests with doctest::\n\n    python -m doctest -v tailhead/__init__.py\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreatfruitomsk%2Ftailhead","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreatfruitomsk%2Ftailhead","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreatfruitomsk%2Ftailhead/lists"}