Re: [sage-devel] Re: Checker function for integer parameters

2015-09-26 Thread Jori Mäntysalo

On Sat, 26 Sep 2015, Tom Boothby wrote:


Hold on, why do you want to rule out zero?  It seems like a dumb thing
to do a search at depth zero, but raising an error rather than
returning a trivial result is infuriating to a user.


I am not doing that. At first post I asked for functions to check 
integers, nonnegative integers and positive integers. I am quite sure that 
there are places for each of those.


(Of course there are other restrictions too, like >= 3 for DiamondPoset. 
But I guess that they are rare.)


--
Jori Mäntysalo


[sage-devel] Re: [ANN] Nemo: A computer algebra package for Julia

2015-09-26 Thread 'Bill Hart' via sage-devel
I've just tagged Nemo-0.3.1. This fixes some issues on OSX and on 32 bit
platforms that were reported. Other platforms are not affected.

Note that on OSX we don't provide binaries, but build from source. So you
need a working build environment (a fairly recent Xcode -- is that the
right incantation?) Older build environments reportedly don't work.

Apparently GNU m4 fails to configure on OSX (if anyone knows why, it would
be helpful to know). So for now you *may* need a working m4 in your path on
OSX. The symptoms are it bombs out with a message about the compiler not
working.

* If you have Nemo on a 32 bit machine you will need to do

   Pkg.update()

* If you have Nemo on OSX and it failed to build for you, you will need to
do

   Pkg.update()
   Pkg.build("Nemo")

If it still fails to build for you on OSX and you have a recent
environment, we'd appreciate the build/bug report.

Bill.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Checker function for integer parameters

2015-09-26 Thread Tom Boothby
Hold on, why do you want to rule out zero?  It seems like a dumb thing
to do a search at depth zero, but raising an error rather than
returning a trivial result is infuriating to a user.

On Sat, Sep 26, 2015 at 11:06 AM, John H Palmieri
 wrote:
>
>
> On Saturday, September 26, 2015 at 10:55:57 AM UTC-7, Jori Mäntysalo wrote:
>>
>> On Sat, 26 Sep 2015, Travis Scrimshaw wrote:
>>
>> > I would use:
>> >
>> > if n not in ZZ:
>> >raise ValueError(...)
>>
>> Seems easy. But to make sure: does this work in all cases? I.e. raw Python
>> ints, Sage Integers, maybe something else too? At least QQ(3) in NN seems
>> to work.
>>
>> How about positive integers? "n-1 in NN" gives bad error message if n is
>> for example string. "n in NN and n>0"?
>
>
> try:
> NN(n)
> except ValueError:
> handle the error
>
> or since you want to rule out n=0:
>
> try:
> NN(n-1)
> except (ValueError, TypeError):
> handle the error...
>
>
> --
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Checker function for integer parameters

2015-09-26 Thread John H Palmieri


On Saturday, September 26, 2015 at 10:55:57 AM UTC-7, Jori Mäntysalo wrote:
>
> On Sat, 26 Sep 2015, Travis Scrimshaw wrote: 
>
> > I would use: 
> > 
> > if n not in ZZ: 
> >raise ValueError(...) 
>
> Seems easy. But to make sure: does this work in all cases? I.e. raw Python 
> ints, Sage Integers, maybe something else too? At least QQ(3) in NN seems 
> to work. 
>
> How about positive integers? "n-1 in NN" gives bad error message if n is 
> for example string. "n in NN and n>0"? 
>

try:
NN(n)
except ValueError:
handle the error

or since you want to rule out n=0:

try:
NN(n-1)
except (ValueError, TypeError):
handle the error...


-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Checker function for integer parameters

2015-09-26 Thread Jori Mäntysalo

On Sat, 26 Sep 2015, Travis Scrimshaw wrote:


I would use:

if n not in ZZ:
   raise ValueError(...)


Seems easy. But to make sure: does this work in all cases? I.e. raw Python 
ints, Sage Integers, maybe something else too? At least QQ(3) in NN seems 
to work.


How about positive integers? "n-1 in NN" gives bad error message if n is 
for example string. "n in NN and n>0"?


--
Jori Mäntysalo


[sage-devel] Re: Checker function for integer parameters

2015-09-26 Thread Travis Scrimshaw
I would use:

