diff --git a/experimental/IntersectionTheory/src/IntersectionTheory.jl b/experimental/IntersectionTheory/src/IntersectionTheory.jl index 90ad636d4a0b..9678e3829289 100644 --- a/experimental/IntersectionTheory/src/IntersectionTheory.jl +++ b/experimental/IntersectionTheory/src/IntersectionTheory.jl @@ -16,7 +16,6 @@ export abstract_projective_variety export abstract_variety export abstract_variety export betti -export bundle export bundles export canonical_bundle export canonical_class @@ -34,7 +33,6 @@ export graph export intersection_matrix export l_genus export line_bundle -export pontryagin export pontryagin_class export schubert_class export schubert_classes diff --git a/experimental/Schemes/CoherentSheaves.jl b/experimental/Schemes/CoherentSheaves.jl index fa65489d11d7..c62b569c15d2 100644 --- a/experimental/Schemes/CoherentSheaves.jl +++ b/experimental/Schemes/CoherentSheaves.jl @@ -1,6 +1,4 @@ -export CoherentSheaf export DirectSumSheaf -export LineBundle export PullbackSheaf export PushforwardSheaf export cotangent_sheaf diff --git a/experimental/Schemes/CoveredProjectiveSchemes.jl b/experimental/Schemes/CoveredProjectiveSchemes.jl index 91d2f7ce32f9..4e5dd8e3b0d1 100644 --- a/experimental/Schemes/CoveredProjectiveSchemes.jl +++ b/experimental/Schemes/CoveredProjectiveSchemes.jl @@ -1,8 +1,5 @@ export CoveredProjectiveScheme export ProjectiveGlueing -export _non_degeneration_cover -export as_smooth_lci_of_cod -export as_smooth_local_complete_intersection export base_covering export base_glueing export base_scheme @@ -11,10 +8,8 @@ export controlled_transform export covered_scheme export empty_covered_projective_scheme export glueing_type -export prepare_smooth_center export projective_patches export strict_transform -export total_transform export weak_transform abstract type AbsProjectiveGlueing{ diff --git a/experimental/Schemes/IdealSheaves.jl b/experimental/Schemes/IdealSheaves.jl index 88c0d3273b61..dbcd8028ac95 100644 --- a/experimental/Schemes/IdealSheaves.jl +++ b/experimental/Schemes/IdealSheaves.jl @@ -1,10 +1,6 @@ export IdealSheaf -export covered_patches -export covering export extend! -export ideal_dict export ideal_sheaf -export ideal_sheaf_type export order_on_divisor export scheme export subscheme diff --git a/experimental/Schemes/Sheaves.jl b/experimental/Schemes/Sheaves.jl index 56344790fd06..05a3768588ca 100644 --- a/experimental/Schemes/Sheaves.jl +++ b/experimental/Schemes/Sheaves.jl @@ -1,4 +1,3 @@ -export AbsPrePreSheaf export PreSheafOnScheme export StructureSheafOfRings export restriction_map diff --git a/experimental/Schemes/WeilDivisor.jl b/experimental/Schemes/WeilDivisor.jl index b85f0288fe38..0e0b88660812 100644 --- a/experimental/Schemes/WeilDivisor.jl +++ b/experimental/Schemes/WeilDivisor.jl @@ -6,7 +6,6 @@ export coefficient_ring_type export coefficient_type export components export divisor -export ideal_sheaf_type export in_linear_system export linear_system export scheme diff --git a/experimental/SymmetricIntersections/HomogeneousPolynomialsActions.jl b/experimental/SymmetricIntersections/HomogeneousPolynomialsActions.jl index 8b08aec5fbb8..b27b561c51eb 100644 --- a/experimental/SymmetricIntersections/HomogeneousPolynomialsActions.jl +++ b/experimental/SymmetricIntersections/HomogeneousPolynomialsActions.jl @@ -2,7 +2,6 @@ export is_invariant_ideal export is_semi_invariant_polynomial export projective_group_action export pullback -export push_forward export symmetric_intersections export underlying_moduli_space_of_modules diff --git a/src/AlgebraicGeometry/AlgebraicGeometry.jl b/src/AlgebraicGeometry/AlgebraicGeometry.jl new file mode 100644 index 000000000000..71f7f7e20eeb --- /dev/null +++ b/src/AlgebraicGeometry/AlgebraicGeometry.jl @@ -0,0 +1,7 @@ +include("Schemes/main.jl") +include("ToricVarieties/JToric.jl") +include("TropicalGeometry/main.jl") +include("Surfaces/K3Auto.jl") +include("Surfaces/SurfacesP4.jl") +include("Miscellaneous/basics.jl") + diff --git a/src/GAP/GAP.jl b/src/GAP/GAP.jl new file mode 100644 index 000000000000..fe160ac8330d --- /dev/null +++ b/src/GAP/GAP.jl @@ -0,0 +1,7 @@ +include("wrappers.jl") +include("customize.jl") +include("gap_to_oscar.jl") +include("oscar_to_gap.jl") +include("iso_gap_oscar.jl") +include("iso_oscar_gap.jl") + diff --git a/src/Groups/Groups.jl b/src/Groups/Groups.jl new file mode 100644 index 000000000000..0a56cfe01109 --- /dev/null +++ b/src/Groups/Groups.jl @@ -0,0 +1,18 @@ +include("types.jl") +include("perm.jl") +include("group_constructors.jl") +include("sub.jl") +include("homomorphisms.jl") +include("cosets.jl") +include("GAPGroups.jl") +include("pcgroup.jl") +include("directproducts.jl") +include("matrices/matrices.jl") +include("matrices/FiniteFormOrthogonalGroup.jl") +include("libraries/libraries.jl") +include("gsets.jl") +include("MatrixDisplay.jl") +include("abelian_aut.jl") +include("spinor_norms.jl") +include("GrpAb.jl") + diff --git a/src/Modules/Modules.jl b/src/Modules/Modules.jl new file mode 100644 index 000000000000..36d2eef8f135 --- /dev/null +++ b/src/Modules/Modules.jl @@ -0,0 +1,10 @@ +include("ModuleTypes.jl") +include("UngradedModules.jl") +include("homological-algebra.jl") +include("FreeModElem-orderings.jl") +# include("FreeModules-graded.jl") +include("ModulesGraded.jl") +include("module-localizations.jl") +include("local_rings.jl") +include("mpolyquo.jl") + diff --git a/src/Oscar.jl b/src/Oscar.jl index a2261011fbd9..724648964217 100644 --- a/src/Oscar.jl +++ b/src/Oscar.jl @@ -70,94 +70,7 @@ end # force trigger recompile when folder changes include_dependency("../experimental") - -# When a specific branch is loaded via `]add Package#branch` julia will only -# create a checkout and keep a bare git repo in a separate directory. -# In a bare repo HEAD will not point to the correct commit so we use the git -# tree-hash that Pkg.jl provides and manually map this to a corresponding -# commit. -function _lookup_commit_from_cache(url::AbstractString, tree::AbstractString) - if Sys.which("git") != nothing - try - path = Pkg.Types.add_repo_cache_path(url) - if isdir(path) - commit = readchomp(`sh -c "git -C $path log --oneline --all --pretty='tree %T;%H' | grep \"^tree $tree\" | cut -d\; -f2 | head -n1"`) - return readchomp(`git -C $path show -s --format=", %h -- %ci" $commit`) - end - catch - end - end - return "" -end - -function _lookup_git_branch(dir::AbstractString; commit=false) - info = "" - if Sys.which("git") != nothing && - isdir(joinpath(dir,".git")) - try - ref = readchomp(`git -C $dir rev-parse --abbrev-ref HEAD`) - info = " - #$(ref)" - if commit - c = readchomp(`git -C $dir show -s --format="%h -- %ci" HEAD`) - info = "$info, $c" - end - catch - end - end - return info -end - -function _deps_git_info(dep::Pkg.API.PackageInfo; commit=false) - if dep.is_tracking_repo - info = commit ? _lookup_commit_from_cache(dep.git_source, dep.tree_hash) : "" - return " - #$(dep.git_revision)$info" - elseif dep.is_tracking_path - return _lookup_git_branch(dep.source; commit=commit) - end - return "" -end - -function _print_dependency_versions(io::IO, deps::AbstractArray{<:AbstractString}; padding=" ", suffix="", branch=false, commit=false) - width = maximum(length.(deps))+length(suffix)+2 - deps = filter(d->d.name in deps, collect(values(Pkg.dependencies()))) - deps = sort!(deps; by=x->x.name) - for dep in deps - print(io, "$(padding)$(rpad(dep.name*suffix, width, ' ')) v$(dep.version)") - println(io, branch ? _deps_git_info(dep; commit=commit) : "") - end -end - -@doc raw""" - Oscar.versioninfo(io::IO=stdout; branch=false, jll=false, julia=false, commit=false, full=false) - -Print the versions of all Oscar-related dependencies. - -# Arguments -- `branch::Bool=false`: include git branch name in the output -- `commit::Bool=false`: include git commit hash and date where applicable -- `jll::Bool=false` : include binary packages (jll) in the output -- `julia::Bool=false` : include julia `versioninfo` output -- `full::Bool=false` : include all of the above -""" -function versioninfo(io::IO=stdout; branch=false, jll=false, julia=false, commit=false, full=false) - if full - branch = jll = julia = commit = true - end - print(io, "OSCAR version $(VERSION_NUMBER)") - println(io, branch ? _lookup_git_branch(dirname(@__DIR__); commit=commit) : "") - println(io, " combining:") - _print_dependency_versions(io, cornerstones; suffix=".jl", branch=branch, commit=commit) - if jll - println(io, " building on:") - _print_dependency_versions(io, jll_deps; branch=branch, commit=commit) - println(io, "See `]st -m` for a full list of dependencies.") - end - if julia - println(io, "") - Main.InteractiveUtils.versioninfo(io) - println(io, Base.TAGGED_RELEASE_BANNER) - end -end +include("utils.jl") # More helpful error message for users on Windows. windows_error() = error(""" @@ -292,99 +205,6 @@ function example(s::String) Base.include(Main, joinpath(oscardir, "examples", s)) end -# use tempdir by default to ensure a clean manifest (and avoid modifying the project) -function doc_init(;path=mktempdir()) - global docsproject = path - if !isfile(joinpath(docsproject,"Project.toml")) - cp(joinpath(oscardir, "docs", "Project.toml"), joinpath(docsproject,"Project.toml")) - end - Pkg.activate(docsproject) do - # we dev all packages with the paths from where they are currently loaded - for dir in [aadir, nemodir, heckedir, oscardir] - Pkg.develop(path=dir) - end - Pkg.instantiate() - Base.include(Main, joinpath(oscardir, "docs", "make_work.jl")) - end -end - -#function doc_update_deps() -# Pkg.activate(Pkg.update, joinpath(oscardir, "docs")) -#end - -function open_doc() - filename = normpath(Oscar.oscardir, "docs", "build", "index.html") - @static if Sys.isapple() - run(`open $(filename)`; wait = false) - elseif Sys.islinux() || Sys.isbsd() - run(`xdg-open $(filename)`; wait = false) - elseif Sys.iswindows() - cmd = get(ENV, "COMSPEC", "cmd.exe") - run(`$(cmd) /c start $(filename)`; wait = false) - else - @warn("Opening files the default application is not supported on this OS.", - KERNEL = Sys.KERNEL) - end -end - - -@doc raw""" - build_doc(; doctest=false, strict=false, open_browser=true) - -Build the manual of `Oscar.jl` locally and open the front page in a -browser. - -The optional parameter `doctest` can take three values: - - `false`: Do not run the doctests (default). - - `true`: Run the doctests and report errors. - - `:fix`: Run the doctests and replace the output in the manual with - the output produced by Oscar. Please use this option carefully. - -In GitHub Actions the Julia version used for building the manual is 1.8 and -doctests are run with >= 1.7. Using a different Julia version may produce -errors in some parts of Oscar, so please be careful, especially when setting -`doctest=:fix`. - -The optional parameter `strict` is passed on to `makedocs` of `Documenter.jl` -and if set to `true` then according to the manual of `Documenter.jl` "a -doctesting error will always make makedocs throw an error in this mode". - -To prevent the opening of the browser at the end, set the optional parameter -`open_browser` to `false`. - -When working on the manual the `Revise` package can significantly sped -up running `build_doc`. First, install `Revise` in the following way: -``` -using Pkg ; Pkg.add("Revise") -``` -Second, restart Julia and load `Revise` before Oscar: -``` -using Revise, Oscar; -``` -The first run of `build_doc` will take the usual few minutes, subsequently runs -will be significantly faster. -""" -function build_doc(; doctest=false, strict=false, open_browser=true) - versioncheck = (VERSION.major == 1) && (VERSION.minor >= 7) - versionwarn = -"The Julia reference version for the doctests is 1.7 or later, but you are using -$(VERSION). Running the doctests will produce errors that you do not expect." - if doctest != false && !versioncheck - @warn versionwarn - end - if !isdefined(Main, :BuildDoc) - doc_init() - end - Pkg.activate(docsproject) do - Base.invokelatest(Main.BuildDoc.doit, Oscar; strict=strict, local_build=true, doctest=doctest) - end - if open_browser - open_doc() - end - if doctest != false && !versioncheck - @warn versionwarn - end -end # This can be used in # @@ -416,50 +236,6 @@ function build() end -@doc raw""" - test_module(file::AbstractString; new::Bool = true) - -Run the Oscar tests in the file `test/.jl` where `file` may be a path. - -The optional parameter `new` takes the values `false` and `true` (default). If -`true`, then the tests are run in a new session, otherwise the currently active -session is used. - -For experimental modules, use [`test_experimental_module`](@ref) instead. -""" -function test_module(file::AbstractString; new::Bool=true) - julia_exe = Base.julia_cmd() - rel_test_file = normpath("test", "$file.jl") - test_file = joinpath(oscardir, rel_test_file) - - if new - cmd = "using Test; using Oscar; Hecke.assertions(true); include(\"$test_file\");" - @info("spawning ", `$julia_exe -e \"$cmd\"`) - run(`$julia_exe -e $cmd`) - else - @req isdefined(Base.Main, :Test) "You need to do \"using Test\"" - @info("Running tests for $rel_test_file in same session") - Base.include(Base.Main, test_file) - end -end - -@doc raw""" - test_experimental_module(project::AbstractString; file::AbstractString="runtests", new::Bool = true) - -Run the Oscar tests in the file `experimental//test/.jl` -where `file` may be a path. -The default is to run the entire test suite of the module `project`. - -The optional parameter `new` takes the values `false` and `true` (default). If -`true`, then the tests are run in a new session, otherwise the currently active -session is used. -""" -function test_experimental_module( - project::AbstractString; file::AbstractString="runtests", new::Bool=true -) - test_file = "../experimental/$project/test/$file" - test_module(test_file; new) -end include("exports.jl") @@ -470,82 +246,19 @@ include("exports.jl") include("printing.jl") include("fallbacks.jl") -include("GAP/wrappers.jl") - -include("Groups/types.jl") -include("Groups/perm.jl") -include("Groups/group_constructors.jl") -include("Groups/sub.jl") -include("Groups/homomorphisms.jl") -include("Groups/cosets.jl") -include("Groups/GAPGroups.jl") -include("Groups/pcgroup.jl") -include("Groups/directproducts.jl") -include("Groups/matrices/matrices.jl") -include("Groups/matrices/FiniteFormOrthogonalGroup.jl") -include("Groups/libraries/libraries.jl") -include("Groups/gsets.jl") -include("Groups/MatrixDisplay.jl") -include("Groups/abelian_aut.jl") -include("Groups/spinor_norms.jl") -include("Groups/GrpAb.jl") - -include("Rings/integer.jl") -include("Rings/orderings.jl") -include("Rings/mpoly.jl") -include("Rings/mpoly_types.jl") -include("Rings/mpoly-graded.jl") -include("Rings/mpoly-ideals.jl") -include("Rings/groebner.jl") -include("Rings/solving.jl") -include("Rings/MPolyQuo.jl") -include("Rings/mpoly-nested.jl") -include("Rings/FractionalIdeal.jl") - -include("Rings/mpoly-affine-algebras.jl") - -include("Rings/special_ideals.jl") - -include("Rings/MPolyMap/MPolyAnyMap.jl") -include("Rings/MPolyMap/MPolyRing.jl") -include("Rings/MPolyMap/MPolyQuo.jl") -include("Rings/MPolyMap/AffineAlgebras.jl") - -include("Rings/mpoly-local.jl") -include("Rings/localization_interface.jl") -include("Rings/mpoly-localizations.jl") -include("Rings/mpolyquo-localizations.jl") -include("Rings/MPolyMap/flattenings.jl") -include("Rings/FinField.jl") -include("Rings/NumberField.jl") -include("Rings/FunctionField.jl") -include("Rings/AbelianClosure.jl") - -include("Rings/PBWAlgebra.jl") -include("Rings/PBWAlgebraQuo.jl") -include("Rings/FreeAssAlgIdeal.jl") - - -include("GAP/customize.jl") -include("GAP/gap_to_oscar.jl") -include("GAP/oscar_to_gap.jl") -include("GAP/iso_gap_oscar.jl") -include("GAP/iso_oscar_gap.jl") + +include("Groups/Groups.jl") + +include("Rings/Rings.jl") +include("GAP/GAP.jl") + include("../gap/OscarInterface/julia/alnuth.jl") include("Groups/group_characters.jl") # needs some Rings functionality include("Groups/action.jl") # needs some PolynomialRings functionality -include("Modules/ModuleTypes.jl") -include("Modules/UngradedModules.jl") -include("Modules/homological-algebra.jl") -include("Modules/FreeModElem-orderings.jl") -#include("Modules/FreeModules-graded.jl") -include("Modules/ModulesGraded.jl") -include("Modules/module-localizations.jl") -include("Modules/local_rings.jl") -include("Modules/mpolyquo.jl") -include("Rings/ReesAlgebra.jl") +include("Modules/Modules.jl") +include("Rings/ReesAlgebra.jl") # Needs ModuleFP include("NumberTheory/NmbThy.jl") @@ -559,20 +272,16 @@ include("Combinatorics/Matroids/JMatroids.jl") include("Combinatorics/Matroids/matroid_strata_grassmannian.jl") include("StraightLinePrograms/StraightLinePrograms.jl") -include("Rings/lazypolys.jl") -include("Rings/slpolys.jl") +include("Rings/lazypolys.jl") # uses StraightLinePrograms +include("Rings/slpolys.jl") # uses StraightLinePrograms include("NumberTheory/GalThy.jl") -include("AlgebraicGeometry/Schemes/main.jl") -include("AlgebraicGeometry/ToricVarieties/JToric.jl") -include("AlgebraicGeometry/TropicalGeometry/main.jl") -include("AlgebraicGeometry/Surfaces/K3Auto.jl") -include("AlgebraicGeometry/Surfaces/SurfacesP4.jl") -include("AlgebraicGeometry/Miscellaneous/basics.jl") +include("AlgebraicGeometry/AlgebraicGeometry.jl") include("InvariantTheory/InvariantTheory.jl") include("../experimental/Experimental.jl") + include("Rings/binomial_ideals.jl") # uses QQAbModule from experimental/Rings/QQAbAndPChars.jl if is_dev diff --git a/src/Rings/FinField.jl b/src/Rings/FinField.jl index e464ef8214bf..e9b15837b53f 100644 --- a/src/Rings/FinField.jl +++ b/src/Rings/FinField.jl @@ -65,9 +65,7 @@ function disc_log(a::T) where {T <: FinFieldElem} end export disc_log -export generator end # module DiscLog export disc_log -export generator diff --git a/src/Rings/Rings.jl b/src/Rings/Rings.jl new file mode 100644 index 000000000000..11a300c7512b --- /dev/null +++ b/src/Rings/Rings.jl @@ -0,0 +1,35 @@ +include("integer.jl") +include("orderings.jl") +include("mpoly.jl") +include("mpoly_types.jl") +include("mpoly-graded.jl") +include("mpoly-ideals.jl") +include("groebner.jl") +include("solving.jl") +include("MPolyQuo.jl") +include("mpoly-nested.jl") +include("FractionalIdeal.jl") + +include("mpoly-affine-algebras.jl") + +include("special_ideals.jl") + +include("MPolyMap/MPolyAnyMap.jl") +include("MPolyMap/MPolyRing.jl") +include("MPolyMap/MPolyQuo.jl") +include("MPolyMap/AffineAlgebras.jl") + +include("mpoly-local.jl") +include("localization_interface.jl") +include("mpoly-localizations.jl") +include("mpolyquo-localizations.jl") +include("MPolyMap/flattenings.jl") +include("FinField.jl") +include("NumberField.jl") +include("FunctionField.jl") +include("AbelianClosure.jl") + +include("PBWAlgebra.jl") +include("PBWAlgebraQuo.jl") +include("FreeAssAlgIdeal.jl") + diff --git a/src/exports.jl b/src/exports.jl index a9b87ecb19ac..16dd0785b8ad 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -46,7 +46,6 @@ export Covering export CoveringMorphism export CyclicQuotientSingularity export DirectProductGroup -export DirectProductOfElem export Directed export DivisorOnTropicalCurve export Edge @@ -204,7 +203,6 @@ export affine_inequality_matrix export affine_normal_toric_variety export affine_open_covering export affine_patch -export affine_patch_type export affine_patches export affine_space export alexander_dual @@ -222,7 +220,6 @@ export all_triangulations export allow_unicode export alternating_form export alternating_group -export ambient export ambient_coordinate_ring export ambient_coordinates export ambient_dim @@ -257,7 +254,6 @@ export base_ring_elem_type export base_ring_module export base_ring_type export base_scheme -export base_scheme_type export bases export basic_patches export basis_of_global_sections @@ -344,7 +340,7 @@ export comm! export common_denominator export common_refinement export complement -export complement_class_reps, has_complement_class_reps, set_complement_class_reps +export complement_class_reps export complement_equation export complement_equations export complement_ideal @@ -386,7 +382,6 @@ export corank export core export corresponding_bilinear_form export corresponding_quadratic_form -export coset_decomposition export covered_projection_to_base export covered_scheme export covered_scheme_morphism @@ -462,7 +457,6 @@ export dual_continued_fraction_hirzebruch_jung export dual_matroid export dual_subdivision export dualgraph -export dualsubdivision export edgegraph export edges export ehrhart_polynomial @@ -603,7 +597,6 @@ export hom export hom_product export hom_tensor export hom_without_reversing_direction -export homogeneity_space export homogeneous_component export homogeneous_components export homogeneous_coordinates @@ -653,7 +646,6 @@ export integral_basis export integrate export interior_lattice_points export intersect -export intersect_stably export intersection_form export intersections export inv @@ -876,7 +868,6 @@ export link_subcomplex export load export load_lp export load_mps -export load_simplicialcomplex export localized_ring export loops export low_index_subgroup_reps @@ -998,7 +989,6 @@ export normal_toric_variety export normal_vector export normalization export normalization_with_delta -export normalize export normalize! export normalized_volume export normalizer @@ -1062,7 +1052,6 @@ export permutation_matrix export permutation_of_terms export permuted export picard_group -export pivots export platonic_solid export point_coordinates export point_matrix @@ -1198,7 +1187,6 @@ export saturation_with_index export save export save_lp export save_mps -export save_simplicialcomplex export scalar_product export scheme export schur_index @@ -1214,7 +1202,6 @@ export set_commutator! export set_conjugate! export set_coordinate_names export set_coordinate_names_of_torus -export set_degrees export set_grading export set_name! export set_power! @@ -1241,7 +1228,6 @@ export singular_coeff_ring export singular_locus export singular_locus_reduced export singular_poly_ring -export slope export slpoly_ring export small_generating_set export small_generating_set, has_small_generating_set, set_small_generating_set @@ -1322,7 +1308,6 @@ export trivial_divisor export trivial_divisor_class export trivial_morphism export trivial_subgroup, has_trivial_subgroup, set_trivial_subgroup -export tropical_link export tropical_points export tropical_polynomial export tropical_variety diff --git a/src/utils.jl b/src/utils.jl new file mode 100644 index 000000000000..6bb467b41e52 --- /dev/null +++ b/src/utils.jl @@ -0,0 +1,248 @@ +############################################################################### +############################################################################### +## +## versioninfo +## +############################################################################### +############################################################################### +# When a specific branch is loaded via `]add Package#branch` julia will only +# create a checkout and keep a bare git repo in a separate directory. +# In a bare repo HEAD will not point to the correct commit so we use the git +# tree-hash that Pkg.jl provides and manually map this to a corresponding +# commit. +function _lookup_commit_from_cache(url::AbstractString, tree::AbstractString) + if Sys.which("git") != nothing + try + path = Pkg.Types.add_repo_cache_path(url) + if isdir(path) + commit = readchomp(`sh -c "git -C $path log --oneline --all --pretty='tree %T;%H' | grep \"^tree $tree\" | cut -d\; -f2 | head -n1"`) + return readchomp(`git -C $path show -s --format=", %h -- %ci" $commit`) + end + catch + end + end + return "" +end + +function _lookup_git_branch(dir::AbstractString; commit=false) + info = "" + if Sys.which("git") != nothing && + isdir(joinpath(dir,".git")) + try + ref = readchomp(`git -C $dir rev-parse --abbrev-ref HEAD`) + info = " - #$(ref)" + if commit + c = readchomp(`git -C $dir show -s --format="%h -- %ci" HEAD`) + info = "$info, $c" + end + catch + end + end + return info +end + +function _deps_git_info(dep::Pkg.API.PackageInfo; commit=false) + if dep.is_tracking_repo + info = commit ? _lookup_commit_from_cache(dep.git_source, dep.tree_hash) : "" + return " - #$(dep.git_revision)$info" + elseif dep.is_tracking_path + return _lookup_git_branch(dep.source; commit=commit) + end + return "" +end + +function _print_dependency_versions(io::IO, deps::AbstractArray{<:AbstractString}; padding=" ", suffix="", branch=false, commit=false) + width = maximum(length.(deps))+length(suffix)+2 + deps = filter(d->d.name in deps, collect(values(Pkg.dependencies()))) + deps = sort!(deps; by=x->x.name) + for dep in deps + print(io, "$(padding)$(rpad(dep.name*suffix, width, ' ')) v$(dep.version)") + println(io, branch ? _deps_git_info(dep; commit=commit) : "") + end +end + +@doc raw""" + Oscar.versioninfo(io::IO=stdout; branch=false, jll=false, julia=false, commit=false, full=false) + +Print the versions of all Oscar-related dependencies. + +# Arguments +- `branch::Bool=false`: include git branch name in the output +- `commit::Bool=false`: include git commit hash and date where applicable +- `jll::Bool=false` : include binary packages (jll) in the output +- `julia::Bool=false` : include julia `versioninfo` output +- `full::Bool=false` : include all of the above +""" +function versioninfo(io::IO=stdout; branch=false, jll=false, julia=false, commit=false, full=false) + if full + branch = jll = julia = commit = true + end + print(io, "OSCAR version $(VERSION_NUMBER)") + println(io, branch ? _lookup_git_branch(dirname(@__DIR__); commit=commit) : "") + println(io, " combining:") + _print_dependency_versions(io, cornerstones; suffix=".jl", branch=branch, commit=commit) + if jll + println(io, " building on:") + _print_dependency_versions(io, jll_deps; branch=branch, commit=commit) + println(io, "See `]st -m` for a full list of dependencies.") + end + if julia + println(io, "") + Main.InteractiveUtils.versioninfo(io) + println(io, Base.TAGGED_RELEASE_BANNER) + end +end + +############################################################################### +############################################################################### +## +## Documentation helpers +## +############################################################################### +############################################################################### + +# use tempdir by default to ensure a clean manifest (and avoid modifying the project) +function doc_init(;path=mktempdir()) + global docsproject = path + if !isfile(joinpath(docsproject,"Project.toml")) + cp(joinpath(oscardir, "docs", "Project.toml"), joinpath(docsproject,"Project.toml")) + end + Pkg.activate(docsproject) do + # we dev all packages with the paths from where they are currently loaded + for dir in [aadir, nemodir, heckedir, oscardir] + Pkg.develop(path=dir) + end + Pkg.instantiate() + Base.include(Main, joinpath(oscardir, "docs", "make_work.jl")) + end +end + +#function doc_update_deps() +# Pkg.activate(Pkg.update, joinpath(oscardir, "docs")) +#end + +function open_doc() + filename = normpath(Oscar.oscardir, "docs", "build", "index.html") + @static if Sys.isapple() + run(`open $(filename)`; wait = false) + elseif Sys.islinux() || Sys.isbsd() + run(`xdg-open $(filename)`; wait = false) + elseif Sys.iswindows() + cmd = get(ENV, "COMSPEC", "cmd.exe") + run(`$(cmd) /c start $(filename)`; wait = false) + else + @warn("Opening files the default application is not supported on this OS.", + KERNEL = Sys.KERNEL) + end +end + + +@doc raw""" + build_doc(; doctest=false, strict=false, open_browser=true) + +Build the manual of `Oscar.jl` locally and open the front page in a +browser. + +The optional parameter `doctest` can take three values: + - `false`: Do not run the doctests (default). + - `true`: Run the doctests and report errors. + - `:fix`: Run the doctests and replace the output in the manual with + the output produced by Oscar. Please use this option carefully. + +In GitHub Actions the Julia version used for building the manual is 1.8 and +doctests are run with >= 1.7. Using a different Julia version may produce +errors in some parts of Oscar, so please be careful, especially when setting +`doctest=:fix`. + +The optional parameter `strict` is passed on to `makedocs` of `Documenter.jl` +and if set to `true` then according to the manual of `Documenter.jl` "a +doctesting error will always make makedocs throw an error in this mode". + +To prevent the opening of the browser at the end, set the optional parameter +`open_browser` to `false`. + +When working on the manual the `Revise` package can significantly sped +up running `build_doc`. First, install `Revise` in the following way: +``` +using Pkg ; Pkg.add("Revise") +``` +Second, restart Julia and load `Revise` before Oscar: +``` +using Revise, Oscar; +``` +The first run of `build_doc` will take the usual few minutes, subsequently runs +will be significantly faster. +""" +function build_doc(; doctest=false, strict=false, open_browser=true) + versioncheck = (VERSION.major == 1) && (VERSION.minor >= 7) + versionwarn = +"The Julia reference version for the doctests is 1.7 or later, but you are using +$(VERSION). Running the doctests will produce errors that you do not expect." + if doctest != false && !versioncheck + @warn versionwarn + end + if !isdefined(Main, :BuildDoc) + doc_init() + end + Pkg.activate(docsproject) do + Base.invokelatest(Main.BuildDoc.doit, Oscar; strict=strict, local_build=true, doctest=doctest) + end + if open_browser + open_doc() + end + if doctest != false && !versioncheck + @warn versionwarn + end +end + +############################################################################### +############################################################################### +## +## Testsuite helpers +## +############################################################################### +############################################################################### +@doc raw""" + test_module(file::AbstractString; new::Bool = true) + +Run the Oscar tests in the file `test/.jl` where `file` may be a path. + +The optional parameter `new` takes the values `false` and `true` (default). If +`true`, then the tests are run in a new session, otherwise the currently active +session is used. + +For experimental modules, use [`test_experimental_module`](@ref) instead. +""" +function test_module(file::AbstractString; new::Bool=true) + julia_exe = Base.julia_cmd() + rel_test_file = normpath("test", "$file.jl") + test_file = joinpath(oscardir, rel_test_file) + + if new + cmd = "using Test; using Oscar; Hecke.assertions(true); include(\"$test_file\");" + @info("spawning ", `$julia_exe -e \"$cmd\"`) + run(`$julia_exe -e $cmd`) + else + @req isdefined(Base.Main, :Test) "You need to do \"using Test\"" + @info("Running tests for $rel_test_file in same session") + Base.include(Base.Main, test_file) + end +end + +@doc raw""" + test_experimental_module(project::AbstractString; file::AbstractString="runtests", new::Bool = true) + +Run the Oscar tests in the file `experimental//test/.jl` +where `file` may be a path. +The default is to run the entire test suite of the module `project`. + +The optional parameter `new` takes the values `false` and `true` (default). If +`true`, then the tests are run in a new session, otherwise the currently active +session is used. +""" +function test_experimental_module( + project::AbstractString; file::AbstractString="runtests", new::Bool=true +) + test_file = "../experimental/$project/test/$file" + test_module(test_file; new) +end diff --git a/test/Experimental/ExteriorAlgebra-test.jl b/test/Experimental/ExteriorAlgebra.jl similarity index 100% rename from test/Experimental/ExteriorAlgebra-test.jl rename to test/Experimental/ExteriorAlgebra.jl diff --git a/test/Experimental/GITFans-test.jl b/test/Experimental/GITFans.jl similarity index 100% rename from test/Experimental/GITFans-test.jl rename to test/Experimental/GITFans.jl diff --git a/test/Experimental/JuLie-test.jl b/test/Experimental/JuLie.jl similarity index 100% rename from test/Experimental/JuLie-test.jl rename to test/Experimental/JuLie.jl diff --git a/test/Experimental/MPolyRingSparse-test.jl b/test/Experimental/MPolyRingSparse.jl similarity index 100% rename from test/Experimental/MPolyRingSparse-test.jl rename to test/Experimental/MPolyRingSparse.jl diff --git a/test/Experimental/MatrixGroups-test.jl b/test/Experimental/MatrixGroups.jl similarity index 100% rename from test/Experimental/MatrixGroups-test.jl rename to test/Experimental/MatrixGroups.jl diff --git a/test/Experimental/ModStdNF-test.jl b/test/Experimental/ModStdNF.jl similarity index 100% rename from test/Experimental/ModStdNF-test.jl rename to test/Experimental/ModStdNF.jl diff --git a/test/Experimental/ModStdQt-test.jl b/test/Experimental/ModStdQt.jl similarity index 100% rename from test/Experimental/ModStdQt-test.jl rename to test/Experimental/ModStdQt.jl diff --git a/test/Experimental/SymmetricIntersections-test.jl b/test/Experimental/SymmetricIntersections.jl similarity index 100% rename from test/Experimental/SymmetricIntersections-test.jl rename to test/Experimental/SymmetricIntersections.jl diff --git a/test/Experimental/galois-test.jl b/test/Experimental/galois.jl similarity index 100% rename from test/Experimental/galois-test.jl rename to test/Experimental/galois.jl diff --git a/test/Experimental/gmodule-test.jl b/test/Experimental/gmodule.jl similarity index 100% rename from test/Experimental/gmodule-test.jl rename to test/Experimental/gmodule.jl diff --git a/test/InvariantTheory/affine_algebra-test.jl b/test/InvariantTheory/affine_algebra.jl similarity index 100% rename from test/InvariantTheory/affine_algebra-test.jl rename to test/InvariantTheory/affine_algebra.jl diff --git a/test/InvariantTheory/fundamental_invariants-test.jl b/test/InvariantTheory/fundamental_invariants.jl similarity index 100% rename from test/InvariantTheory/fundamental_invariants-test.jl rename to test/InvariantTheory/fundamental_invariants.jl diff --git a/test/InvariantTheory/invariant_rings-test.jl b/test/InvariantTheory/invariant_rings.jl similarity index 100% rename from test/InvariantTheory/invariant_rings-test.jl rename to test/InvariantTheory/invariant_rings.jl diff --git a/test/InvariantTheory/primary_invariants-test.jl b/test/InvariantTheory/primary_invariants.jl similarity index 100% rename from test/InvariantTheory/primary_invariants-test.jl rename to test/InvariantTheory/primary_invariants.jl diff --git a/test/InvariantTheory/runtests.jl b/test/InvariantTheory/runtests.jl index 2683740f01bb..b320f109c045 100644 --- a/test/InvariantTheory/runtests.jl +++ b/test/InvariantTheory/runtests.jl @@ -1,8 +1,8 @@ using Oscar using Test -include("invariant_rings-test.jl") -include("primary_invariants-test.jl") -include("secondary_invariants-test.jl") -include("fundamental_invariants-test.jl") -include("affine_algebra-test.jl") +include("invariant_rings.jl") +include("primary_invariants.jl") +include("secondary_invariants.jl") +include("fundamental_invariants.jl") +include("affine_algebra.jl") diff --git a/test/InvariantTheory/secondary_invariants-test.jl b/test/InvariantTheory/secondary_invariants.jl similarity index 100% rename from test/InvariantTheory/secondary_invariants-test.jl rename to test/InvariantTheory/secondary_invariants.jl diff --git a/test/Modules/FreeModElem-orderings-test.jl b/test/Modules/FreeModElem-orderings.jl similarity index 100% rename from test/Modules/FreeModElem-orderings-test.jl rename to test/Modules/FreeModElem-orderings.jl diff --git a/test/Modules/FreeModules-graded-test.jl b/test/Modules/FreeModules-graded.jl similarity index 100% rename from test/Modules/FreeModules-graded-test.jl rename to test/Modules/FreeModules-graded.jl diff --git a/test/Modules/homological-algebra_test.jl b/test/Modules/homological-algebra.jl similarity index 100% rename from test/Modules/homological-algebra_test.jl rename to test/Modules/homological-algebra.jl diff --git a/test/Modules/runtests.jl b/test/Modules/runtests.jl index c21bea8bbb4f..3169bee901cf 100644 --- a/test/Modules/runtests.jl +++ b/test/Modules/runtests.jl @@ -2,10 +2,10 @@ using Oscar using Test include("UngradedModules.jl") -include("FreeModElem-orderings-test.jl") +include("FreeModElem-orderings.jl") include("ModulesGraded.jl") include("module-localizations.jl") include("local_rings.jl") include("MPolyQuo.jl") -include("homological-algebra_test.jl") +include("homological-algebra.jl") include("ProjectiveModules.jl") diff --git a/test/NumberTheory/nmbthy-test.jl b/test/NumberTheory/nmbthy.jl similarity index 100% rename from test/NumberTheory/nmbthy-test.jl rename to test/NumberTheory/nmbthy.jl diff --git a/test/Rings/FractionalIdeal-test.jl b/test/Rings/FractionalIdeal.jl similarity index 100% rename from test/Rings/FractionalIdeal-test.jl rename to test/Rings/FractionalIdeal.jl diff --git a/test/Rings/FreeAssAlgIdeal-test.jl b/test/Rings/FreeAssAlgIdeal.jl similarity index 100% rename from test/Rings/FreeAssAlgIdeal-test.jl rename to test/Rings/FreeAssAlgIdeal.jl diff --git a/test/Rings/FunctionField-test.jl b/test/Rings/FunctionField.jl similarity index 100% rename from test/Rings/FunctionField-test.jl rename to test/Rings/FunctionField.jl diff --git a/test/Rings/MPolyQuo_test.jl b/test/Rings/MPolyQuo.jl similarity index 100% rename from test/Rings/MPolyQuo_test.jl rename to test/Rings/MPolyQuo.jl diff --git a/test/Rings/PBWAlgebra-test.jl b/test/Rings/PBWAlgebra.jl similarity index 100% rename from test/Rings/PBWAlgebra-test.jl rename to test/Rings/PBWAlgebra.jl diff --git a/test/Rings/PBWAlgebraQuo-test.jl b/test/Rings/PBWAlgebraQuo.jl similarity index 100% rename from test/Rings/PBWAlgebraQuo-test.jl rename to test/Rings/PBWAlgebraQuo.jl diff --git a/test/Rings/binomial-ideals-test.jl b/test/Rings/binomial-ideals.jl similarity index 100% rename from test/Rings/binomial-ideals-test.jl rename to test/Rings/binomial-ideals.jl diff --git a/test/Rings/groebner-test.jl b/test/Rings/groebner.jl similarity index 100% rename from test/Rings/groebner-test.jl rename to test/Rings/groebner.jl diff --git a/test/Rings/integer-test.jl b/test/Rings/integer.jl similarity index 100% rename from test/Rings/integer-test.jl rename to test/Rings/integer.jl diff --git a/test/Rings/mpoly-graded-test.jl b/test/Rings/mpoly-graded.jl similarity index 100% rename from test/Rings/mpoly-graded-test.jl rename to test/Rings/mpoly-graded.jl diff --git a/test/Rings/mpoly-local-test.jl b/test/Rings/mpoly-local.jl similarity index 100% rename from test/Rings/mpoly-local-test.jl rename to test/Rings/mpoly-local.jl diff --git a/test/Rings/mpoly-nested-test.jl b/test/Rings/mpoly-nested.jl similarity index 100% rename from test/Rings/mpoly-nested-test.jl rename to test/Rings/mpoly-nested.jl diff --git a/test/Rings/mpoly-test.jl b/test/Rings/mpoly.jl similarity index 100% rename from test/Rings/mpoly-test.jl rename to test/Rings/mpoly.jl diff --git a/test/Rings/mpoly_affine_algebras_test.jl b/test/Rings/mpoly_affine_algebras.jl similarity index 100% rename from test/Rings/mpoly_affine_algebras_test.jl rename to test/Rings/mpoly_affine_algebras.jl diff --git a/test/Rings/orderings-test.jl b/test/Rings/orderings.jl similarity index 100% rename from test/Rings/orderings-test.jl rename to test/Rings/orderings.jl diff --git a/test/Rings/rational-test.jl b/test/Rings/rational.jl similarity index 100% rename from test/Rings/rational-test.jl rename to test/Rings/rational.jl diff --git a/test/Rings/runtests.jl b/test/Rings/runtests.jl index fe8e044a1a8f..1cf01fd9a6f9 100644 --- a/test/Rings/runtests.jl +++ b/test/Rings/runtests.jl @@ -1,23 +1,23 @@ -include("integer-test.jl") -include("rational-test.jl") -include("mpoly-test.jl") -include("orderings-test.jl") -include("mpoly-graded-test.jl") -include("mpoly-local-test.jl") +include("integer.jl") +include("rational.jl") +include("mpoly.jl") +include("orderings.jl") +include("mpoly-graded.jl") +include("mpoly-local.jl") include("mpoly-localizations.jl") include("mpolyquo-localizations.jl") include("integer-localizations.jl") include("nmod-localizations.jl") -include("mpoly-nested-test.jl") -include("MPolyQuo_test.jl") -include("groebner-test.jl") -include("solving-test.jl") -include("FractionalIdeal-test.jl") -include("mpoly_affine_algebras_test.jl") -include("slpolys-test.jl") +include("mpoly-nested.jl") +include("MPolyQuo.jl") +include("groebner.jl") +include("solving.jl") +include("FractionalIdeal.jl") +include("mpoly_affine_algebras.jl") +include("slpolys.jl") include("NumberField.jl") -include("FunctionField-test.jl") +include("FunctionField.jl") include("AbelianClosure.jl") include("MPolyAnyMap/MPolyRing.jl") @@ -25,8 +25,8 @@ include("MPolyAnyMap/MPolyQuo.jl") include("MPolyAnyMap/AffineAlgebras.jl") include("MPolyAnyMap/flattenings.jl") -include("PBWAlgebra-test.jl") -include("PBWAlgebraQuo-test.jl") -include("FreeAssAlgIdeal-test.jl") +include("PBWAlgebra.jl") +include("PBWAlgebraQuo.jl") +include("FreeAssAlgIdeal.jl") -include("binomial-ideals-test.jl") +include("binomial-ideals.jl") diff --git a/test/Rings/slpolys-test.jl b/test/Rings/slpolys.jl similarity index 100% rename from test/Rings/slpolys-test.jl rename to test/Rings/slpolys.jl diff --git a/test/Rings/solving-test.jl b/test/Rings/solving.jl similarity index 100% rename from test/Rings/solving-test.jl rename to test/Rings/solving.jl diff --git a/test/runtests.jl b/test/runtests.jl index 4381da1a1b33..1fec575b9e16 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -80,7 +80,7 @@ end @static if compiletimes Base.cumulative_compile_timing(true); end -# Used in both Rings/slpolys-test.jl and StraightLinePrograms/runtests.jl +# Used in both Rings/slpolys.jl and StraightLinePrograms/runtests.jl const SLP = Oscar.StraightLinePrograms include("printing.jl") @@ -92,25 +92,25 @@ include("Groups/runtests.jl") include("Rings/runtests.jl") -include("NumberTheory/nmbthy-test.jl") +include("NumberTheory/nmbthy.jl") if Oscar.is_dev - include("Experimental/GITFans-test.jl") + include("Experimental/GITFans.jl") end # Will automatically include all experimental packages following our # guidelines. include("../experimental/runtests.jl") -include("Experimental/galois-test.jl") -include("Experimental/gmodule-test.jl") -include("Experimental/ModStdQt-test.jl") -include("Experimental/ModStdNF-test.jl") -include("Experimental/MPolyRingSparse-test.jl") -include("Experimental/MatrixGroups-test.jl") -include("Experimental/JuLie-test.jl") -include("Experimental/SymmetricIntersections-test.jl") -include("Experimental/ExteriorAlgebra-test.jl") +include("Experimental/galois.jl") +include("Experimental/gmodule.jl") +include("Experimental/ModStdQt.jl") +include("Experimental/ModStdNF.jl") +include("Experimental/MPolyRingSparse.jl") +include("Experimental/MatrixGroups.jl") +include("Experimental/JuLie.jl") +include("Experimental/SymmetricIntersections.jl") +include("Experimental/ExteriorAlgebra.jl") include("Rings/ReesAlgebra.jl")