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

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
    │    └── util.py
    └── util.py

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

import dotdot
import foo.util
import util

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

How It Works

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-1.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

dotdot-1.1.0-py2.py3-none-any.whl (8.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: dotdot-1.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for dotdot-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5e315eee63cbb9aa14e4940364a743793c24381e905f39b676d9a68c3faba76e
MD5 361e0c05e57b40cfd51baa6f2d3f7b1f
BLAKE2b-256 800d328afa3c056e633f0f6082bd5603cf41c8cc7d1499d5b857b936265c5f33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dotdot-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0

File hashes

Hashes for dotdot-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ce2cabc14aa35fc8e4eaf5d483b6d696c2ffd75f415ab72134f4b3eef2bbda14
MD5 83304f340a10c4a2104e5c271e96c570
BLAKE2b-256 0af8b1fc309fc28389ff8872ec46998e4faa579a0675773bf5d68ce99dba25d8

See more details on using hashes here.

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