Skip to main content

Current module relative paths and imports

Project description

Latest PyPI Version License Downloads

Get the path of a file relative to the current module. Import a Python module relative to the current module. Temporarily change sys.path for imports.

Installation

$ pip install current

Usage

Get paths relative to the current module:

>>> import current

>>> here = current.current_path()
>>> parent = current.current_path('..')
>>> bruces = current.current_path('..', 'australia', 'bruces', 'bruces.ini')

Temporarily add the parent directory to sys.path:

>>> with current.inserted_path()
...     import australia

License

CC0 1.0 Public Domain Dedication

Changelog

Version 0.1: First public release

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

current-0.1.zip (4.6 kB view details)

Uploaded Source

File details

Details for the file current-0.1.zip.

File metadata

  • Download URL: current-0.1.zip
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for current-0.1.zip
Algorithm Hash digest
SHA256 2e48f4732f5dd54137472576884c427065996fdc9f549457173ee87f70b771cf
MD5 c34d5e8bc41dc4759b2b7ebd22062269
BLAKE2b-256 54a1ac63c17754a7b0d4b2bc9c1b0c427413ca9e231826c43f7b448ad2c575a6

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