ezdir
Simple utilities to change the current working directory in Python:
up(n)changes working folder to be upndirectory levels.goto("foldername")changes working folder to the first parent folder (within the original path) matching a name.find("foldername")changes working folder to the first parent folder matching a name underndirectory levels.
Examples
If your current file is Users/me/MyWork/src/main/work[.py/.ipynb] and you wanted to
go up one level to src you could use the up function:
import ezdir
ezdir.up(levels=1)
If you wanted to go to Users/me/MyWork/src you could go up two levels or use the goto function:
import ezdir
ezdir.trim(folder_name='src')
As the src folder is within the original path.
If you wanted to switch your working directory to Users/me/MyWork/tests you could use find:
import ezdir
ezdir.find(levels=2, folder_name='tests')
As this will go up two levels, and then search for a tests folder. We include a number
of excluded folders (e.g. build), but you can exclude more folders by passing a list to
the ezdir.find as the add_ignore_subfolders variable.
Installation
pip install ezdir
Why use it?
Changing working directory in a Jupyter Notebook
If you are using a notebook on a cloud server, your working directory might be different to some elses. Normally people do something like:
import os
os.chdir(path)
But sometimes this path will be different based on the user. This library provides a more sensible way of going up folder paths whether you're using a python script or a notebook.
Metadata
Release files for ezdir 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ezdir-0.3.0.tar.gz | 4.8 kB | Without provenance | Details for ezdir-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ezdir-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for ezdir-0.3.0-py3-none-any.whl |
Total release size: 10.5 kB
Release files / ezdir-0.3.0.tar.gz
| Download URL | ezdir-0.3.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ff95bfc43432e11add622001933d1c3fb2c509fa46f697ea5e612269db31f48
|
|
BLAKE2b-256 checksum How to use checksums |
3a17d9493c41e9c3ea57de2700a8ca0c6efd9a04aded197ab7a0e4a5f43f3463
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.16
|
Release files / ezdir-0.3.0-py3-none-any.whl
| Download URL | ezdir-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a4c57c6d64fbecbf5067def8254aab036ed92a2c251d18a8c5809a8c36380764
|
|
BLAKE2b-256 checksum How to use checksums |
161bc807ec49d594e5d4c1d21c141806971e66eaf3a7388964a56239c53475bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.16
|
Security for ezdir 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.