Re: debugging during package development

2015-08-01 Thread Terry Reedy

On 8/1/2015 12:21 AM, Seb wrote:


It seems too cumbersome to have to update `sys.path` to include the
development tree of a package (and sub-packages) that's still very
young.  With lots of debugging to do, the last thing I'd want is to
worry about the search path.  So I've been searching for better ways to
work, but I can't seem hit the right keywords and come with all sorts of
tangentially related stuff.  I'm sure there must be some tool that sets
up the development environment when the package source is not on
`sys.path`.  Any advice on this topic would be appreciated.


I am not sure what you are asking, but do you know about .pth files in 
site-packages?  For each python installed, I put in site-packages a 
python.pth containing one line F:/python.  That file contains my 
project directory, call it x/  Running any version of python, 'from x 
import y' or 'from x.y import z' just works, the same as if x/ *were* in 
site-packages, and will be if I ever distribute the x package. No fuss 
with search paths; python plugs x into site-packages for me.


I do not know where this is documented.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: debugging during package development

2015-08-01 Thread Sebastian Luque
On Sat, 01 Aug 2015 15:30:34 +1000,
Ben Finney ben+pyt...@benfinney.id.au wrote:

 Seb splu...@gmail.com writes:
 With lots of debugging to do, the last thing I'd want is to worry
 about the search path.

 Short answer: you need ‘python3 ./setup.py develop’.

 Medium-length answer: you need to add some infrastructure to get your
 project to the point where you can run ‘python3 ./setup.py develop’.

 Longer answer below.

 So I've been searching for better ways to work, but I can't seem hit
 the right keywords and come with all sorts of tangentially related
 stuff.

 The Python module search path is an abstraction, with only a partial
 relationship to the location of modules files in the filesystem.

 The expectation is that a module (or a package of modules) will be
 *installed* to a location already in the module search path (with
 ‘python ./setup.py .

 This allows for cross-platform package management, especially on
 systems that don't have a working OS package manager. The trouble is
 that it does cause a significant learning curve for Python
 programmers, and is an ongoing sore point of Python.

 I'm sure there must be some tool that sets up the development
 environment when the package source is not on `sys.path`. Any advice
 on this topic would be appreciated.

 What you need is to tell Distutils which Python modules form your
 project URL:https://docs.python.org/3/library/distutils.html.

 Once you've got a working ‘setup.py’ for your project, run ‘python3
 ./setup.py develop’ to allow your packages to be run in-place while
 you develop them.

This sounds exactly like what I was looking for.  I was growing tired of
doing 'python setup.py install', every time I wanted to debug something.
The subpackages' modules have inter-dependencies, which require the
whole package to be in `sys.path`.  Unfortunately, I have to stick with
Python 2.7...

Thank you,

-- 
Seb

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: debugging during package development

2015-07-31 Thread Ben Finney
Seb splu...@gmail.com writes:

 With lots of debugging to do, the last thing I'd want is to worry
 about the search path.

Short answer: you need ‘python3 ./setup.py develop’.

Medium-length answer: you need to add some infrastructure to get your
project to the point where you can run ‘python3 ./setup.py develop’.

Longer answer below.

 So I've been searching for better ways to work,
 but I can't seem hit the right keywords and come with all sorts of
 tangentially related stuff.

The Python module search path is an abstraction, with only a partial
relationship to the location of modules files in the filesystem.

The expectation is that a module (or a package of modules) will be
*installed* to a location already in the module search path (with
‘python ./setup.py .

This allows for cross-platform package management, especially on systems
that don't have a working OS package manager. The trouble is that it
does cause a significant learning curve for Python programmers, and is
an ongoing sore point of Python.

 I'm sure there must be some tool that sets up the development
 environment when the package source is not on `sys.path`. Any advice
 on this topic would be appreciated.

What you need is to tell Distutils which Python modules form your
project URL:https://docs.python.org/3/library/distutils.html.

Once you've got a working ‘setup.py’ for your project, run ‘python3
./setup.py develop’ to allow your packages to be run in-place while you
develop them.

-- 
 \“I think it would be a good idea.” —Mohandas K. Gandhi (when |
  `\asked what he thought of Western civilization) |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: debugging during package development

2015-07-31 Thread dieter
Seb splu...@gmail.com writes:

 It seems too cumbersome to have to update `sys.path` to include the
 development tree of a package (and sub-packages) that's still very
 young.  With lots of debugging to do, the last thing I'd want is to
 worry about the search path.  So I've been searching for better ways to
 work, but I can't seem hit the right keywords and come with all sorts of
 tangentially related stuff.  I'm sure there must be some tool that sets
 up the development environment when the package source is not on
 `sys.path`.  Any advice on this topic would be appreciated.

On *nix like systems, you can set sys.path via the envvar
PYTHONPATH.

Note that sys.path needs only contain the top level packages - subpackages
are found automatically.

-- 
https://mail.python.org/mailman/listinfo/python-list