Macaulay2 / Macaulay2/M2

Convert the remaining package-scope needsPackage calls to PackageImports or PackageExports

Open
#4,537 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bugs directory Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

This issue was triaged from [`bugs/dan/0-needsPackage`](https://github.com/Macaulay2/M2/blob/388c1ff0ce30d83751dea7bc7eac77fdc1305dd7/bugs/dan/0-needsPackage), one of the 857 files removed from the pre-GitHub `bugs/` tree by [`d2c8d27826`](https://github.com/Macaulay2/M2/commit/d2c8d27826) and catalogued in [#36](https://github.com/Macaulay2/M2/issues/36). **The commentary below was written by Claude (Claude Opus 5, via Claude Code)**, not by @d-torrance, whose account posted it -- please weigh it accordingly.

The original file, verbatim (111 lines)

```text
replace all uses of needsPackage inside packages by options PackageImports and PackageExports

-*- mode: grep; default-directory: "~/src/M2/trunk/M2/Macaulay2/packages/" -*-
Grep started at Sun Aug 5 10:20:55

egrep --color=never -nH -e needsPackage *.m2
AdjointIdeal.m2:27:needsPackage "MapleInterface"
BGG.m2:1315: needsPackage "ChainComplexExtras"
BIBasis.m2:56:needsPackage "BooleanGB"
Benchmark.m2:13:needsPackage "XML"
Bertini.m2:1:needsPackage "NAGtypes"
Bertini.m2:70:needsPackage "NAGtypes"
Bertini.m2:82:needsPackage "SimpleDoc"
Binomials.m2:105:needsPackage "FourTiTwo";
Binomials.m2:106:needsPackage "Cyclotomic";
Binomials.m2:1988:needsPackage "Binomials";
BoijSoederberg.m2:756:needsPackage "SchurRings"
Classic.m2:12:needsPackage "Parsing"
ConvexInterface.m2:19:needsPackage "MapleInterface"
ExampleIdeals.m2:14:needsPackage "Markov"
FastLinearAlgebra.m2:446:needsPackage "FastLinearAlgebra"
FastLinearAlgebra.m2:483:needsPackage "FastLinearAlgebra"
FourTiTwo.m2:670: needsPackage "FourTiTwo" --testing graver
Functoriality.m2:31:--needsPackage "ChainComplexExtras"
IntegralClosure.m2:20:needsPackage "PrimaryDecomposition"
IntegralClosure.m2:65:needsPackage "ReesAlgebra"
ModuleDeformations.m2:578:needsPackage "ModuleDeformations"
ModuleDeformations.m2:595:needsPackage "ModuleDeformations";
ModuleDeformations.m2:606:needsPackage "ModuleDeformations";
ModuleDeformations.m2:618:needsPackage "ModuleDeformations";
MonomialAlgebras.m2:1:needsPackage "Polyhedra"
MonomialAlgebras.m2:45:needsPackage("FourTiTwo",Configuration=>{"keep files" => false})
MonomialAlgebras.m2:46:needsPackage "Polyhedra"
MonomialMultiplierIdeals.m2:68:needsPackage("Normaliz");
MonomialMultiplierIdeals.m2:77:needsPackage("ReesAlgebra");
MonomialMultiplierIdeals.m2:630: needsPackage "Normaliz";
MonomialMultiplierIdeals.m2:631: needsPackage "MonomialMultiplierIdeals";
MonomialMultiplierIdeals.m2:651: needsPackage "Normaliz";
MonomialMultiplierIdeals.m2:652: needsPackage "MonomialMultiplierIdeals";
MonomialMultiplierIdeals.m2:673: needsPackage "MonomialMultiplierIdeals";
MonomialMultiplierIdeals.m2:695: needsPackage "MonomialMultiplierIdeals";
MonomialMultiplierIdeals.m2:711: needsPackage "MonomialMultiplierIdeals";
MonomialMultiplierIdeals.m2:737: needsPackage "MonomialMultiplierIdeals";
NAGtypes.m2:472:needsPackage "NumericalAlgebraicGeometry"
NAGtypes.m2:535: needsPackage "NumericalAlgebraicGeometry"
NAGtypes.m2:551: needsPackage "NumericalAlgebraicGeometry"
NAGtypes.m2:568: needsPackage "NumericalAlgebraicGeometry"
Nauty.m2:11:if version#"VERSION" <= "1.4" then needsPackage "EdgeIdeals"
Nauty.m2:40: needsPackage "SimplicialComplexes";
Nauty.m2:41: needsPackage "EdgeIdeals";
Nauty.m2:2006:needsPackage "Nauty";
NautyGraphs.m2:11:if version#"VERSION" <= "1.4" then needsPackage "Graphs"
NautyGraphs.m2:26:if version#"VERSION" <= "1.4" then needsPackage "Graphs"
NautyGraphs.m2:1923:needsPackage "Nauty";
NormalToricVarieties.m2:4601:needsPackage "NormalToricVarieties";
NormalToricVarieties.m2:4603:needsPackage "FourierMotzkin";
NumericalAlgebraicGeometry.m2:4:if version#"VERSION" <= "1.4" then needsPackage "NAGtypes"
NumericalAlgebraicGeometry.m2:5:if version#"VERSION" <= "1.4" then needsPackage "PHCpack"
NumericalAlgebraicGeometry.m2:6:if version#"VERSION" <= "1.4" then needsPackage "Bertini"
NumericalAlgebraicGeometry.m2:40:if version#"VERSION" <= "1.4" then needsPackage "NAGtypes"
PHCpack.m2:1:needsPackage "NAGtypes"
PHCpack.m2:54:needsPackage "NAGtypes"
PHCpack.m2:68:needsPackage "SimpleDoc"
ParameterSchemes.m2:25:needsPackage "FourierMotzkin"
ParameterSchemes.m2:79: needsPackage "FourierMotzkin";
PieriMaps.m2:428: needsPackage "SchurRings"
Polyhedra.m2:155:needsPackage "FourierMotzkin"
Polyhedra.m2:3529: F << "needsPackage \"Polyhedra\"" << endl;
Polyhedra.m2:3534: F << "needsPackage \"PPDivisor\"" << endl);
Posets.m2:13: needsPackage "SimplicialComplexes";
Posets.m2:14: needsPackage "Graphs";
Posets.m2:15: needsPackage "FourTiTwo";
Posets.m2:34: needsPackage "SimplicialComplexes";
Posets.m2:35: needsPackage "Graphs";
Posets.m2:36: needsPackage "FourTiTwo";
Posets.m2:6464:needsPackage("Posets", FileName => "./Posets.m2")
RandomCanonicalCurves.m2:1:needsPackage"RandomObjects"
RandomCanonicalCurves.m2:29:needsPackage"RandomObjects"
RandomCanonicalCurves.m2:30:needsPackage"RandomSpaceCurves"
RandomCanonicalCurves.m2:31:needsPackage"RandomPlaneCurves"
RandomCanonicalCurves.m2:32:needsPackage"RandomGenus14Curves"
RandomCurves.m2:1:needsPackage"RandomObjects"
RandomCurves.m2:2:needsPackage"RandomSpaceCurves"
RandomCurves.m2:3:needsPackage"RandomPlaneCurves"
RandomCurves.m2:4:needsPackage"RandomGenus14Curves"
RandomCurves.m2:5:needsPackage"RandomCanonicalCurves"
RandomGenus14Curves.m2:1:needsPackage"RandomObjects"
RandomGenus14Curves.m2:27:needsPackage"RandomObjects"
RandomGenus14Curves.m2:356:needsPackage("RandomGenus14Curves")
RandomPlaneCurves.m2:1:needsPackage "RandomObjects"
RandomPlaneCurves.m2:38:needsPackage "RandomObjects"
RandomSpaceCurves.m2:1:needsPackage"RandomObjects"
RandomSpaceCurves.m2:39:needsPackage"RandomObjects"
RandomSpaceCurves.m2:855:needsPackage("RandomSpaceCurves")
SRdeformations.m2:19: needsPackage "ConvexInterface"
SRdeformations.m2:21:needsPackage "Polyhedra"
Sage.m2:1:needsPackage "Python"
Sage.m2:3:needsPackage "Python"
Schubert2.m2:19:needsPackage "SchurRings"
Schubert2.m2:20:needsPackage "PushForward"
SchurFunctors.m2:366:needsPackage "SymmetricPolynomials"
SchurFunctors.m2:367:needsPackage "SchurRings"
SimpleDoc.m2:20:needsPackage "Text"
SimplicialDecomposability.m2:9:if version#"VERSION" <= "1.4" then needsPackage "SimplicialComplexes"
SimplicialDecomposability.m2:34:if version#"VERSION" <= "1.4" then needsPackage "SimplicialComplexes"
ToricCohomology.m2:20:needsPackage "LLLBases";
ToricCohomology.m2:50:needsPackage "FourierMotzkin"
VersalDeformations.m2:1099:needsPackage "VersalDeformations";
gfanInterface.m2:46:needsPackage "FourierMotzkin"

Grep finished (matches found) at Sun Aug 5 10:20:57
```

### Where it stands today

89% done, and what remains is a finite, checkable list rather than an open-ended sweep.

### Where it stands

- **233 of 300** distributed packages already use `PackageImports` or `PackageExports`.
- **34** still call `needsPackage` before `beginDocumentation`.
- Every other `needsPackage` hit is inside a `TEST` block, where it is correct.

`Benchmark.m2` is the pattern for that last point: it appears at line 13 in Dan's 2012 grep and now
only at line 266, inside a `TEST`.

### The remaining 34 are not a mechanical conversion

`PackageImports` loads a package **without importing its symbols**. So a package that actually uses
the imported package's exported names cannot simply switch to `PackageImports` — it has to use
`PackageExports` (which re-exports them to *its* users, a different meaning) or keep `needsPackage`.
That missing middle is what **#4502** describes: a way to load and import without re-exporting.

So this issue is blocked on #4502 for some of the 34, and mechanical for the rest — worth separating
the two groups before starting.

`open` · disposition `issue` · source of truth: [`bug-triage/catalog.tsv`](https://github.com/d-torrance/M2/blob/bug-triage/bug-triage/catalog.tsv)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bug-triage/catalog.tsv and inspect the 34 remaining package-scope needsPackage calls, using Benchmark.m2 as the documented TEST-block pattern. Separate mechanical conversions to PackageImports or PackageExports from cases that require the loading-and-importing behavior described in #4502. Done means every eligible call is converted, while blocked cases are clearly identified and preserved.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.