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

Make SageNB use setuptools instead of distutils #7467

Closed
TimDumol mannequin opened this issue Nov 15, 2009 · 16 comments
Closed

Make SageNB use setuptools instead of distutils #7467

TimDumol mannequin opened this issue Nov 15, 2009 · 16 comments

Comments

@TimDumol
Copy link
Mannequin

TimDumol mannequin commented Nov 15, 2009

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.

CC: @qed777 @williamstein

Component: notebook

Author: Tim Dumol

Reviewer: Mitesh Patel

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

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

TimDumol mannequin commented Nov 15, 2009

comment:1

This should do it.

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

TimDumol mannequin commented Nov 15, 2009

Attachment: trac_7467-setuptools.patch.gz

Makes setup.py use setuptools instead of distutils. Depends on #7402 for things to work properly.

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

Attachment: trac_7467-setuptools.2.patch.gz

Added necessary .hgignore lines.

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 15, 2009

Author: Tim Dumol

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 15, 2009

comment:2

What are your thoughts about

? I found these links at Tools of the Modern Python Hacker: Virtualenv, Fabric and Pip.

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

comment:3

Replying to @qed777:

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.

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 15, 2009

comment:4

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?

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

comment:5

Replying to @qed777:

[...]
On #7447: Can we query the installed version of a package with setuptools and/or pip?

I believe something like this should do the trick:

from pkg_resources import Requirement, working_set
version = working_set.find9Requirement.parse('sagenb')).version

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

comment:6

Replying to @TimDumol:

Replying to @qed777:

[...]
On #7447: Can we query the installed version of a package with setuptools and/or pip?

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

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

comment:7

Replying to @qed777:

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.
[..]

Wow, that feature's new. I don't see why not, although it would mean adding another package to Sage.

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 15, 2009

comment:8

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.

@TimDumol
Copy link
Mannequin Author

TimDumol mannequin commented Nov 15, 2009

comment:9

Replying to @qed777:

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.

@qed777
Copy link
Mannequin

qed777 mannequin commented Nov 15, 2009

comment:10

OK, or pip, I suppose. Thanks. I'll put a note at #7447.

@qed777
Copy link
Mannequin

qed777 mannequin commented Dec 5, 2009

comment:11

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.

@qed777 qed777 mannequin added s: positive review and removed s: needs review labels Dec 5, 2009
@qed777
Copy link
Mannequin

qed777 mannequin commented Dec 5, 2009

Reviewer: Mitesh Patel

@williamstein
Copy link
Contributor

comment:13

+1!

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