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

sage --package create --pypi: Create a wheel package by default if possible #36794

Merged
merged 4 commits into from
Dec 14, 2023

Conversation

mkoeppe
Copy link
Member

@mkoeppe mkoeppe commented Dec 1, 2023

We change the default of sage --package create --pypi to create a wheel package (if the package has a platform-independent wheel on PyPI) instead of a normal package (built from source).
This is simpler (no spkg-install.in script, no build dependencies) and a bit faster.

As an illustration, we change one SPKG, six, from normal to wheel.

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

if not PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'):
source = 'normal'
except PyPiError:
source = 'normal'
pypi_version = PyPiVersion(package_name, source=source)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

             if source is None:
                 try:
-                    source = 'wheel'
-                    if not PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'):
+                    if PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'):
+                        source = 'wheel'
+                    else
                         source = 'normal'
                 except PyPiError:

a bit simpler code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done in 818468a

@@ -319,7 +319,7 @@ def make_parser():
'package_name', default=None, type=str,
help='Package name.')
parser_create.add_argument(
'--source', type=str, default='normal', help='Package source (one of normal, wheel, script, pip)')
'--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip; default depends on provided arguments)')
parser_create.add_argument(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

     parser_create.add_argument(
-        '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip; default depends on provided arguments)')
+        '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip); default depends on provided arguments')
     parser_create.add_argument(
         '--version', type=str, default=None, help='Package version')

following the style of other arguments?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 818468a

@@ -1,4 +1,4 @@
| $(PYTHON_TOOLCHAIN) $(PYTHON)
| pip $(PYTHON)

Copy link
Collaborator

@kwankyu kwankyu Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PYTHON_TOOLCHAIN represents "a prerequisite to any pip-installed packages". It does not differentiate source and wheel python packages. Here changing it with just "pip" signals that PYTHON_TOOLCHAIN is only for source python packages. Is it?

On the other hand, packages in PYTHON_TOOLCHAIN are installed anyway because of other packages. So it seems that the change has no real benefit...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing it with just "pip" signals that PYTHON_TOOLCHAIN is only for source python packages. Is it?

Indeed. I have updated the documentation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. OK.

Copy link
Collaborator

@kwankyu kwankyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link

github-actions bot commented Dec 6, 2023

Documentation preview for this PR (built with commit 818468a; changes) is ready! 🎉

@mkoeppe
Copy link
Member Author

mkoeppe commented Dec 6, 2023

Thank you!

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 10, 2023
…age by default if possible

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

We change the default of `sage --package create --pypi` to create a
wheel package (if the package has a platform-independent wheel on PyPI)
instead of a normal package (built from source).
This is simpler (no spkg-install.in script, no build dependencies) and a
bit faster.

As an illustration, we change one SPKG, `six`, from normal to wheel.

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36794
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee, Matthias Köppe
vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 10, 2023
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

We switch several pure Python packages that are part of
`PYTHON_TOOLCHAIN` from normal to wheel packages.

The only time that we carried a patch for any of these packages was in
2014–2016, a patch for pyparsing.

This reduces the complexity of our SPKGs, in line with previous PRs
sagemath#36267, sagemath#36429, sagemath#36129, sagemath#36794.



<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36802
Reported by: Matthias Köppe
Reviewer(s): Dima Pasechnik
vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 13, 2023
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

We switch several pure Python packages that are part of
`PYTHON_TOOLCHAIN` from normal to wheel packages.

The only time that we carried a patch for any of these packages was in
2014–2016, a patch for pyparsing.

This reduces the complexity of our SPKGs, in line with previous PRs
sagemath#36267, sagemath#36429, sagemath#36129, sagemath#36794.



<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36802
Reported by: Matthias Köppe
Reviewer(s): Dima Pasechnik
@vbraun vbraun merged commit 1c19a98 into sagemath:develop Dec 14, 2023
25 of 29 checks passed
@mkoeppe mkoeppe added this to the sage-10.3 milestone Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants