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 --standard, sage --optional and sage --experimental are broken #32885

Closed
seblabbe opened this issue Nov 16, 2021 · 15 comments
Closed

sage --standard, sage --optional and sage --experimental are broken #32885

seblabbe opened this issue Nov 16, 2021 · 15 comments

Comments

@seblabbe
Copy link
Contributor

On Ubuntu 18.04 with 9.5.beta6, sage --standard, sage --optional and sage --experimental are broken:

$ sage --standard
[package]...............................[latest version] ([version])

Traceback (most recent call last):
  File "/home/slabbe/GitBox/sage/src/bin/sage-list-packages", line 102, in <module>
    pkg.installed_version = pkg.installed_version or 'not_installed'
AttributeError: can't set attribute


$ sage --optional
[package]...............................[latest version] ([version])

/home/slabbe/GitBox/sage/local/lib/python3.9/site-packages/sage/misc/package.py:117: UserWarning: failed to fetch the version of pkg='ore_algebra' at https://pypi.org/pypi/ore_algebra/json
  warnings.warn("failed to fetch the version of pkg={!r} at {}".format(pkg, url))
Traceback (most recent call last):
  File "/home/slabbe/GitBox/sage/src/bin/sage-list-packages", line 102, in <module>
    pkg.installed_version = pkg.installed_version or 'not_installed'
AttributeError: can't set attribute


$ sage --experimental
[package]...............................[latest version] ([version])

Traceback (most recent call last):
  File "/home/slabbe/GitBox/sage/src/bin/sage-list-packages", line 102, in <module>
    pkg.installed_version = pkg.installed_version or 'not_installed'
AttributeError: can't set attribute

This leads to the following doctests to fail.

$ sage -t --optional=sage,internet src/sage/tests/cmdline.py

gives

[218 tests, 9 failures, 36.22 s]

Component: distribution

Author: John Palmieri

Branch/Commit: 50daef4

Reviewer: Sébastien Labbé

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

@seblabbe seblabbe added this to the sage-9.5 milestone Nov 16, 2021
@seblabbe seblabbe changed the title 9 internet doctests failing in tests/cmdling.py - AttributeError: can't set attribute 9 internet doctests failing in tests/cmdline.py - AttributeError: can't set attribute Nov 16, 2021
@seblabbe

This comment has been minimized.

@seblabbe

This comment has been minimized.

@seblabbe seblabbe changed the title 9 internet doctests failing in tests/cmdline.py - AttributeError: can't set attribute sage --standard, sage --optional and sage --experimental are broken Nov 16, 2021
@seblabbe

This comment has been minimized.

@jhpalmieri
Copy link
Member

comment:5

Something like this?

diff --git a/src/bin/sage-list-packages b/src/bin/sage-list-packages
index 813b1c0d64..93e3438b11 100755
--- a/src/bin/sage-list-packages
+++ b/src/bin/sage-list-packages
@@ -99,8 +99,10 @@ L.sort(key=lambda pkg: pkg.name)
 
 # print (while getting rid of None in versions)
 for pkg in L:
-    pkg.installed_version = pkg.installed_version or 'not_installed'
-    pkg.remote_version = pkg.remote_version or '?'
-    print(format_string.format(**pkg._asdict()))
+    d = {}
+    d['name'] = pkg.name
+    d['installed_version'] = pkg.installed_version or 'not_installed'
+    d['remote_version'] = pkg.remote_version or '?'
+    print(format_string.format(**d))
 if WARN:
     print(WARN)

@jhpalmieri
Copy link
Member

comment:6

Or

diff --git a/src/bin/sage-list-packages b/src/bin/sage-list-packages
index 813b1c0d64..16a6a4ab18 100755
--- a/src/bin/sage-list-packages
+++ b/src/bin/sage-list-packages
@@ -99,8 +99,8 @@ L.sort(key=lambda pkg: pkg.name)
 
 # print (while getting rid of None in versions)
 for pkg in L:
-    pkg.installed_version = pkg.installed_version or 'not_installed'
-    pkg.remote_version = pkg.remote_version or '?'
+    pkg = pkg._replace(installed_version = pkg.installed_version or 'not_installed',
+                       remote_version = pkg.remote_version or '?')
     print(format_string.format(**pkg._asdict()))
 if WARN:
     print(WARN)

@jhpalmieri
Copy link
Member

comment:7

Regardless, I still get an error with ./sage -t --optional=sage,internet src/sage/tests/cmdline.py:

sage -t --random-seed=49741205059645622454424668273577198155 src/sage/tests/cmdline.py
**********************************************************************
File "src/sage/tests/cmdline.py", line 606, in sage.tests.cmdline.test_executable
Failed example:
    err  # optional - internet
Expected:
    ''
Got:
    '/Users/palmieri/Desktop/Sage/git/sage/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/misc/package.py:117: UserWarning: failed to fetch the version of pkg=\'ore_algebra\' at https://pypi.org/pypi/ore_algebra/json\n  warnings.warn("failed to fetch the version of pkg={!r} at {}".format(pkg, url))\n'
**********************************************************************
1 item had failures:
   1 of 219 in sage.tests.cmdline.test_executable
    [218 tests, 1 failure, 47.78 s]

The ore_algebra package looks like it's missing from pypi.

@seblabbe
Copy link
Contributor Author

comment:8

The ore_algebra issue is dealt at #31475

@jhpalmieri
Copy link
Member

Branch: u/jhpalmieri/sage-list-packages

@jhpalmieri
Copy link
Member

comment:10

Here's a branch; it also adds spaces in some deprecation messages (to print "the functions standard_packages, optional_packages, experimental_packages are deprecated" instead of "... experimental_packagesare deprecated").


New commits:

50daef4trac 32885: use pkg._replace(...) to change properties,

@jhpalmieri
Copy link
Member

Commit: 50daef4

@jhpalmieri
Copy link
Member

Author: John Palmieri

@seblabbe
Copy link
Contributor Author

comment:11

It works on my side. I wait for the patchbot status to change the status to positive review.

@seblabbe
Copy link
Contributor Author

Reviewer: Sébastien Labbé

@jhpalmieri
Copy link
Member

comment:13

Thanks!

@vbraun
Copy link
Member

vbraun commented Dec 5, 2021

Changed branch from u/jhpalmieri/sage-list-packages to 50daef4

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

3 participants