Skip to main content

Root Folder Search

This package finds the root directory of a project by recursively traversing parent directories starting at a given path.

I used it to overcome a limitation in Jupyter Notebooks, that doesn't provide the __file__ variable that would let me easily find the root folder of a project, regardless the current working directory. You might find it useful in other scenarios.

How to use

import rootfoldersearch

# returns a string with the absolute path to the root folder, where Readme.md is located, starting the search in the CWD.
rootfoldersearch.findpath('Readme.md')

# the same, but using a file in a subfolder as reference to find the root directory
rootfoldersearch.findpath('/util/a-file')

# the same, but only tries 3 parent folders recursively (default is 10)
rootfoldersearch.findpath('Readme.md', depth=3)

# starting the search in a specific directory (as opposed to using the CWD)
rootfoldersearch.findpath('Readme.md', cwd='/..')

Metadata

Release files for rootfoldersearch 0.0.2

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

Source distribution (sdist)

Source distribution for rootfoldersearch 0.0.2
File Size Uploaded
rootfoldersearch-0.0.2.tar.gz 1.7 kB Details

Built distribution (wheel)

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

Total release size: 4.6 kB

Release files / rootfoldersearch-0.0.2.tar.gz

Download URL rootfoldersearch-0.0.2.tar.gz
Size 1.7 kB
Tags Source
SHA-256 checksum
How to use checksums
559a6c22869f26e40c6ef3dd6c37ce05ce13c9b6d0737dafdb9e4b6dfa874498
BLAKE2b-256 checksum
How to use checksums
f0ceeea662ba67a47759310b1f34805917f9c93660339125be4f6c833cc9132d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

Release files / rootfoldersearch-0.0.2-py3-none-any.whl

Download URL rootfoldersearch-0.0.2-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3da44c96d44f3431bb7f4479023c02c21b3cd62608ed09a400238ee5bc5b62fc
BLAKE2b-256 checksum
How to use checksums
32acdbf88a001271ea0d41e0e3d5b08a5de401a5be3e29e13deb652379dc6fe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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