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

Meta-ticket: Make sagelib a pip-installable Python source package, listed on PyPI #21507

Closed
mkoeppe opened this issue Sep 16, 2016 · 64 comments
Closed

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 16, 2016

This task ticket, organizing the steps necessary to eventually provide sagelib via PyPI, has been superseded by Meta-ticket #29705: Modularize sagelib into separate distributions (distutils packages).

. . . . . . . . . . . . . . . . .

It would be used by a Python user as follows. Let's assume a user has already installed every package that sage-the-distribution provides on their distribution.
Then a simple

pip install sagelib

would install sagelib in the user's Python installation. Then the user could do from sage.all import *.

. . . . . . . . . . . . . . . . .

Here are the first steps:

This defines milestone 1. sagelib is now a well-behaved Python package. It can be built and installed as follows (without invoking sage -sh):

export SAGE_LOCAL=/path/to/local/hierarchy/populated/by/sage/distribution
export SAGE_PKGS=/path/to/sage/distribution/source/directory/build/pkgs
$SAGE_LOCAL/bin/python setup.py install   # or pip install . 

. . . . . . . . . . . . . . . . .

Next steps:

This defines milestone 2. sagelib can now be built and installed as follows (without invoking sage -sh):

export SAGE_LOCAL=/path/to/local/hierarchy/populated/by/sage/distribution
$SAGE_LOCAL/bin/python setup.py install   # or pip install . 

. . . . . . . . . . . . . . . . .

Next steps:

This defines milestone 3. If SAGE_LOCAL is not set, then sagelib will discover system packages and Python packages installed in standard places.

python setup.py install   # or pip install . 

At this point, sagelib will be a standard pip-installable Python source package, ready for upload to PyPI.

Binary packages (using wheels etc.) is beyond the scope of this ticket.

. . . . . . . . . . . . . . . . .

See also:

. . . . . . . . . . . . . . References . . . . . . . . . . . . . . .

CC: @jdemeyer @williamstein @vbraun @videlec @dimpase @kiwifb @embray @nexttime @sagetrac-aenge @nthiery @miguelmarco @kwankyu @robertwb @infinity0 @tobihan @defeo @slel @timokau @kevinywlui @isuruf @jhpalmieri

Component: build

Keywords: pip, PyPI

Reviewer: Dima Pasechnik

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

@mkoeppe mkoeppe added this to the sage-7.4 milestone Sep 16, 2016
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-7.4, sage-7.5 Sep 17, 2016
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@embray
Copy link
Contributor

embray commented Sep 22, 2016

comment:10

Thanks for taking the lead on this. There's more still be to added to the list of issues, such as providing binary wheels and how that will be handled. I think it will be important to also make more progress on making some hard dependencies optional (that is, allow optional features to fail gracefully if a dependency for that feature is not found).

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 22, 2016

comment:11

Replying to @embray:

There's more still be to added to the list of issues, such as providing binary wheels and how that will be handled.

Definitely. I'm hoping that we can use this ticket to organize it.

I think it will be important to also make more progress on making some hard dependencies optional (that is, allow optional features to fail gracefully if a dependency for that feature is not found).

I agree.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 22, 2016

comment:12

Here's a question for the distutils experts. Is a Python package allowed to install things in bin/? Do any other Python packages do that?
Where would one install helper scripts? Is there a Python equivalent of $prefix/libexec?

@mkoeppe

This comment has been minimized.

@williamstein
Copy link
Contributor

comment:14

This Python package, which is part of SMC, installs many things to /usr/local/bin using completely standard approaches: https://github.com/sagemathinc/smc/tree/master/src/smc_pyutil. See, in particular, the console_scripts section of setup.py: https://github.com/sagemathinc/smc/blob/master/src/smc_pyutil/setup.py#L58

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 22, 2016

comment:15

Thanks a lot! Following your pointer, I've found this documentation: http://python-packaging.readthedocs.io/en/latest/command-line-scripts.html, which I will refer to alongside the example that you pointed out.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 22, 2016

comment:17

This now #21569.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@embray
Copy link
Contributor

embray commented Sep 23, 2016

comment:21

I don't like the phrasing "PyPI package". There's no such thing as a "PyPI package" per se.
Let's be more clear about what we want here--should it be buildable from a source package? Or are we providing binary wheels? Both? Neither?

