# import sage packages in python

An easy way to use sage in python files is demonstrated in the Sage Tutorial.

```
#!/usr/bin/env sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
```

Well, what if I don't want to import *all* of sage as shown above using:

```
from sage.all import *
```

Instead of this command above, I just want to import the following:

- Matrix -> type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'
- vector -> type 'sage.modules.vector_integer_dense.Vector_integer_dense'
- ZZ -> type 'sage.rings.integer_ring.IntegerRing_class'
- MixedIntegerLinearProgram -> type 'sage.numerical.mip.MixedIntegerLinearProgram'

So I should be able to write something like this in python

```
from sage.library.package.for.Matrix import *
from sage.library.package.for.vector import *
from sage.library.package.for.ZZ import *
from sage.library.package.for.MixedIntegerLinearProgram import *
```

I just don't know what they are. Any help is appreciated.

Thanks.

I'd be really careful with this. The cascade of imports is very convoluted, and there isn't any guarantee that importing something like `ZZ` won't import most of the rest of Sage. It may not be worth the effort.