Change request #1470
Install cscripts in ctools package
Status: | Closed | Start date: | 06/01/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 1.0.0 | |||
Duration: |
Description
I thought we discussed / changed this last year, but apparently there’s still files ctools installs outside the ctools package in site-packages.
E.g. on my machine csresmap is installed here: /usr/local/gamma/lib/python3.4/site-packages/csresmap.py
Installing everything in the ctools package is better, e.g. easier to find / update / delete things and less chances for name collisions with other packages in the future.
Can we please put everything in the ctools package?
Should I make a pull request?
(I’m not very familiar with the build system, if changes are required there I might need some tips)
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen over 9 years ago
- Status changed from New to Closed
- Target version set to 1.0.0
- % Done changed from 0 to 100
This probably got forgotten. Is now done, in devel
branch.
#2 Updated by Knödlseder Jürgen over 9 years ago
- Status changed from Closed to In Progress
- % Done changed from 100 to 50
#3 Updated by Knödlseder Jürgen over 9 years ago
Now I remember what the issue was.
A cscript is a client of ctools, hence typically at the beginning has
import ctools
It thus would lead to a recursive import if a cscript itself was part of ctools.
However, the cscripts now reside within the ctools directory in the Python distribution, that’s why I closed this issue.
The following will however work:
from ctools import csspec
#4 Updated by Deil Christoph over 9 years ago
I think it’s important to have import ctools
actually import all the tools in the global namespace, because then the user can use tab completion to find them.
Probably the solution is to say from ctools import other_ctool
in this_ctool.py
.
Jürgen, do you want me to investigate here?
#5 Updated by Knödlseder Jürgen over 9 years ago
Deil Christoph wrote:
I think it’s important to have
import ctools
actually import all the tools in the global namespace, because then the user can use tab completion to find them.Probably the solution is to say
from ctools import other_ctool
inthis_ctool.py
.
Jürgen, do you want me to investigate here?
I’m not sure that I fully understand.
Take for example csspec
. It has an import ctools
at the beginning, but this ctools
does not yet know anything about csspec
because the class is defined after calling import ctools
.
#6 Updated by Knödlseder Jürgen over 9 years ago
- Status changed from In Progress to Closed
- % Done changed from 50 to 100
A better solution is in fact to create a separate cscripts
module.
This has now be done. All scripts are part of a cscripts
module that can be imported using
import cscripts
As
obsutils
is also a Python script it was natural to move this script also in the cscripts
folder.
I further renamed the scripts
folder of ctools
to cscripts
, so that this becomes more explicit (and also simplifies the setup for unit testing).
The code change was merged into devel
.