{"id":18615713,"url":"https://github.com/jshwi/lsfiles","last_synced_at":"2025-04-11T01:31:27.852Z","repository":{"id":38211213,"uuid":"445970899","full_name":"jshwi/lsfiles","owner":"jshwi","description":"Path object VC index","archived":false,"fork":false,"pushed_at":"2024-04-13T23:37:17.000Z","size":434,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T13:11:29.194Z","etag":null,"topics":["git","index","lsfiles","oop","vc"],"latest_commit_sha":null,"homepage":"https://lsfiles.readthedocs.io","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/jshwi.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-01-09T01:55:38.000Z","updated_at":"2024-04-16T03:23:55.629Z","dependencies_parsed_at":"2023-12-25T20:09:54.146Z","dependency_job_id":"107e4760-e66c-4806-85b4-7f847958c93e","html_url":"https://github.com/jshwi/lsfiles","commit_stats":{"total_commits":151,"total_committers":3,"mean_commits":"50.333333333333336","dds":0.3841059602649006,"last_synced_commit":"c752bf61ed3e3a9c946fd04e8499bc6b04593d41"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Flsfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Flsfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Flsfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshwi%2Flsfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jshwi","download_url":"https://codeload.github.com/jshwi/lsfiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008631,"owners_count":21032556,"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":["git","index","lsfiles","oop","vc"],"created_at":"2024-11-07T03:31:30.452Z","updated_at":"2025-04-11T01:31:22.843Z","avatar_url":"https://github.com/jshwi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Status: Archived\n==================\nThis repository has been archived and is no longer maintained\n\nlsfiles\n=======\n|Inactive| |License| |PyPI| |CI| |CodeQL| |pre-commit.ci status| |codecov.io| |readthedocs.org| |python3.8| |Black| |isort| |docformatter| |pylint| |Security Status| |Known Vulnerabilities| |turba|\n\n.. |Inactive| image:: https://img.shields.io/badge/status-inactive-red.svg\n   :target: https://img.shields.io/badge/status-inactive-red.svg\n   :alt: Status Inactive\n.. |License| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n   :target: https://opensource.org/licenses/MIT\n   :alt: License\n.. |PyPI| image:: https://img.shields.io/pypi/v/turba\n   :target: https://pypi.org/project/turba/\n   :alt: PyPI\n.. |CI| image:: https://github.com/jshwi/turba/actions/workflows/build.yaml/badge.svg\n   :target: https://github.com/jshwi/turba/actions/workflows/build.yaml\n   :alt: CI\n.. |CodeQL| image:: https://github.com/jshwi/turba/actions/workflows/codeql-analysis.yml/badge.svg\n   :target: https://github.com/jshwi/turba/actions/workflows/codeql-analysis.yml\n   :alt: CodeQL\n.. |pre-commit.ci status| image:: https://results.pre-commit.ci/badge/github/jshwi/turba/master.svg\n   :target: https://results.pre-commit.ci/latest/github/jshwi/turba/master\n   :alt: pre-commit.ci status\n.. |codecov.io| image:: https://codecov.io/gh/jshwi/turba/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/jshwi/turba\n   :alt: codecov.io\n.. |readthedocs.org| image:: https://readthedocs.org/projects/turba/badge/?version=latest\n   :target: https://turba.readthedocs.io/en/latest/?badge=latest\n   :alt: readthedocs.org\n.. |python3.8| image:: https://img.shields.io/badge/python-3.8-blue.svg\n   :target: https://www.python.org/downloads/release/python-380\n   :alt: python3.8\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n   :alt: Black\n.. |isort| image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat\u0026labelColor=ef8336\n   :target: https://pycqa.github.io/isort/\n   :alt: isort\n.. |docformatter| image:: https://img.shields.io/badge/%20formatter-docformatter-fedcba.svg\n   :target: https://github.com/PyCQA/docformatter\n   :alt: docformatter\n.. |pylint| image:: https://img.shields.io/badge/linting-pylint-yellowgreen\n   :target: https://github.com/PyCQA/pylint\n   :alt: pylint\n.. |Security Status| image:: https://img.shields.io/badge/security-bandit-yellow.svg\n   :target: https://github.com/PyCQA/bandit\n   :alt: Security Status\n.. |Known Vulnerabilities| image:: https://snyk.io/test/github/jshwi/turba/badge.svg\n   :target: https://snyk.io/test/github/jshwi/turba/badge.svg\n   :alt: Known Vulnerabilities\n.. |turba| image:: https://snyk.io/advisor/python/docsig/badge.svg\n   :target: https://snyk.io/advisor/python/turba\n   :alt: turba\n\nPath object VC index\n--------------------\n\nIndex versioned .py files\n\nInstall\n-------\n\n``pip install lsfiles``\n\nDevelopment\n-----------\n\n``poetry install``\n\nUsage\n-----\n\n\nThe ``LSFiles`` instance is a list-like object instantiated with an empty index\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from lsfiles import LSFiles\n    \u003e\u003e\u003e from pathlib import Path\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e files = LSFiles()\n    \u003e\u003e\u003e files\n    \u003cLSFiles []\u003e\n\n\nThe ``LSFiles`` index calls ``git ls-files`` and only versioned files are indexed\n\n.. code-block:: python\n\n    \u003e\u003e\u003e files.populate()\n    \u003e\u003e\u003e for path in sorted([p.relative_to(Path.cwd()) for p in files]):\n    ...     print(path)\n    docs/conf.py\n    lsfiles/__init__.py\n    lsfiles/_indexing.py\n    lsfiles/_objects.py\n    lsfiles/_version.py\n    tests/__init__.py\n    tests/_environ.py\n    tests/_test.py\n    tests/conftest.py\n    whitelist.py\n\nThe ``LSFiles`` instance is an index of unique file paths\n\nIt's implementation of ``extend`` prevents duplicates\n\n.. code-block:: python\n\n    \u003e\u003e\u003e p1 = Path.cwd() / \"f1\"\n    \u003e\u003e\u003e p2 = Path.cwd() / \"f1\"\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e files = LSFiles()\n    \u003e\u003e\u003e files.extend([p1, p2])\n    \u003e\u003e\u003e sorted([p.relative_to(Path.cwd()) for p in files.reduce()])\n    [PosixPath('f1')]\n\nReduce minimizes index to directories and individual files relative to the current working dir\n\nThe list value is returned, leaving the instance unaltered\n\n.. code-block:: python\n\n    \u003e\u003e\u003e p1 = Path.cwd() / \"f1\"\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e d = Path.cwd() / \"dir\"\n    \u003e\u003e\u003e p2 = d / \"f2\"\n    \u003e\u003e\u003e p3 = d / \"f3\"\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e files = LSFiles()\n    \u003e\u003e\u003e files.extend([p1, p2, p3])\n    \u003e\u003e\u003e sorted(p.relative_to(Path.cwd()) for p in files.reduce())\n    [PosixPath('dir'), PosixPath('f1')]\n\nExclusions can be added on instantiation\n\nExclusions are evaluated by their basename, and does not have to be an absolute path\n\n.. code-block:: python\n\n    \u003e\u003e\u003e p1 = Path.cwd() / \"docs\" / \"conf.py\"\n    \u003e\u003e\u003e p2 = Path.cwd() / \"lsfiles\" / \"__init__.py\"\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e files = LSFiles()\n    \u003e\u003e\u003e files.populate(f\".*\\/{p1.name}\")\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e ps = [str(p) for p in files]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e assert not str(p1) in ps\n    \u003e\u003e\u003e assert str(p2) in ps\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshwi%2Flsfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjshwi%2Flsfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshwi%2Flsfiles/lists"}