syspend
This module recursively searches the parent directory from current directory, and calls sys.path.append(directory: SYSPEND_ROOT file exists)
Usage
In the case, there is a following project.
- project
- mypackage.py
- samples
- sample.py
- SYSPEND_ROOT <------- make this file by your self. empty file is ok.
sample.py can import mypackage using syspend.
import syspend
import mypackage
if __name__ == '__main__':
mypackage.hello()
get_path()
get_path() returns the directory where SYSPEND_ROOT exists.
import syspend
if __name__ == '__main__':
syspend.get_path() # output ex: D:\project\samples
syspend.get_path('ALT_ROOT') # returns directory where ALT_ROOT file exists.
syspend.get_path('SYSPEND_ROOT', '../tools') # output ex: D:\project\tools
syspend()
syspend() calls sys.path.append(directory: SYSPEND_ROOT file exists). when calling import syspend, syspend() is automatically called.
import syspend
if __name__ == '__main__':
syspend.syspend('ALT_ROOT') # sys.path.append('directory: ALT_ROOT file exists')
syspend.syspend('SYSPEND_ROOT', '../tools') # sys.path.append('D:\project\tools')
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Metadata
Release files for syspend 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| syspend-0.0.3-py3.9.egg | Legacy Egg format | - | - | Details |
Release files / syspend-0.0.3-py3.9.egg
| Download URL | syspend-0.0.3-py3.9.egg |
|---|---|
| Size | 3.4 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
094a77c544eef40584e4ba14d89c9f6c9c9ab93dd897171f3ae770cb3c372ab1
|
|
BLAKE2b-256 checksum How to use checksums |
c0dc7df1b2aaf2679a98832be1dd0698aec9839d2ff7d53a84f1e5b9606323fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.7
|