Python CLI entry point doesn't work as expected

Hi Everyone. I have trouble getting an entry point to work for a CLI application.I hope you can help me.

Please don’t let the length of the post deter you. The problem is fairly straightforward; I have just tried to provide as much useful information as possible to the reader.

The Setup

OS: Ubuntu 20.04

Python: 3.8.5 | pip: 20.0.2 | venv


├── build
├── dist
├── source.egg-info
├── source
├── requirements.txt
└── venv

source dir

├── config
├── examples
├── tests
└── utils

The important directories within the source directory are config, which contains a few .env and .json files; and utils, which is a package that contains a sub-package called config.

Running, which references config and imports modules from utils, is how the CLI app is started. Ideally when it is run, it should load a bunch of environment variables, create some command aliases and display the application’s prompt. (After which the user can start working within that shell.)

I created a wheel to install this application. The contains an entry point as follows:

        'console_scripts': [

The Problem

I pip installed the wheel in a test directory with its own virtual environment. When I go to the corresponding site-packages directory and run python, the CLI loads properly with the information about the aliases etc. However when I run simply script (the entry point) from the root directory of the environment the shell loads but I don’t see any of the messages about the aliases etc., and some of the functionality which depends on the utils package aren’t available either.

What could I be doing wrong? How can I make the command work as if it was running with all the necessary packages available?

Other information that may be useful

  • site-packages has copies of config and utils
  • config is included in the package as part of the package_data parameter in as ['./config/*.env', './config/*.json']
  • All import statements begin from source, i.e. from source.utils.config import etc.
  • which script gives me the location as venv/bin/script, but that bin directory does not have the packages. (Which is expected, I think.)