Opened 13 years ago
Closed 13 years ago
#7467 closed enhancement (fixed)
Make SageNB use `setuptools` instead of `distutils`
Reported by: | timdumol | Owned by: | boothby |
---|---|---|---|
Priority: | major | Milestone: | sage-4.3 |
Component: | notebook | Keywords: | |
Cc: | mpatel, was | Merged in: | |
Authors: | Tim Dumol | Reviewers: | Mitesh Patel |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Currently, SageNB makes use of distutils
. The standard method of package distribution, though, is setuptools. This has several advantages, the foremost being a setup.py develop
command, which bypasses the need to reinstall the package in order to propagate a change, as well as the ability to upload the package to PyPI with a single command. There is also additional functionality regards packaging, etc.
Attachments (2)
Change History (15)
comment:1 Changed 13 years ago by
- Status changed from new to needs_review
Changed 13 years ago by
Makes setup.py
use setuptools
instead of distutils
. Depends on #7402 for things to work properly.
comment:2 follow-up: ↓ 3 Changed 13 years ago by
What are your thoughts about
? I found these links at Tools of the Modern Python Hacker: Virtualenv, Fabric and Pip.
comment:3 in reply to: ↑ 2 Changed 13 years ago by
Replying to mpatel:
What are your thoughts about
? I found these links at Tools of the Modern Python Hacker: Virtualenv, Fabric and Pip.
These tools are orthogonal to usage of setuptools
, to note.
I personally make use of Virtualenv and Pip all the time for deployment. They're very useful for keeping one's site-packages clean.
comment:4 follow-ups: ↓ 5 ↓ 7 Changed 13 years ago by
Thanks for the clarification. What if we use pip (i.e., pip.py
) as SageNB's installer? The uninstall facility might allow us to select among different development versions (and their requirements) in a clean way. Currently, extraneous files can "accumulate" in site-packages/sagenb
until I do rm -rf
and reinstall.
Disclaimer: I'm not familiar with distutils
, pip
, or setuptools
.
On #7447: Can we query the installed version of a package with setuptools
and/or pip
?
comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6 Changed 13 years ago by
comment:6 in reply to: ↑ 5 Changed 13 years ago by
Replying to timdumol:
Replying to mpatel:
[...] On #7447: Can we query the installed version of a package with
setuptools
and/orpip
?I believe something like this should do the trick:
from pkg_resources import Requirement, working_set version = working_set.find9Requirement.parse('sagenb')).version
Sorry, I meant working_set.find(Requirement.parse('sagenb')).version
comment:7 in reply to: ↑ 4 Changed 13 years ago by
Replying to mpatel:
Thanks for the clarification. What if we use pip (i.e.,
pip.py
) as SageNB's installer? The uninstall facility might allow us to select among different development versions (and their requirements) in a clean way. Currently, extraneous files can "accumulate" insite-packages/sagenb
until I dorm -rf
and reinstall. ..
Wow, that feature's new. I don't see why not, although it would mean adding another package to Sage.
comment:8 follow-up: ↓ 9 Changed 13 years ago by
I get
sage: from pkg_resources import Requirement, working_set sage: working_set.find(Requirement.parse('sagenb')).version AttributeError: 'NoneType' object has no attribute 'version'
On using pip: We could just add pip.py
, according to this.
comment:9 in reply to: ↑ 8 Changed 13 years ago by
Replying to mpatel:
I get
sage: from pkg_resources import Requirement, working_set sage: working_set.find(Requirement.parse('sagenb')).version AttributeError: 'NoneType' object has no attribute 'version'On using pip: We could just add
pip.py
, according to this.
I believe detection of version using pkg_resources
requires it be installed by setuptools
, i.e., this patch.
comment:10 Changed 13 years ago by
OK, or pip, I suppose. Thanks. I'll put a note at #7447.
comment:11 Changed 13 years ago by
- Report Upstream set to N/A
- Status changed from needs_review to positive_review
Although I'm not very familar with distutils
or setuptools
, this works for and looks good to me. A spkg built with spkg-dist
installs properly. Moreover, we can query the sagenb
version just as indicated in the comments above.
comment:12 Changed 13 years ago by
- Reviewers set to Mitesh Patel
comment:13 Changed 13 years ago by
- Resolution set to fixed
- Status changed from positive_review to closed
+1!
This should do it.