Skip to main content

Recursively search the parent directory and execute sys.path.append on the path where the SYSPEND_ROOT file exists.

Project description

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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syspend-0.0.3-py3.9.egg (3.4 kB view details)

Uploaded Egg

File details

Details for the file syspend-0.0.3-py3.9.egg.

File metadata

  • Download URL: syspend-0.0.3-py3.9.egg
  • Upload date:
  • Size: 3.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for syspend-0.0.3-py3.9.egg
Algorithm Hash digest
SHA256 094a77c544eef40584e4ba14d89c9f6c9c9ab93dd897171f3ae770cb3c372ab1
MD5 1844d353f9d15d0d51ce80c5b32bf1f9
BLAKE2b-256 c0dc7df1b2aaf2679a98832be1dd0698aec9839d2ff7d53a84f1e5b9606323fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page