if n not in ZZ:
   raise ValueError(...)

Best,
Travis


On Saturday, September 26, 2015 at 12:35:05 PM UTC-5, Jori Mäntysalo wrote:
>
> An example: 
>
> sage: g = Graph({0:[1,2]}) 
> sage: list(g.breadth_first_search(0, distance='junk')) 
> [0, 1, 2] 
>
> This can be corrected: try: n = Integer(...) ... if n<0: raise... 
>
> But it seems stupid to mechanically copy this code. So should we add 
> something like _check_integer_all(), _check_integer_nonnegative() and 
> _check_integer_positive() to Sage? This way hopefully we would get more 
> checking for errors and have unified exception strings? 
>
> -- 
> Jori Mäntysalo 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Checker function for integer parameters

2015-09-26 Thread Jori Mäntysalo

An example:

sage: g = Graph({0:[1,2]})
sage: list(g.breadth_first_search(0, distance='junk'))
[0, 1, 2]

This can be corrected: try: n = Integer(...) ... if n<0: raise...

But it seems stupid to mechanically copy this code. So should we add 
something like _check_integer_all(), _check_integer_nonnegative() and 
_check_integer_positive() to Sage? This way hopefully we would get more 
checking for errors and have unified exception strings?


--
Jori Mäntysalo


[sage-devel] Re: Sage on OSX 10.11 and library paths

2015-09-26 Thread kcrisman


> TLDR: Don't install OSX 10.11 if you want to use Sage
>
>
This should probably be prominently mentioned somewhere on the download 
pages...

 

> OSX 10.11 disabled DYLD_* variables for scripts, more precisely: If a 
> script file begins with a shebang the DYLD_* environment variables are 
> omitted from the set of environment variables passed to that interpreter. 
> So that fundamentally kills the way Sage runs on OSX.
>
> We either 
> a) always re-set DYLD_LIBRARY_PATH in each bash or Python script that 
> calls one of Sage's binaries, or
> b) give up on DYLD/LD_LIBRARY_PATH and switch to rpath/runpath. Which we 
> should have done a decade ago but then nobody is listening to me ;-P Which 
> also means: no relocatable binaries unless your system has a tool to 
> rewrite the paths installed.
>

So if someone downloads a binary it would be useless anyway, or if they 
build from scratch but then move it to Applications/ it would be useless, 
or (presumably) both?  That's not ideal at all for end users, though I 
guess the whole mess isn't ideal :(

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Sage in Mac OSX 11.11 (El Capitan)

2015-09-26 Thread Juan Luis Varona

> 
> Post the Sage_crash_report.txt
> (Sage 6.9rc0 with xcode 7 under macosx 10.11)
> 

Here it is:

***

IPython post-mortem report

