Skip to main content

Set project root path for importing local modules

Project description

Import project root path to sys.path for import local files.

If you have a project with the following structure:

| - my_proj
|
| - my_proj / config / models / account_model.py (class AccountModel)
|
| - my_proj / transaction / checker.py (class Checker)

Use ccrootpath to simplize your import:

import ccrootpath
PROJECT_DIR = ccrootpath.set_project_root_path(__file__, 'my_proj')
from config.models.account_model import AccountModel
from transaction.checker import Checker

Project details


Download files

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

Source Distribution

ccrootpath-1.1.tar.gz (1.9 kB view hashes)

Uploaded Source

Built Distribution

ccrootpath-1.1-py3-none-any.whl (2.0 kB view hashes)

Uploaded Python 3

Supported by

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