Skip to main content

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.

Metadata

Release files for dotdot 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotdot 1.1.0
File Size Uploaded
dotdot-1.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dotdot 1.1.0
File Interpreter ABI Platform
dotdot-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.5 kB

Release files / dotdot-1.1.0.tar.gz

Download URL dotdot-1.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5e315eee63cbb9aa14e4940364a743793c24381e905f39b676d9a68c3faba76e
BLAKE2b-256 checksum
How to use checksums
800d328afa3c056e633f0f6082bd5603cf41c8cc7d1499d5b857b936265c5f33
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / dotdot-1.1.0-py2.py3-none-any.whl

Download URL dotdot-1.1.0-py2.py3-none-any.whl
Size 8.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ce2cabc14aa35fc8e4eaf5d483b6d696c2ffd75f415ab72134f4b3eef2bbda14
BLAKE2b-256 checksum
How to use checksums
0af8b1fc309fc28389ff8872ec46998e4faa579a0675773bf5d68ce99dba25d8
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page