How to handle '-' in the 'from' part in a "from import" statement?

Cameron Simpson cs at cskk.id.au
Wed Oct 9 00:08:55 EDT 2019


On 09Oct2019 16:50, DL Neil <PythonList at DancesWithMice.info> wrote:
>Another option might be to add a symlink* from the application's 
>directory to wherever you've downloaded and expanded the GitHub .zip 
>archive.

I do this. A current project is using Spectra's ds3 Python library.

The project itself has a directory for the additional source code beyond 
what comes from the venv, and that directory is in the sys.path.

In the directory is a symlink to the specific vendor checkout of the ds3 
library:

  ds3 -> ../../vendor/spectra/ds3_python3_sdk/ds3

So the project tree has:

  vendor/spectra/ds3_python3_sdk/ds3

where the vendor library is kept (from their github repo) and:

  lib/python

containing the above symlink and the non-venv additional libraries (i.e.  
the project's own Python code as a package).

The ...../lib/python path in in sys.path (from the environment's 
$PYTHONPATH).

So the symlink thing is not unreasonable at all.

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list