Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SageNB -- Use pkg_resources to locate DATA directory #7402

Closed
TimDumol mannequin opened this issue Nov 6, 2009 · 8 comments
Closed

SageNB -- Use pkg_resources to locate DATA directory #7402

TimDumol mannequin opened this issue Nov 6, 2009 · 8 comments

Comments

@TimDumol
Copy link
Mannequin

TimDumol mannequin commented Nov 6, 2009

pkg_resources is the official way to access data directories in a setuptools package. Using pkg_resources to locate the DATA directory will allow us to use .pth files for ease of development. For example:

$ pwd
/home/timdumol/devel/sagenb-0.3.5/src
$ dev_dir=`pwd`
$ cd /opt/sage/local/lib/python2.6/site-packages/
$ rm -r sagenb*
$ cat "$dev_dir" > sagenb.pth

Thus, there will no longer be a need to sage -python setup.py install after every change.

CC: @qed777

Component: notebook

Keywords: sagenb notebook

Author: Tim Dumol

Reviewer: Mitesh Patel

Issue created by migration from https://trac.sagemath.org/ticket/7402

@TimDumol TimDumol mannequin added this to the sage-4.3 milestone Nov 6, 2009
@TimDumol TimDumol mannequin assigned boothby Nov 6, 2009
@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 6, 2009

Uses pkg_resources to locate the DATA directory.

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 6, 2009

comment:1

Attachment: trac_7402-pkg_resources.patch.gz

This patch should do it.

As a note, we won't even need to restart the server if all we edit are template files. A big plus in ease of development, IMHO.

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 6, 2009

Changed keywords from none to sagenb notebook

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 6, 2009

Author: Tim Dumol

@TimDumol TimDumol mannequin added the s: needs review label Nov 6, 2009
@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 13, 2009

Reviewer: Mitesh Patel

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 13, 2009

comment:2

This works for me. In particular, the Se test suite is oblivious to the change.

For me, an existing site-packages/sagenb takes precedence over sagenb.pth. Short of deleting the former, can we reverse this? How about a flag (e.g, --dev-mode or --in-source) to sage -python setup.py install that toggles between "standard" and "developer" modes?

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 14, 2009

comment:3

A Sphinx warning to keep in mind:

copying static files... WARNING: static directory '/home/apps/sage/local/lib/python/site-packages/sagenb/data/jsmath/' does not exist

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

comment:4

Replying to @qed777:

A Sphinx warning to keep in mind:

copying static files... WARNING: static directory '/home/apps/sage/local/lib/python/site-packages/sagenb/data/jsmath/' does not exist

Since this is only used for development, I don't think there's much of a problem. It should be possible to fix by making Sphinx read the .pth file and look there, but I am inexperienced regarding that.

Regards the --dev-mode thing, I just noticed that SageNB uses disttools, not setuptools, which is why the sage -python setup.py develop command does not exist. This is now #7467.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants