Skip to main content

Make it easy to import the modules in parent directories

Project description

DotDot

Make it easy to import the modules in parent directories

released version license Build Status downloads

If you want to solve ValueError: attempted relative import beyond top-level package, DotDot may be helpful for you.

Installation

If it can be installed and imported successfully, it should work correctly.

Install via pip:

pip install dotdot

Quick Start

Consider a common project structure as following:

FooProject
    ├── foo
    │    ├── script.py
    │    └── util0.py
    └── util1.py

Now, script.py can import util1 by importing dotdot first. Like this:

import dotdot
import foo.util0
import util1

Moreover, you can import the modules in grandparent or even great grandparent directory by importing dotdotdot or dotdotdotdot first.

How it work

DotDot does this magic by changing sys.path[0] in import time.

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

dotdot-0.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

dotdot-0.2.0-py2.py3-none-any.whl (7.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dotdot-0.2.0.tar.gz.

File metadata

  • Download URL: dotdot-0.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.4

File hashes

Hashes for dotdot-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cb5493f8a1df44ac5fafae40c6297f01922b363698a31f89cad1cee95c097f9e
MD5 0fff7f5d805f482b54eecf85742a0463
BLAKE2b-256 4e02a29b4e0353729ffc92924e87391307e91004a14573ee4f54acf6a98214bd

See more details on using hashes here.

File details

Details for the file dotdot-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: dotdot-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.5.4

File hashes

Hashes for dotdot-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8c7cf86fdfce395184b525aebe44a83a296aaf0df1d3eccacc45fa4c8a05e76e
MD5 7d2b5bfb40b0f6d6e871acc313c85a0f
BLAKE2b-256 490354276f313b2dfe0d560b2d81400d09d4724bbbbd916415cbaa5640908d24

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