Skip to main content

A brute-force shortcut to fix python import hell. Acronym, standing for, um, Fix Up Python Imports. Sure, let's go with that.

Project description

fupi

A brute-force shortcut to fix python import hell. Acronym standing for... um, Fixing-Up Python Imports.

Sure, let's go with that.

Usage

Simply import fupi in your project:

import fupi

This automatically adds relevant directories (like src and test) to your Python path, making imports work seamlessly across your project structure.

Configuration

No configuration is needed if you use the defaults:

  • Add src and test folders and subfolders,
  • Skip folders setup, venv*, and *egg*.

.ENV File Config

To use different / more folder names, simply add the following to an existing .env file, or create a new *.env or fupi.env file:

FUPI_ADD_DIRS="src,test"
FUPI_SKIP_DIRS="setup,venv*,*egg*"

The FUPI_ADD_DIRS will be string-matched against folders in your project, and on exact match, will include that folder and all subfolders into your sys.path.

The FUPI_SKIP_DIRS is a collection of regex patterns to skip, with string begin and end tags added (^value$). Thus you can simply add a list of folder names, or use basic wildcard * characters. If you want to get crazy with regex, be my guest - but understand the value will be wrapped (^value$).

The FUPI_SKIP_DIRS will also always append patters to disqualify any path starting with a period('.') or an underscore('_') (i.e., '\.*' and '\_*'), which should catch most common skipped folders like .git, __pycache__, etc.

Environment Variable Config

Alternatively, you can add the above to os.envars before you import fupi. Note, this process does NOT use dotenv, which would also load into os.envars, although the behavior is similar, just restricted to only FUPI_* configs. Similar to the .env approach above, simply add a comma-delimited list of all folder names / regex patterns.

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

fupi-0.4.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

fupi-0.4-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file fupi-0.4.tar.gz.

File metadata

  • Download URL: fupi-0.4.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for fupi-0.4.tar.gz
Algorithm Hash digest
SHA256 4b93fde12de09cd3d6cfbe71e72af9055a87ab7d1d821a85512a99ef359846ff
MD5 590a2c2800357466bb95f00232dcc6e0
BLAKE2b-256 1a38e98d2b66ed07d0f74d9aa0a5e84147e0e4a877647141baf5bc9661f1b171

See more details on using hashes here.

File details

Details for the file fupi-0.4-py3-none-any.whl.

File metadata

  • Download URL: fupi-0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for fupi-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2842033a0f8f776b1160a9bafdcae211c53f6ff4b3a39af2db1b5814000c98a2
MD5 d40d139f1a35d39aaf7e12765df1504b
BLAKE2b-256 df329b5bac3dd6f3a60cb877946c8dd76fd06803f3c0ddcd2224dd83ac17f9e7

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