@embray
Copy link
Contributor

embray commented Sep 23, 2016

comment:22

I wonder if this work might not also benefit from adopting portions of astropy-helpers into Sage's build tools. I don't think it would necessarily be appropriate to use directly--although there's nothing very "astropy" specific in astropy-helpers, a lot of it does assume one is using the astropy project template, or something close to it. But large swaths of it are very generic, and I put a lot of work into developing tools for build sanity of large Python projects.

Some key features that I think might benefit sage include:

  • per-subpackage setup_package.py modules, which can contain any number of a (mostly) well-documented hooks for building compiled modules in that sub-package. This provides a clear and explicit alternative to a monolithic module_list.py (see the discussion here), and would also make it easier to break off some of Sage's subpackages into standalone packages should the time ever come for that.
  • one of the less-well-documented features is also that setup_package.py can contain hooks for setup.py commands. For example, if a module contains some generated code (a la sage_setup.autogen), it can include a pre_build_ext hook to make sure the generated code is up to date before running the ./setup.py build_ext command (either explicitly, or implicitly as a sub-command). This makes it relatively easy for individual submodules to put hooks into the build process without having to write complicated command subclasses cluttered with subpackage-specific crud.
  • smarter handling of Cython modules--for example, when creating a source tarball it will make sure all Cython modules have been Cythonized, and it will include the resulting C/C++ sources in the source tarball. This ensures that the user does not need Cython to be installed in order to build from source (which is good, because even if they do have Cython it will often be the wrong version--and in Sage's case missing important patches as well).

Those are the main ones for now but I could probably think of more.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 23, 2016

comment:23

Replying to @embray:

I don't like the phrasing "PyPI package". There's no such thing as a "PyPI package" per se.
Let's be more clear about what we want here--should it be buildable from a source package? Or are we providing binary wheels? Both? Neither?

The scope of this ticket is a source package that is pip-installable and would be listed as such on PyPI.

Binary packaging (about which I don't know anything at the moment) is beyond the scope of this ticket.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 23, 2016

comment:24

Replying to @embray:

I wonder if this work might not also benefit from adopting portions of astropy-helpers into Sage's build tools.

This all sounds great and seems like it could be part of #21508 or be a follow up to it.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 23, 2016

comment:25

I've updated the description to explain the scope of the ticket better.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Make sagelib a PyPI package Make sagelib a pip-installable Python source package, listed on PyPI Sep 23, 2016
@mkoeppe

This comment has been minimized.

@slel
Copy link
Member

slel commented Feb 14, 2018

comment:53

There is interest in this process, see
Ask Sage #40947: SageMath as a regular python package.

@slel

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented Jun 8, 2018

comment:54

Added #25546

@jdemeyer

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-7.6, sage-9.1 Jan 18, 2020
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 18, 2020

comment:58

I propose that we get this task ticket done in 2020.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@Shlokatadistance
Copy link
Mannequin

Shlokatadistance mannequin commented Mar 21, 2020

comment:61

The major problem I feel with making something like Sage into a python package is owing to the enormous complexity of Sagemath, the application itself has such major features , and I am not sure how much would we need to modify the application in order to help the proper incorporation of Sage into ordinary python code.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 21, 2020

comment:62

Yes, the complexity is why we use a meta-ticket to organize the necessary steps.

If you want to help, you can work on a well-defined ticket such as #21516.

@Shlokatadistance
Copy link
Mannequin

Shlokatadistance mannequin commented Mar 30, 2020

comment:63

Hi sorry for the delay, I'll start working on this right away
Replying to @mkoeppe:

Yes, the complexity is why we use a meta-ticket to organize the necessary steps.

If you want to help, you can work on a well-defined ticket such as #21516.

@mkoeppe mkoeppe modified the milestones: sage-9.1, sage-9.2 Apr 9, 2020
@mkoeppe mkoeppe changed the title Task ticket: Make sagelib a pip-installable Python source package, listed on PyPI Meta-ticket: Make sagelib a pip-installable Python source package, listed on PyPI Apr 19, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Oct 24, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 26, 2020

comment:69

Let's close this ticket. Meta-ticket #29705 describes the updated plan.

@dimpase
Copy link
Member

dimpase commented Oct 27, 2020

Reviewer: Dima Pasechnik

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

7 participants