Skip to main content

libsightseeing

a shared library for file finding and source resolution with gitignore support, after i needed a simple way to find files while respecting .gitignore

installation

pip install libsightseeing

usage

finding project root

from libsightseeing import find_project_root

# find project root from current directory
root = find_project_root()
if root:
    print(f"found project at: {root}")

# find from a subdirectory
root = find_project_root("~/Works/example/sub/dir")
if root:
    print(f"found project at: {root}")  # ~/Works/example

# use with custom markers
root = find_project_root(
    ".",
    markers=[".git", "pyproject.toml", "package.json"]
)

finding files (simple)

from libsightseeing import find_files

# find all python files
files = find_files(".", include=["*.py"])

# find files excluding tests
files = find_files("src", exclude=["tests"])

# include gitignored files
files = find_files(".", include=["*.py"], respect_gitignore=False)

finding files (advanced)

use SourceResolver when you need more control or want to reuse the resolver:

from libsightseeing import SourceResolver

# create a reusable resolver
resolver = SourceResolver(
    root=".",
    include=["src/**/*.py"],
    exclude=["tests", "*.pyc"],
    respect_gitignore=True,
)

# resolve files multiple times (e.g., in a watch loop)
files = resolver.resolve()

combining both

from libsightseeing import find_project_root, find_files

# find project root first, then find files there
root = find_project_root(".")
if root:
    files = find_files(root, include=["*.py"])

api differences

find_files() vs SourceResolver

  • find_files() — simple one-liner function. creates a resolver internally and returns files immediately. use this for one-off file finding.

  • SourceResolver — class-based api. gives you a reusable resolver object that you can call .resolve() on multiple times. use this when you need to search the same directory repeatedly or want more control.

both respect .gitignore and support the same include/exclude patterns.

features

  • find project root
    walk up the tree looking for .git, pyproject.toml, package.json, cargo.toml, etc.

  • respects .gitignore
    automatically excludes gitignored files

  • glob patterns
    supports include/exclude patterns

  • simple one-liner
    find_files() and find_project_root() for quick usage

  • configurable resolver
    SourceResolver for advanced cases

  • lightweight
    only depends on pathspec

licence

libsightseeing is unencumbered, free-as-in-freedom, and is dual-licenced under The Unlicense or the BSD Zero Clause License. (SPDX: Unlicense OR 0BSD)

you are free to use the software as you wish, without any restrictions or obligations, subject only to the warranty disclaimers in the licence text of your choosing.

Release files for libsightseeing 2026.5.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libsightseeing 2026.5.15
File Size Uploaded
libsightseeing-2026.5.15.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for libsightseeing 2026.5.15
File Interpreter ABI Platform
libsightseeing-2026.5.15-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / libsightseeing-2026.5.15.tar.gz

Download URL libsightseeing-2026.5.15.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c4d259bd2d24683503c6bc5b58e1dfe5fa86440788746e2218dd29efd0e48178
BLAKE2b-256 checksum
How to use checksums
8185027930d22d436b43decf9ebc1889d9f015276f72a02a041d8885235bd6cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / libsightseeing-2026.5.15-py3-none-any.whl

Download URL libsightseeing-2026.5.15-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b52b744e7db617e316359306604bdee8c030260eee64de2d448c466f073018f
BLAKE2b-256 checksum
How to use checksums
50ddbbe8c27dbd04f99a97817adbd591be6e96277e73d1fcaddeec8c66217c06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

2026.5.15 This release

2 release files

0.2.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page