On Tue, Nov 13, 2018 at 4:46 PM Chris Barker - NOAA Federal via
Python-ideas <python-ideas@python.org> wrote:

> Then I discovered setuptools’ develop mode (now pip editable install)
>
> It is the right way to run code in packages under development.
>

In multiple workplaces I found a folder with python utility scripts that
users can just double-click. The need for installing causes problems with
handling different versions on one machine, and the need for "__init__.py"
files makes the folders less pretty. Sure - sometimes I need to install
stuff anyway - but that's just one "install.py" double click away.

I would like to propose allowing importing of strings that would support
relative paths. For example in Danish's example:

    # use this in `test_main.py`
    import '../main.py' as main

Maybe the syntax can be improved, but to me this need has been aching since
I started using Python 12 years ago. I've used C, C++, and Javascript where
the whole "how do I connect these two files that are a folder apart"
problem doesn't require googling for documentation on packaging tools,
magic filenames, constraints and gotchas. The solution is always obvious
because it works just like it works in every system - with a file-relative
path.

File-relative imports is probably highest on my Python wish list. I've
drafted but not sent out a python-ideas email about it multiple times. I've
seen a lot of "sys.path" hacking that would've been solved by
file-relative-paths.

Cheers and thanks,

Yuval Greenfield
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to