diff --git a/ecfactory/bn_curves/bn_curves.py b/ecfactory/bn_curves/bn_curves.py index 60e82c3..0688338 100644 --- a/ecfactory/bn_curves/bn_curves.py +++ b/ecfactory/bn_curves/bn_curves.py @@ -1,4 +1,17 @@ -from sage.all import random, power_mod, primitive_root, Integer, random_prime, is_prime, kronecker, squarefree_part, is_square, Mod, fundamental_discriminant, sqrt, log, floor +from sage.misc.prandom import random +from sage.arith.misc import power_mod +from sage.arith.misc import primitive_root +from sage.rings.integer import Integer +from sage.arith.misc import random_prime +from sage.arith.misc import is_prime +from sage.arith.misc import kronecker +from sage.misc.functional import squarefree_part +from sage.arith.misc import is_square +from sage.rings.finite_rings.integer_mod import Mod +from sage.arith.misc import fundamental_discriminant +from sage.misc.functional import sqrt +from sage.misc.functional import log +from sage.functions.other import floor from ecfactory.utils import is_valid_curve import ecfactory.utils as utils diff --git a/ecfactory/bn_curves/bn_curves_tests.py b/ecfactory/bn_curves/bn_curves_tests.py index f35836d..9392979 100644 --- a/ecfactory/bn_curves/bn_curves_tests.py +++ b/ecfactory/bn_curves/bn_curves_tests.py @@ -1,4 +1,4 @@ -from sage.all import randint +from sage.misc.prandom import randint import ecfactory.bn_curves as bn import ecfactory.utils as utils diff --git a/ecfactory/cocks_pinch/cocks_pinch.py b/ecfactory/cocks_pinch/cocks_pinch.py index d5f46a7..b04ef97 100644 --- a/ecfactory/cocks_pinch/cocks_pinch.py +++ b/ecfactory/cocks_pinch/cocks_pinch.py @@ -1,4 +1,15 @@ -from sage.all import random, power_mod, primitive_root, Integer, random_prime, is_prime, kronecker, squarefree_part, is_square, Mod, fundamental_discriminant, randint +from sage.misc.prandom import random +from sage.arith.misc import power_mod +from sage.arith.misc import primitive_root +from sage.rings.integer import Integer +from sage.arith.misc import random_prime +from sage.arith.misc import is_prime +from sage.arith.misc import kronecker +from sage.misc.functional import squarefree_part +from sage.arith.misc import is_square +from sage.rings.finite_rings.integer_mod import Mod +from sage.arith.misc import fundamental_discriminant +from sage.misc.prandom import randint import time from ecfactory.utils import is_valid_curve import ecfactory.utils as utils diff --git a/ecfactory/cocks_pinch/cocks_pinch_tests.py b/ecfactory/cocks_pinch/cocks_pinch_tests.py index eb75b46..237bf6e 100644 --- a/ecfactory/cocks_pinch/cocks_pinch_tests.py +++ b/ecfactory/cocks_pinch/cocks_pinch_tests.py @@ -1,4 +1,4 @@ -from sage.all import randint +from sage.misc.prandom import randint import time import ecfactory.cocks_pinch as cp import ecfactory.utils as utils diff --git a/ecfactory/complex_multiplication/complex_multiplication.py b/ecfactory/complex_multiplication/complex_multiplication.py index cfb07d6..ae81ffb 100644 --- a/ecfactory/complex_multiplication/complex_multiplication.py +++ b/ecfactory/complex_multiplication/complex_multiplication.py @@ -1,4 +1,14 @@ -from sage.all import power_mod, primitive_root, is_square, hilbert_class_polynomial, is_prime,GF, EllipticCurve, kronecker, randint, Integer, Mod +from sage.arith.misc import power_mod +from sage.arith.misc import primitive_root +from sage.arith.misc import is_square +from sage.schemes.elliptic_curves.cm import hilbert_class_polynomial +from sage.arith.misc import is_prime +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.schemes.elliptic_curves.constructor import EllipticCurve +from sage.arith.misc import kronecker +from sage.misc.prandom import randint +from sage.rings.integer import Integer +from sage.rings.finite_rings.integer_mod import Mod from ecfactory.utils import is_valid_curve import ecfactory.utils as utils diff --git a/ecfactory/complex_multiplication/complex_multiplication_examples.py b/ecfactory/complex_multiplication/complex_multiplication_examples.py index b6a0362..7da0887 100644 --- a/ecfactory/complex_multiplication/complex_multiplication_examples.py +++ b/ecfactory/complex_multiplication/complex_multiplication_examples.py @@ -1,4 +1,4 @@ -from sage.all import EllipticCurve +from sage.schemes.elliptic_curves.constructor import EllipticCurve import ecfactory.complex_multiplication as cm from ecfactory.utils import print_curve diff --git a/ecfactory/complex_multiplication/complex_multiplication_tests.py b/ecfactory/complex_multiplication/complex_multiplication_tests.py index d939406..e20eef4 100644 --- a/ecfactory/complex_multiplication/complex_multiplication_tests.py +++ b/ecfactory/complex_multiplication/complex_multiplication_tests.py @@ -1,4 +1,4 @@ -from sage.all import randint +from sage.misc.prandom import randint import time import ecfactory.cocks_pinch as cp import ecfactory.complex_multiplication as cm diff --git a/ecfactory/dupont_enge_morain/dupont_enge_morain.py b/ecfactory/dupont_enge_morain/dupont_enge_morain.py index a302d07..cf3ab55 100644 --- a/ecfactory/dupont_enge_morain/dupont_enge_morain.py +++ b/ecfactory/dupont_enge_morain/dupont_enge_morain.py @@ -1,5 +1,24 @@ -from sage.all_cmdline import x -from sage.all import random, power_mod, primitive_root, Integer, random_prime, is_prime, kronecker, squarefree_part, is_square, Mod, PolynomialRing, ZZ, fundamental_discriminant, randint, GF,sqrt, round, floor, ceil, euler_phi, log +from sage.misc.prandom import random +from sage.arith.misc import power_mod +from sage.arith.misc import primitive_root +from sage.rings.integer import Integer +from sage.arith.misc import random_prime +from sage.arith.misc import is_prime +from sage.arith.misc import kronecker +from sage.misc.functional import squarefree_part +from sage.arith.misc import is_square +from sage.rings.finite_rings.integer_mod import Mod +from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing +from sage.rings.integer_ring import Z as ZZ +from sage.arith.misc import fundamental_discriminant +from sage.misc.prandom import randint +from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF +from sage.misc.functional import sqrt +from sage.misc.functional import round +from sage.functions.other import floor +from sage.functions.other import ceil +from sage.arith.misc import euler_phi +from sage.misc.functional import log import time from ecfactory.utils import is_valid_curve import ecfactory.utils as utils @@ -34,6 +53,7 @@ def method(num_bits,k,D,y,max_trials=10000): def _method_pt1(num_bits,k,D,y): a = Integer(-D*y**2) R = PolynomialRing(ZZ,'x') + x = R.gen(0) f = R.cyclotomic_polynomial(k)(x-1).polynomial(base_ring = R) g = (a+(x-2)**2).polynomial(base_ring = R) r = Integer(f.resultant(g)) diff --git a/ecfactory/dupont_enge_morain/dupont_enge_morain_tests.py b/ecfactory/dupont_enge_morain/dupont_enge_morain_tests.py index b541695..d262e6b 100644 --- a/ecfactory/dupont_enge_morain/dupont_enge_morain_tests.py +++ b/ecfactory/dupont_enge_morain/dupont_enge_morain_tests.py @@ -1,4 +1,4 @@ -from sage.all import randint +from sage.misc.prandom import randint import ecfactory.dupont_enge_morain as dem import time import ecfactory.utils as utils diff --git a/ecfactory/ec_chain/ec_chain_tests.py b/ecfactory/ec_chain/ec_chain_tests.py index 25e83d2..7d0aa30 100644 --- a/ecfactory/ec_chain/ec_chain_tests.py +++ b/ecfactory/ec_chain/ec_chain_tests.py @@ -1,4 +1,6 @@ -from sage.all import randint, random_prime, is_prime +from sage.misc.prandom import randint +from sage.arith.misc import random_prime +from sage.arith.misc import is_prime import ecfactory.ec_chain as ec import time diff --git a/ecfactory/mnt_curves/mnt_curves.py b/ecfactory/mnt_curves/mnt_curves.py index ba1b51a..1c555cb 100644 --- a/ecfactory/mnt_curves/mnt_curves.py +++ b/ecfactory/mnt_curves/mnt_curves.py @@ -1,4 +1,12 @@ -from sage.all import QuadraticField, is_prime, kronecker, fundamental_discriminant, log, sqrt, is_square, power_mod, Integer +from sage.rings.number_field.number_field import QuadraticField +from sage.arith.misc import is_prime +from sage.arith.misc import kronecker +from sage.arith.misc import fundamental_discriminant +from sage.misc.functional import log +from sage.misc.functional import sqrt +from sage.arith.misc import is_square +from sage.arith.misc import power_mod +from sage.rings.integer import Integer import time from ecfactory.pell_equation_solver import pell_solve from ecfactory.utils import is_valid_curve diff --git a/ecfactory/pell_equation_solver/pell_equation_solver.py b/ecfactory/pell_equation_solver/pell_equation_solver.py index 5cf2290..543601a 100644 --- a/ecfactory/pell_equation_solver/pell_equation_solver.py +++ b/ecfactory/pell_equation_solver/pell_equation_solver.py @@ -1,4 +1,8 @@ -from sage.all import is_square, sqrt, Integer, floor, ceil +from sage.arith.misc import is_square +from sage.misc.functional import sqrt +from sage.rings.integer import Integer +from sage.functions.other import floor +from sage.functions.other import ceil def pell_solve(D, m): """ diff --git a/ecfactory/utils/utils.py b/ecfactory/utils/utils.py index 85f077f..5268dc0 100644 --- a/ecfactory/utils/utils.py +++ b/ecfactory/utils/utils.py @@ -1,7 +1,12 @@ import time -from sage.all import is_prime, is_square, power_mod, fundamental_discriminant, log, floor - -def is_valid_curve(q,t,r,k,D): +from sage.arith.misc import is_prime +from sage.arith.misc import is_square +from sage.arith.misc import power_mod +from sage.arith.misc import fundamental_discriminant +from sage.misc.functional import log +from sage.functions.other import floor + +def is_valid_curve(q,t,r,k,D): """ Description: diff --git a/pyproject.toml b/pyproject.toml index b0ea353..023a103 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,12 @@ readme = "readme.md" [tool.poetry.dependencies] python = "^3.7" +passagemath-schemes = { version = "^10.4", optional = true } +passagemath-symbolics = { version = "^10.4", optional = true } +passagemath-repl = { version = "^10.4", optional = true } + +[tool.poetry.extras] +passagemath = ["passagemath-schemes", "passagemath-symbolics", "passagemath-repl"] [build-system] requires = ["poetry-core"] diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..2d4e0f8 --- /dev/null +++ b/tox.ini @@ -0,0 +1,28 @@ +[tox] +envlist = passagemath + +[testenv:.pkg] +passenv = + CPATH + LIBRARY_PATH + +[testenv:passagemath] +usedevelop = True +extras = passagemath + +passenv = + CPATH + LIBRARY_PATH + +setenv = + # For access to _doctest_environment.py + PYTHONPATH=. + +commands = + python -c 'import sage.all__sagemath_schemes; import ecfactory' + python -c 'import sage.all__sagemath_schemes; import ecfactory.ec_chain.ec_chain_tests' + python -c 'import sage.all__sagemath_schemes; import ecfactory.pell_equation_solver.pell_equation_solver_test' + python -c 'import sage.all__sagemath_schemes; import ecfactory.complex_multiplication.complex_multiplication_tests' + python -c 'import sage.all__sagemath_schemes; import ecfactory.dupont_enge_morain.dupont_enge_morain_tests' + python -c 'import sage.all__sagemath_schemes; import ecfactory.cocks_pinch.cocks_pinch_tests' + python -c 'import sage.all__sagemath_schemes; import ecfactory.bn_curves.bn_curves_tests'