Feature for testing the presence of threejs

class sage.features.threejs.Threejs(*args, **kwds)[source]

Bases: StaticFile

A Feature which describes the presence of threejs-sage in a few standard locations.

EXAMPLES:

sage: from sage.features.threejs import Threejs
sage: bool(Threejs().is_present())  # needs threejs
True
>>> from sage.all import *
>>> from sage.features.threejs import Threejs
>>> bool(Threejs().is_present())  # needs threejs
True
from sage.features.threejs import Threejs
bool(Threejs().is_present())  # needs threejs
cdn_scripts()[source]

Return a script tag that loads Three.js from a CDN.

This is the online counterpart of absolute_filename(). It does not need the threejs package to be installed, only the version file that passagemath-plot ships, so it is usable where the local copy is absent or unreachable.

OUTPUT: string containing a script tag

EXAMPLES:

sage: from sage.features.threejs import Threejs
sage: Threejs().cdn_scripts()                                               # needs sage.plot
'...<script src="https://cdn.jsdelivr.net/gh/sagemath/threejs-sage@...'
>>> from sage.all import *
>>> from sage.features.threejs import Threejs
>>> Threejs().cdn_scripts()                                               # needs sage.plot
'...<script src="https://cdn.jsdelivr.net/gh/sagemath/threejs-sage@...'
from sage.features.threejs import Threejs
Threejs().cdn_scripts()                                               # needs sage.plot
required_version()[source]

Return the version of threejs that Sage requires.

Defining what version is required is delegated to the distribution package that provides the file threejs-version.txt in sage.ext_data.threejs.

If the file is not provided, "unknown" is returned.

EXAMPLES:

sage: from sage.features.threejs import Threejs
sage: type(Threejs().required_version())
<class 'str'>
sage: Threejs().required_version()                                          # needs sage.plot
'r...'
>>> from sage.all import *
>>> from sage.features.threejs import Threejs
>>> type(Threejs().required_version())
<class 'str'>
>>> Threejs().required_version()                                          # needs sage.plot
'r...'
from sage.features.threejs import Threejs
type(Threejs().required_version())
Threejs().required_version()                                          # needs sage.plot
sage.features.threejs.all_features()[source]