SysPath
SysPath is a package to easily set common paths into sys.path
. Instead
of having to do a lot of path manipulation to properly import files, a
file can import from SysPath instead.
Installation
pip install syspath
Usage
To append the current file's directory to sys.path
:
import syspath
syspath.append_current_path()
from syspath import current_path
To append the current file's parent directory to sys.path
:
import syspath
syspath.append_parent_path()
from syspath import parent_path
To append the current file's git repository root to sys.path
:
import syspath
syspath.append_git_root()
from syspath import git_root
Each of the shortcut modules also provide a path
variable that can be
used to get the path added.
Development
pip install -e .[test]
ruff check .
mypy . --strict
coverage run -m unittest
coverage report -m
ruff check .
Publishing
- Update
CHANGELOG.md
- Update
syspath/__version__.py
- Commit, tag with the version number, and push