{'commit_hash': u'2f7c727',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': 
'/Applications/sage-6.9.rc0/local/lib/python2.7/site-packages/IPython',
 'ipython_version': '4.0.0',
 'os_name': 'posix',
 'platform': 'Darwin-15.0.0-x86_64-i386-64bit',
 'sys_executable': '/Applications/sage-6.9.rc0/local/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '2.7.9 (default, Sep 26 2015, 01:38:56) \n[GCC 4.9.2]'}

***



***

Crash traceback:

---
---
ImportError   Python 2.7.9: /Applications/sage-6.9.rc0/local/bin/python
   Sat Sep 26 13:33:08 2015
A problem occurred executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/Applications/sage-6.9.rc0/src/bin/sage-ipython in ()
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 """
  4 Sage IPython startup script.
  5 """
  6 
  7 # Install extra readline commands before IPython initialization
  8 from sage.repl.readline_extra_commands import *
  9 
 10 from sage.repl.interpreter import SageTerminalApp
 11 
 12 app = SageTerminalApp.instance()
---> 13 app.initialize()
global app.initialize = >
 14 app.start()

/Applications/sage-6.9.rc0/local/lib/python2.7/site-packages/IPython/terminal/ipapp.pyc
 in initialize(self=, argv=None)

/Applications/sage-6.9.rc0/local/lib/python2.7/site-packages/traitlets/config/application.pyc
 in catch_config_error(method=, 
app=, *args=(None,), **kwargs={})
 60 
 61 
#-
 62 # Application class
 63 
#-
 64 
 65 @decorator
 66 def catch_config_error(method, app, *args, **kwargs):
 67 """Method decorator for catching invalid config 
(Trait/ArgumentErrors) during init.
 68 
 69 On a TraitError (generally caused by bad config), this will print 
the trait's
 70 message, and exit the app.
 71 
 72 For use on init methods, to prevent invoking excepthook on invalid 
input.
 73 """
 74 try:
---> 75 return method(app, *args, **kwargs)
method = 
app = 
args = (None,)
kwargs = {}
 76 except (TraitError, ArgumentError) as e:
 77 app.print_help()
 78 app.log.fatal("Bad config encountered during initialization:")
 79 app.log.fatal(str(e))
 80 app.log.debug("Config at the time: %s", app.config)
 81 app.exit(1)
 82 
 83 
 84 class ApplicationError(Exception):
 85 pass
 86 
 87 class LevelFormatter(logging.Formatter):
 88 """Formatter with additional `highlevel` record
 89 
 90 This field is empty if log level is less than highlevel_limit,

/Applications/sage-6.9.rc0/local/lib/python2.7/site-packages/IPython/terminal/ipapp.pyc
 in initialize(self=, argv=None)
299 
300 return super(TerminalIPythonApp, self).parse_command_line(argv)
301 
302 @catch_config_error
303 def initialize(self, argv=None):
304 """Do actions after construct, but before starting the app."""
305 super(TerminalIPythonApp, self).initialize(argv)
306 if self.subapp is not None:
307 # don't bother initializing further, starting subapp
308 return
309 # print self.extra_args
310 if self.extra_args and not self.something_to_run:
311 self.file_to_run = self.extra_args[0]
312 self.init_path()
313 # create the shell
--> 314 self.init_shell()
self.init_shell = >
315 # and draw the banner
316 self.init_banner()
317 # Now a variety of things that happen after the banner is 
printed.
318 self.init_gui_pylab()
319 self.init_extensions()
320 self.init_code()
321 
322 def init_shell(self):
323 """initialize the InteractiveShell instance"""
324 # Create an InteractiveShell instance.
325 # shell.display_banner should always be False for the terminal
326 # based app, because we call shell.show_banner() by hand below
327 # so the banner shows *before* all extension loading st

[sage-devel] Sage on OSX 10.11 and library paths

2015-09-26 Thread Volker Braun
TLDR: Don't install OSX 10.11 if you want to use Sage

OSX 10.11 disabled DYLD_* variables for scripts, more precisely: If a 
script file begins with a shebang the DYLD_* environment variables are 
omitted from the set of environment variables passed to that interpreter. 
So that fundamentally kills the way Sage runs on OSX.

We either 
a) always re-set DYLD_LIBRARY_PATH in each bash or Python script that calls 
one of Sage's binaries, or
b) give up on DYLD/LD_LIBRARY_PATH and switch to rpath/runpath. Which we 
should have done a decade ago but then nobody is listening to me ;-P Which 
also means: no relocatable binaries unless your system has a tool to 
rewrite the paths installed.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Sage in Mac OSX 11.11 (El Capitan)

2015-09-26 Thread Volker Braun
Post the Sage_crash_report.txt

On Saturday, September 26, 2015 at 11:50:15 AM UTC+2, Juan Luis Varona 
wrote:
>
> Unfortunately, the compiling process of sage 6.9rc0 with xcode 7 under 
> macosx 10.11 has finished with errors: 
>
> — 
>
>  
> Unhandled SIGSEGV: A segmentation fault occurred in Sage. 
> This probably occurred because a *compiled* component of Sage has a bug 
> in it and is not properly wrapped with sig_on(), sig_off(). 
> Sage will now terminate. 
>  
> /Applications/sage-6.9.rc0/build/bin/sage-logger: line 32: 97809 
> Segmentation fault: 11  ./sage --docbuild --no-pdf-links all html 
> make[2]: *** [doc-html] Error 139 
> make[1]: *** [all] Error 2 
>
> real673m6.573s 
> user583m48.760s 
> sys71m8.235s 
> *** 
> Error building Sage. 
>
> The following package(s) may have failed to build (not necessarily 
> during this run of 'make all'): 
>
> The build directory may contain configuration files and other potentially 
> helpful information. WARNING: if you now run 'make' again, the build 
> directory will, by default, be deleted. Set the environment variable 
> SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this. 
>
> make: *** [all] Error 1 
>
> — 
>
> This is the complete log file (23 megas file): 
>
> https://dl.dropboxusercontent.com/u/8293746/log-compiling-sage69rc0-xcode7-macosx10.11.txt
>  
>
> And this is what I obtain executing sage: 
>
>
> ┌┐ 
> │ SageMath Version 6.9.rc0, Release Date: 2015-09-25 │ 
> │ Type "notebook()" for the browser-based notebook interface.│ 
> │ Type "help()" for help.│ 
> └┘ 
> ┏┓ 
> ┃ Warning: this is a prerelease version, and it may be unstable. ┃ 
> ┗┛ 
> This looks like the first time you are running Sage. 
> Updating various hardcoded paths... 
> (Please wait at most a few minutes.) 
> DO NOT INTERRUPT THIS. 
> Done updating paths. 
>
> ** 
>
> Oops, Sage crashed. We do our best to make it stable, but... 
>
> A crash report was automatically generated with the following information: 
>   - A verbatim copy of the crash traceback. 
>   - A copy of your input history during this session. 
>   - Data on your current Sage configuration. 
>
> It was left in the file named: 
> '/Users/jvarona/.sage/ipython_genutils-0.1.0/Sage_crash_report.txt' 
>
> If you can email this file to the developers, the information in it will 
> help 
> them in understanding and correcting the problem. 
>
> You can mail it to: sage-support at sage-s...@googlegroups.com 
>  
> with the subject 'Sage Crash Report'. 
>
> If you want to do it now, the following command will work (under Unix): 
> mail -s 'Sage Crash Report' sage-s...@googlegroups.com  < 
> /Users/jvarona/.sage/ipython_genutils-0.1.0/Sage_crash_report.txt 
>
> To ensure accurate tracking of this issue, please file a report about it 
> at: 
> http://trac.sagemath.org 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Sage in Mac OSX 11.11 (El Capitan)

2015-09-26 Thread Juan Luis Varona
Unfortunately, the compiling process of sage 6.9rc0 with xcode 7 under macosx 
10.11 has finished with errors:

—


Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Sage will now terminate.

/Applications/sage-6.9.rc0/build/bin/sage-logger: line 32: 97809 Segmentation 
fault: 11  ./sage --docbuild --no-pdf-links all html
make[2]: *** [doc-html] Error 139
make[1]: *** [all] Error 2

real673m6.573s
user583m48.760s
sys 71m8.235s
***
Error building Sage.

The following package(s) may have failed to build (not necessarily
during this run of 'make all'):

The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.

make: *** [all] Error 1

—

This is the complete log file (23 megas file):
https://dl.dropboxusercontent.com/u/8293746/log-compiling-sage69rc0-xcode7-macosx10.11.txt

And this is what I obtain executing sage:


┌┐
│ SageMath Version 6.9.rc0, Release Date: 2015-09-25 │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘
┏┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗┛
This looks like the first time you are running Sage.
Updating various hardcoded paths...
(Please wait at most a few minutes.)
DO NOT INTERRUPT THIS.
Done updating paths.

**

Oops, Sage crashed. We do our best to make it stable, but...

A crash report was automatically generated with the following information:
  - A verbatim copy of the crash traceback.
  - A copy of your input history during this session.
  - Data on your current Sage configuration.

It was left in the file named:
'/Users/jvarona/.sage/ipython_genutils-0.1.0/Sage_crash_report.txt'
If you can email this file to the developers, the information in it will help
them in understanding and correcting the problem.

You can mail it to: sage-support at sage-supp...@googlegroups.com
with the subject 'Sage Crash Report'.

If you want to do it now, the following command will work (under Unix):
mail -s 'Sage Crash Report' sage-supp...@googlegroups.com < 
/Users/jvarona/.sage/ipython_genutils-0.1.0/Sage_crash_report.txt

To ensure accurate tracking of this issue, please file a report about it at:
http://trac.sagemath.org


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] how should the expression relation test be named?

2015-09-26 Thread Ralf Stephan

>
> The question is if we should call it is().
>

Impossible because it is a Python keyword.
So, lacking a better proposal I'll stick to holds()
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.