OrgMaintenanceScripts.jl
Documentation for OrgMaintenanceScripts.
Package Features
This package provides maintenance scripts for SciML organization repositories, including:
- Code Formatting: Automated formatting with JuliaFormatter across entire organizations
- Version Bumping: Automatically bump minor versions in Project.toml files
- Package Registration: Register packages to Julia registries
- Minimum Version Fixing: Fix minimum version compatibility bounds to pass downgrade CI tests
- Compat Bumping: Automatically update package compatibility bounds for dependencies
- Version Check Finding: Find outdated VERSION checks that can be removed
- Invalidation Analysis: Use SnoopCompileCore to detect performance bottlenecks
- Import Timing Analysis: Analyze package loading times with @time_imports
- Explicit Imports Fixing: Automatically fix implicit imports and remove unused imports
- Documentation Cleanup: Remove bloated documentation files from gh-pages branches
- Multiprocess Testing: Run tests in parallel similar to GitHub Actions CI workflows
- Organization-wide Operations: Process entire organizations at once
Usage Examples
Code Formatting
using OrgMaintenanceScripts
# Format a single repository
success, message,
pr_url = format_repository(
"https://github.com/SciML/Example.jl.git";
fork_user = "myusername"
)
# Format all repos with failing CI
successes, failures,
pr_urls = format_org_repositories(
"SciML";
fork_user = "myusername",
only_failing_ci = true
)Version Bumping and Registration
using OrgMaintenanceScripts
# Bump minor versions and register all packages in a repository
result = bump_and_register_repo("/path/to/repo")
println("Registered packages: ", result.registered)
println("Failed packages: ", result.failed)
# Register monorepo packages without bumping versions
result = register_monorepo_packages("/path/to/monorepo")
println("Successfully registered: ", length(result.registered), " packages")
# Process all repositories in the SciML organization
results = bump_and_register_org("SciML"; auth_token = "your_github_token")
for (repo, result) in results
println("$repo:")
println(" Registered: ", result.registered)
println(" Failed: ", result.failed)
endMinimum Version Fixing
using OrgMaintenanceScripts
# Fix minimum versions for a single repository
success = fix_repo_min_versions("SciML/OrdinaryDiffEq.jl")
# Fix all repositories in an organization
results = fix_org_min_versions("SciML")
# Process only specific repositories
results = fix_org_min_versions("SciML"; only_repos = ["OrdinaryDiffEq.jl", "DiffEqBase.jl"])Compat Bumping
using OrgMaintenanceScripts
# Check available compat updates for a repository
updates = get_available_compat_updates("/path/to/MyPackage.jl")
for (pkg, info) in updates
println("$pkg: $(info.current) → $(info.latest)")
end
# Bump compat bounds and test
success = bump_compat_and_test("/path/to/MyPackage.jl";
create_pr = true,
fork_user = "myusername"
)
# Process an entire organization
results = bump_compat_org_repositories("SciML";
fork_user = "myusername",
limit = 10
)Version Check Finding
using OrgMaintenanceScripts
# Find old version checks in a repository
checks = find_version_checks_in_repo("/path/to/MyPackage.jl")
# Find old version checks across an organization
results = find_version_checks_in_org("SciML"; min_version = v"1.10")
print_version_check_summary(results)
# Use custom minimum version
results = find_version_checks_in_org("MyOrg"; min_version = v"1.9", max_repos = 10)Explicit Imports Fixing
using OrgMaintenanceScripts
# Fix explicit imports in a package
success, iterations, report = fix_explicit_imports("/path/to/MyPackage.jl")
# Fix and create PR for a repository
fix_repo_explicit_imports("MyOrg/MyPackage.jl"; create_pr = true)
# Fix all packages in an organization
results = fix_org_explicit_imports("MyOrg"; create_prs = true)Multiprocess Testing
using OrgMaintenanceScripts
# Run tests in parallel for a local package
summary = run_multiprocess_tests(".github/workflows/CI.yml", ".", log_dir="test_logs")
print_test_summary(summary)
# Test a remote repository
summary = run_tests_from_repo("https://github.com/SciML/OrdinaryDiffEq.jl")
# Generate detailed report
generate_test_summary_report(summary, "test_report.txt")
# Check which groups failed
failed_groups = [r.group.name for r in summary.results if !r.success]Documentation Cleanup
using OrgMaintenanceScripts
# Analyze documentation bloat
analysis = analyze_gh_pages_bloat("/path/to/repo")
println("Repository has $(analysis.total_size_mb) MB of bloat")
# Test cleanup safely with dry run
result = cleanup_gh_pages_docs("/path/to/repo", dry_run=true)
println("Would save: $(result.size_saved_mb) MB")
# Perform actual cleanup
result = cleanup_gh_pages_docs("/path/to/repo")
if result.success
println("Cleaned $(result.files_removed) files")
println("⚠️ Run: git push --force origin gh-pages")
end
# Clean multiple repositories
repos = ["https://github.com/SciML/Repo1.jl.git", "https://github.com/SciML/Repo2.jl.git"]
results = cleanup_org_gh_pages_docs(repos, dry_run=true)
total_savings = sum(r.size_saved_mb for r in results if r.success)Contents
- Formatting Maintenance
- Version Bumping and Registration
- Compat Bumping
- Minimum Version Fixing
- Version Check Finder
- Invalidation Analysis
- Import Timing Analysis
- Explicit Imports Fixing
- Documentation Cleanup
- Multiprocess Testing
API Reference
OrgMaintenanceScripts.CompatUpdateOrgMaintenanceScripts.analyze_gh_pages_bloatOrgMaintenanceScripts.analyze_import_timing_in_processOrgMaintenanceScripts.analyze_invalidations_in_processOrgMaintenanceScripts.analyze_major_invalidatorsOrgMaintenanceScripts.analyze_org_import_timingOrgMaintenanceScripts.analyze_org_invalidationsOrgMaintenanceScripts.analyze_repo_import_timingOrgMaintenanceScripts.analyze_repo_invalidationsOrgMaintenanceScripts.bump_and_register_orgOrgMaintenanceScripts.bump_and_register_repoOrgMaintenanceScripts.bump_compat_and_testOrgMaintenanceScripts.bump_compat_and_test_allOrgMaintenanceScripts.bump_compat_entryOrgMaintenanceScripts.bump_compat_org_repositoriesOrgMaintenanceScripts.bump_compat_versionOrgMaintenanceScripts.bump_minor_versionOrgMaintenanceScripts.cleanup_gh_pages_docsOrgMaintenanceScripts.cleanup_org_gh_pages_docsOrgMaintenanceScripts.create_compat_prOrgMaintenanceScripts.create_compat_pr_multiOrgMaintenanceScripts.downgrade_to_minimum_versionsOrgMaintenanceScripts.extract_min_version_from_compatOrgMaintenanceScripts.find_all_project_tomlsOrgMaintenanceScripts.find_files_to_fixOrgMaintenanceScripts.find_version_checks_in_fileOrgMaintenanceScripts.find_version_checks_in_orgOrgMaintenanceScripts.find_version_checks_in_repoOrgMaintenanceScripts.fix_explicit_importsOrgMaintenanceScripts.fix_missing_importOrgMaintenanceScripts.fix_org_explicit_importsOrgMaintenanceScripts.fix_org_min_versionsOrgMaintenanceScripts.fix_org_version_checks_parallelOrgMaintenanceScripts.fix_package_min_versionsOrgMaintenanceScripts.fix_package_min_versions_allOrgMaintenanceScripts.fix_repo_explicit_importsOrgMaintenanceScripts.fix_repo_min_versionsOrgMaintenanceScripts.fix_unused_importOrgMaintenanceScripts.fix_version_checks_parallelOrgMaintenanceScripts.format_org_repositoriesOrgMaintenanceScripts.format_repositoryOrgMaintenanceScripts.generate_import_timing_reportOrgMaintenanceScripts.generate_invalidation_reportOrgMaintenanceScripts.generate_org_import_summary_reportOrgMaintenanceScripts.generate_org_summary_reportOrgMaintenanceScripts.get_available_compat_updatesOrgMaintenanceScripts.get_available_compat_updates_allOrgMaintenanceScripts.get_latest_package_versionOrgMaintenanceScripts.get_latest_versionOrgMaintenanceScripts.get_org_reposOrgMaintenanceScripts.get_org_repositoriesOrgMaintenanceScripts.get_project_infoOrgMaintenanceScripts.get_relative_project_pathOrgMaintenanceScripts.get_smart_min_versionOrgMaintenanceScripts.has_failing_formatter_ciOrgMaintenanceScripts.is_major_version_updateOrgMaintenanceScripts.is_outdated_compatOrgMaintenanceScripts.is_subpackageOrgMaintenanceScripts.parse_compat_upper_boundOrgMaintenanceScripts.parse_explicit_imports_outputOrgMaintenanceScripts.parse_import_timingsOrgMaintenanceScripts.parse_resolution_errorsOrgMaintenanceScripts.print_version_check_summaryOrgMaintenanceScripts.register_monorepo_packagesOrgMaintenanceScripts.register_packageOrgMaintenanceScripts.run_explicit_imports_checkOrgMaintenanceScripts.run_explicit_imports_check_allOrgMaintenanceScripts.run_package_testsOrgMaintenanceScripts.run_testsOrgMaintenanceScripts.setup_resolverOrgMaintenanceScripts.test_min_versionsOrgMaintenanceScripts.update_compat!OrgMaintenanceScripts.update_project_versionOrgMaintenanceScripts.update_project_versions_allOrgMaintenanceScripts.write_import_timing_reportOrgMaintenanceScripts.write_invalidation_reportOrgMaintenanceScripts.write_org_version_checks_to_scriptOrgMaintenanceScripts.write_version_checks_to_script
OrgMaintenanceScripts.CompatUpdate — Type
CompatUpdateStruct to hold information about a potential compat update.
OrgMaintenanceScripts.analyze_gh_pages_bloat — Method
analyze_gh_pages_bloat(repo_path::String)Analyze documentation bloat in a repository's gh-pages branch without making changes. Returns detailed information about large files and versions for planning cleanup operations.
Arguments
repo_path::String: Path to the Git repository
Returns
NamedTuplewith analysis results:total_size_mb::Float64: Total size of large files in MBlarge_files::Vector: List of large files with size and path informationversions::Vector{String}: List of version directories foundlatest_version::Union{String,Nothing}: Latest version detectedanalysis::String: Human-readable analysis report
Examples
analysis = analyze_gh_pages_bloat("/path/to/repo")
println("Repository has $(analysis.total_size_mb) MB of documentation bloat")
println("Latest version: $(analysis.latest_version)")
println("\n$(analysis.analysis)")OrgMaintenanceScripts.analyze_import_timing_in_process — Function
analyze_import_timing_in_process(repo_path::String, package_name::String="")Run import timing analysis in a separate Julia process using @time_imports. Returns timing data for all packages involved in the import.
OrgMaintenanceScripts.analyze_invalidations_in_process — Function
analyze_invalidations_in_process(repo_path::String, test_script::String="")Run invalidation analysis in a separate Julia process to avoid contaminating the current session. Returns invalidation data that can be analyzed to find major invalidators.
OrgMaintenanceScripts.analyze_major_invalidators — Method
analyze_major_invalidators(invalidation_data::AbstractDict)Analyze invalidation data to identify the major invalidators. Returns a list of the most problematic invalidations.
The invalidation_data argument should be a Dict-like object (typically from JSON3.read) with an "invalidation_details" key containing a vector of invalidation entries.
OrgMaintenanceScripts.analyze_org_import_timing — Method
analyze_org_import_timing(org::String; auth_token::String="", work_dir::String=mktempdir(),
output_dir::String="", max_repos::Int=0)Analyze import timing across all repositories in a GitHub organization.
OrgMaintenanceScripts.analyze_org_invalidations — Method
analyze_org_invalidations(org::String; auth_token::String="", work_dir::String=mktempdir(),
test_script::String="", output_dir::String="", max_repos::Int=0)Analyze invalidations across all repositories in a GitHub organization.
OrgMaintenanceScripts.analyze_repo_import_timing — Method
analyze_repo_import_timing(repo_path::String; package_name::String="", output_file::String="")Analyze import timing in a single repository and optionally save a report.
OrgMaintenanceScripts.analyze_repo_invalidations — Method
analyze_repo_invalidations(repo_path::String; test_script::String="", output_file::String="")Analyze invalidations in a single repository and optionally save a report.
OrgMaintenanceScripts.bump_and_register_org — Method
bump_and_register_org(org::String;
registry="General",
push::Bool=false,
auth_token::String="",
work_dir::String=mktempdir())Process all repositories in a GitHub organization: bump versions and register packages.
This function automates the version bumping and registration process across an entire GitHub organization. It clones each repository, processes Julia packages found within, and handles both single-package repos and monorepos.
Arguments
org::String: GitHub organization name (e.g., "JuliaLang", "SciML")registry: Name or path to the registry (default: "General")push::Bool: Whether to push registrations to the remote registry (default: false)auth_token::String: GitHub authentication token for API access (optional but recommended for rate limits)work_dir::String: Directory for cloning repositories (default: temporary directory)
Returns
A Dict{String, Any} mapping repository names to their results:
- Each entry contains
registeredandfailedarrays - May include an
errorfield if repository processing failed
Behavior
- Fetches all repositories from the GitHub organization using the API
- Clones each repository (shallow clone for efficiency)
- Skips non-Julia repositories (no Project.toml)
- For each Julia repository:
- Bumps minor versions of all packages
- Registers packages in dependency order
- Commits and pushes changes to the repository
- Cleans up cloned repositories after processing
Examples
# Process all repos in an organization
results = bump_and_register_org("MyOrg")
for (repo, result) in results
println(repo, ": registered ", length(result.registered), " packages")
end
# With authentication and custom registry
results = bump_and_register_org("MyOrg";
auth_token=ENV["GITHUB_TOKEN"],
registry="MyRegistry",
push=true
)Notes
- Requires appropriate permissions to push to repositories
- GitHub API rate limits apply (higher with authentication token)
- Repositories are processed sequentially to avoid overwhelming the registry
- Temporary clones are automatically cleaned up even if errors occur
See Also
bump_and_register_repo: For processing a single repositoryget_org_repos: For fetching organization repository list
OrgMaintenanceScripts.bump_and_register_repo — Method
bump_and_register_repo(repo_path::String; registry="General", push::Bool=false)Bump minor versions and register all packages in a repository (monorepo).
This function handles both single-package repositories and monorepos with multiple packages. It automatically bumps the minor version of all packages found (main package and lib/* subpackages), then registers them in dependency order using a brute-force approach.
Arguments
repo_path::String: Path to the repository root directoryregistry: Name or path to the registry (default: "General")push::Bool: Whether to push the registration to the remote registry (default: false)
Returns
A NamedTuple with:
registered::Vector{String}: Names of successfully registered packagesfailed::Vector{String}: Names of packages that failed to register
Behavior
- Bumps minor versions of all Project.toml files found
- Collects all package directories (main + lib/*)
- Attempts to register packages iteratively until all succeed or no progress
- Automatically commits version bumps if any packages were processed
- Handles dependency ordering by retrying failed registrations
Examples
# Bump and register all packages in a repository
result = bump_and_register_repo("/path/to/repo")
println("Registered: ", result.registered)
println("Failed: ", result.failed)
# Use custom registry with push
bump_and_register_repo("/path/to/repo"; registry="MyRegistry", push=true)OrgMaintenanceScripts.bump_compat_and_test — Method
bump_compat_and_test(repo_path::String;
package_name::Union{String,Nothing} = nothing,
bump_all::Bool = false,
create_pr::Bool = true,
fork_user::String = "")Bump compat entries for major version updates and run tests. If tests pass, optionally create a PR.
Arguments
repo_path: Path to the repositorypackage_name: Specific package to bump (if nothing, check all)bump_all: Whether to bump all available updates or just onecreate_pr: Whether to create a PR if tests passfork_user: GitHub username for creating PRs (required if create_pr=true)
Returns
(success::Bool, message::String, pr_url::Union{String,Nothing}, bumped_packages::Vector{String})
OrgMaintenanceScripts.bump_compat_and_test_all — Method
bump_compat_and_test_all(repo_path::String;
package_name::Union{String,Nothing} = nothing,
bump_all::Bool = false,
create_pr::Bool = true,
fork_user::String = "",
include_subpackages::Bool = true)Bump compat entries for major version updates in all Project.toml files in a repository. This function supports repositories with subpackages in the /lib directory.
Arguments
repo_path: Path to the repositorypackage_name: Specific package to bump across all Project.toml filesbump_all: Whether to bump all available updates or just one per Project.tomlcreate_pr: Whether to create a PR if tests passfork_user: GitHub username for creating PRs (required if create_pr=true)include_subpackages: Whether to include subpackages in /lib directory
Returns
(success::Bool, message::String, pr_url::Union{String,Nothing}, bumped_info::Dict)
OrgMaintenanceScripts.bump_compat_entry — Method
bump_compat_entry(project_path::String, package_name::String, new_version::String)Bump a single compat entry in Project.toml to allow the new version.
OrgMaintenanceScripts.bump_compat_org_repositories — Function
bump_compat_org_repositories(org::String = "SciML";
package_name::Union{String,Nothing} = nothing,
bump_all::Bool = false,
create_pr::Bool = true,
fork_user::String = "",
limit::Int = 100,
log_file::String = "",
include_subpackages::Bool = true)Bump compat entries for all repositories in a GitHub organization. This function now supports repositories with subpackages in /lib directories.
Arguments
org: GitHub organization name (default: "SciML")package_name: Specific package to bump across all repos (if nothing, check all)bump_all: Whether to bump all available updates or just one per repocreate_pr: Whether to create PRs if tests passfork_user: GitHub username for creating PRs (required if create_pr=true)limit: Maximum number of repositories to processlog_file: Path to save results log (default: auto-generated)include_subpackages: Whether to include subpackages in /lib directories
Returns
(successes::Vector{String}, failures::Vector{String}, pr_urls::Vector{String})
OrgMaintenanceScripts.bump_compat_version — Method
bump_compat_version(compat_str::String, pkg_name::String)Bump a compat version string conservatively, ensuring we don't go above the current release.
OrgMaintenanceScripts.bump_minor_version — Method
bump_minor_version(version_str::String) -> StringBump the minor version of a semantic version string and reset patch to 0.
Arguments
version_str::String: A semantic version string in "MAJOR.MINOR.PATCH" format
Returns
String: The version string with minor incremented and patch reset to 0
Examples
bump_minor_version("1.2.3") # Returns "1.3.0"
bump_minor_version("0.1.0") # Returns "0.2.0"
bump_minor_version("2.10.5") # Returns "2.11.0"Errors
- Throws
ErrorExceptionif version format is invalid (not three parts)
OrgMaintenanceScripts.cleanup_gh_pages_docs — Method
cleanup_gh_pages_docs(repo_path::String;
preserve_latest::Bool=true,
dry_run::Bool=false,
size_threshold_mb::Float64=5.0)Clean up bloated documentation in a repository's gh-pages branch by removing large files from old documentation versions while preserving the latest release.
This function addresses the common issue of repository bloat caused by large HTML files with embedded SVG plots from documentation builds, particularly in tutorial-heavy packages.
Arguments
repo_path::String: Path to the Git repositorypreserve_latest::Bool=true: Whether to preserve the latest version documentationdry_run::Bool=false: If true, only show what would be cleaned without making changessize_threshold_mb::Float64=5.0: Remove files larger than this threshold (in MB)
Returns
NamedTuplewith cleanup statistics:files_removed::Int: Number of files removeddirs_removed::Int: Number of directories removedsize_saved_mb::Float64: Estimated size saved in MBversions_cleaned::Vector{String}: List of version directories cleanedpreserved_version::Union{String,Nothing}: Version that was preservedsuccess::Bool: Whether the operation succeedederror_message::Union{String,Nothing}: Error message if operation faileddry_run::Bool: Whether this was a dry run (only present in dry run mode)
Examples
# Analyze what would be cleaned (safe, no changes)
result = cleanup_gh_pages_docs("/path/to/repo", dry_run=true)
println("Would save: $(result.size_saved_mb) MB")
# Clean up preserving latest version
result = cleanup_gh_pages_docs("/path/to/repo", preserve_latest=true)
if result.success
println("Cleaned $(result.files_removed) files, saved $(result.size_saved_mb) MB")
println("⚠️ Run: git push --force origin gh-pages")
end
# Aggressive cleanup removing all old docs
result = cleanup_gh_pages_docs("/path/to/repo", preserve_latest=false)Safety Features
- Operates only on gh-pages branch (preserves all code branches/tags)
- Creates backup references before major operations
- Supports dry-run mode for safe testing
- Automatic detection of latest version to preserve
- Comprehensive error handling and validation input validation
Common Use Cases
- Repository growing too large due to documentation bloat
- CI builds creating many preview/dev documentation versions
- Large SVG/HTML files from plot-heavy tutorials (30+ MB files)
- Slow clone times affecting developer productivity
Warnings
⚠️ Important: This modifies Git history on the gh-pages branch
- All contributors should be notified before running
- Force push required after cleanup:
git push --force origin gh-pages - Backup your repository before running on important data
Technical Details
The function identifies and removes:
- Old version directories (v1.0.0, v1.1.0, etc.) except the latest
- Development documentation (
dev/,previews/,preview-*/) - Large files exceeding the size threshold
- Performs Git garbage collection to reclaim space
The latest version is automatically detected by parsing semantic version numbers from directory names matching the pattern v\d+\.\d+\.\d+.
OrgMaintenanceScripts.cleanup_org_gh_pages_docs — Method
cleanup_org_gh_pages_docs(org_repos::Vector{String};
preserve_latest::Bool=true,
dry_run::Bool=false,
size_threshold_mb::Float64=5.0,
working_dir::String=mktempdir())Clean up documentation bloat across multiple repositories in an organization.
Arguments
org_repos::Vector{String}: List of repository URLs to processpreserve_latest::Bool=true: Whether to preserve latest version in each repodry_run::Bool=false: If true, only analyze without making changessize_threshold_mb::Float64=5.0: Size threshold for file removalworking_dir::String: Directory to clone repositories into
Returns
Vectorof cleanup results for each repository
Examples
repos = [
"https://github.com/SciML/DifferentialEquations.jl.git",
"https://github.com/SciML/JumpProcesses.jl.git"
]
results = cleanup_org_gh_pages_docs(repos, dry_run=true)
total_savings = sum(r.size_saved_mb for r in results if r.success)
println("Organization could save $(total_savings) MB")OrgMaintenanceScripts.create_compat_pr — Method
create_compat_pr(repo_path::String, bumped_packages::Vector{String}, fork_user::String)Create a pull request for compat updates.
OrgMaintenanceScripts.create_compat_pr_multi — Method
create_compat_pr_multi(repo_path::String, bumped_info::Dict{String, Vector{String}}, fork_user::String)Create a pull request for compat updates across multiple Project.toml files.
OrgMaintenanceScripts.downgrade_to_minimum_versions — Method
downgrade_to_minimum_versions(project_dir::String; julia_version="1.10", mode="alldeps", work_dir=mktempdir())Downgrade all dependencies to their minimum compatible versions using Resolver.jl. This uses the same approach as julia-actions/julia-downgrade-compat. Returns (success::Bool, output::String)
OrgMaintenanceScripts.extract_min_version_from_compat — Method
extract_min_version_from_compat(compat_str::String)Extract the minimum version from a compat string.
OrgMaintenanceScripts.find_all_project_tomls — Method
find_all_project_tomls(repo_path::String)Find all Project.toml files in a repository, including those in the /lib subdirectory. Returns a vector of absolute paths to Project.toml files.
OrgMaintenanceScripts.find_files_to_fix — Method
find_files_to_fix(package_path::String, issues::Vector)Find which files need to be fixed based on the issues found. Returns a Dict mapping file paths to their issues.
OrgMaintenanceScripts.find_version_checks_in_file — Method
find_version_checks_in_file(filepath::String; min_version::VersionNumber=JULIA_LTS)Find all version checks in a single file that compare against versions older than min_version.
OrgMaintenanceScripts.find_version_checks_in_org — Method
find_version_checks_in_org(org::String;
min_version::VersionNumber=JULIA_LTS,
auth_token::String="",
work_dir::String=mktempdir(),
ignore_dirs=["test", "docs", ".git"])Find all version checks in all repositories of a GitHub organization.
OrgMaintenanceScripts.find_version_checks_in_repo — Method
find_version_checks_in_repo(repo_path::String; min_version::VersionNumber=JULIA_LTS, ignore_dirs=["test", "docs", ".git"])Find all version checks in a repository that compare against versions older than min_version.
OrgMaintenanceScripts.fix_explicit_imports — Method
fix_explicit_imports(package_path::String; max_iterations=10, verbose=true)Iteratively fix explicit import issues in a package until all checks pass. Returns (success::Bool, iterations::Int, final_report::String)
OrgMaintenanceScripts.fix_missing_import — Method
fix_missing_import(file_path::String, module_name::String, symbol::String)Add a missing explicit import to a Julia file.
OrgMaintenanceScripts.fix_org_explicit_imports — Method
fix_org_explicit_imports(org_name::String;
work_dir=mktempdir(),
max_iterations=10,
create_prs=true,
skip_repos=String[],
only_repos=nothing,
verbose=true)Fix explicit imports for all Julia packages in a GitHub organization.
OrgMaintenanceScripts.fix_org_min_versions — Method
fix_org_min_versions(org_name::String;
work_dir=mktempdir(),
max_iterations=10,
create_prs=true,
skip_repos=String[],
only_repos=nothing,
julia_version="1.10",
include_subpackages=true)Fix minimum versions for all Julia packages in a GitHub organization. Now supports repositories with subpackages in /lib directories.
OrgMaintenanceScripts.fix_org_version_checks_parallel — Function
fix_org_version_checks_parallel(org::String, n_processes::Int=4;
min_version::VersionNumber=JULIA_LTS,
github_token::String="",
base_branch::String="main",
work_dir::String=mktempdir())Find and fix version checks across an entire GitHub organization using parallel processing.
OrgMaintenanceScripts.fix_package_min_versions — Method
fix_package_min_versions(repo_path::String;
max_iterations=10,
work_dir=mktempdir(),
julia_version="1.10")Fix minimum versions for a package repository that's already cloned. Returns (success::Bool, updates::Dict{String,String})
OrgMaintenanceScripts.fix_package_min_versions_all — Method
fix_package_min_versions_all(repo_path::String;
max_iterations=10,
work_dir=mktempdir(),
julia_version="1.10",
include_subpackages=true)Fix minimum versions for all Project.toml files in a repository. Supports repositories with subpackages in the /lib directory. Returns (success::Bool, all_updates::Dict{String,Dict{String,String}})
OrgMaintenanceScripts.fix_repo_explicit_imports — Method
fix_repo_explicit_imports(repo_name::String;
work_dir=mktempdir(),
max_iterations=10,
create_pr=true,
verbose=true)Clone a repository, fix its explicit imports, and optionally create a PR.
OrgMaintenanceScripts.fix_repo_min_versions — Method
fix_repo_min_versions(repo_name::String;
work_dir=mktempdir(),
max_iterations=10,
create_pr=true,
julia_version="1.10",
include_subpackages=true)Clone a repository, fix its minimum versions, and optionally create a PR. Now supports repositories with subpackages in /lib directories.
OrgMaintenanceScripts.fix_unused_import — Method
fix_unused_import(file_path::String, symbol::String)Remove an unused import from a Julia file.
OrgMaintenanceScripts.fix_version_checks_parallel — Function
fix_version_checks_parallel(checks::Vector{VersionCheck}, n_processes::Int=4;
github_token::String="",
base_branch::String="main",
pr_title_prefix::String="[Auto] Remove obsolete version checks")Fix version checks in parallel using N processes. Each process will create a PR to fix the version checks by removing obsolete comparisons.
OrgMaintenanceScripts.format_org_repositories — Function
format_org_repositories(org::String = "SciML";
test::Bool = true,
push_to_master::Bool = false,
create_pr::Bool = true,
fork_user::String = "",
limit::Int = 100,
only_failing_ci::Bool = true,
log_file::String = "")Format all repositories in a GitHub organization.
Arguments
org: GitHub organization name (default: "SciML")test: Whether to run tests after formatting (default: true)push_to_master: Whether to push directly to master/main if tests pass (default: false)create_pr: Whether to create PRs instead of pushing to master (default: true)fork_user: GitHub username for creating PRs (required if create_pr=true)limit: Maximum number of repositories to process (default: 100)only_failing_ci: Only process repos with failing formatter CI (default: true)log_file: Path to save results log (default: auto-generated)
Returns
(successes::Vector{String}, failures::Vector{String}, pr_urls::Vector{String})
OrgMaintenanceScripts.format_repository — Method
format_repository(repo_url::String;
test::Bool = true,
push_to_master::Bool = false,
create_pr::Bool = true,
fork_user::String = "",
working_dir::String = mktempdir())Format a single repository with JuliaFormatter.
Arguments
repo_url: URL of the repository to format (e.g., "https://github.com/SciML/Example.jl.git")test: Whether to run tests after formatting (default: true)push_to_master: Whether to push directly to master/main if tests pass (default: false)create_pr: Whether to create a PR instead of pushing to master (default: true)fork_user: GitHub username for creating PRs (required if create_pr=true)working_dir: Directory to clone the repository into (default: temporary directory)
Returns
(success::Bool, message::String, pr_url::Union{String,Nothing})
OrgMaintenanceScripts.generate_import_timing_report — Function
generate_import_timing_report(repo_path::String, package_name::String="")Generate a comprehensive import timing report for a repository.
OrgMaintenanceScripts.generate_invalidation_report — Function
generate_invalidation_report(repo_path::String, test_script::String="")Generate a comprehensive invalidation report for a repository.
OrgMaintenanceScripts.generate_org_import_summary_report — Method
generate_org_import_summary_report(org::String, results::Dict{String, ImportTimingReport}, output_dir::String)Generate a summary report for import timing across the entire organization.
OrgMaintenanceScripts.generate_org_summary_report — Method
generate_org_summary_report(org::String, results::Dict{String, InvalidationReport}, output_dir::String)Generate a summary report for the entire organization.
OrgMaintenanceScripts.get_available_compat_updates — Method
get_available_compat_updates(project_path::String)Check for available compat updates in a Project.toml file. Returns a vector of CompatUpdate structs.
OrgMaintenanceScripts.get_available_compat_updates_all — Method
get_available_compat_updates_all(repo_path::String)Check for available compat updates in all Project.toml files in a repository. Returns a Dict mapping project paths to vectors of CompatUpdate structs.
OrgMaintenanceScripts.get_latest_package_version — Method
get_latest_package_version(package_name::String)Get the latest version of a package from the General registry.
OrgMaintenanceScripts.get_latest_version — Method
get_latest_version(pkg_name::String)Get the latest version of a package from the registry.
OrgMaintenanceScripts.get_org_repos — Method
get_org_repos(org::String; auth_token::String="")Fetch all repositories for a GitHub organization using the GitHub API.
Arguments
org::String: The GitHub organization name (e.g., "JuliaLang", "SciML")auth_token::String: Optional GitHub personal access token for authentication (increases rate limits from 60 to 5000 requests per hour)
Returns
Vector{String}: Full repository names in "org/repo" format
Behavior
- Uses GitHub API v3 to fetch repository list
- Handles pagination automatically (100 repos per page)
- Returns all public repositories (private repos require auth token with appropriate permissions)
- Continues fetching until all pages are retrieved
- Handles API errors gracefully and returns partial results if pagination fails
Examples
# Get all public repos for an organization
repos = get_org_repos("JuliaLang")
println("Found ", length(repos), " repositories")
# With authentication for higher rate limits and private repos
repos = get_org_repos("MyOrg"; auth_token=ENV["GITHUB_TOKEN"])Notes
- Rate limits: 60 requests/hour unauthenticated, 5000/hour with token
- Only returns repositories the token has access to
- For large organizations, fetching may take several API calls due to pagination
OrgMaintenanceScripts.get_org_repositories — Function
get_org_repositories(org::String, limit::Int = 100)Get all Julia repositories from a GitHub organization.
OrgMaintenanceScripts.get_project_info — Method
get_project_info(project_path::String)Extract package name and other information from a Project.toml file. Returns a NamedTuple with name, uuid, and path fields.
OrgMaintenanceScripts.get_relative_project_path — Method
get_relative_project_path(project_path::String, repo_path::String)Get the relative path of a Project.toml file from the repository root.
OrgMaintenanceScripts.get_smart_min_version — Method
get_smart_min_version(pkg_name::String, current_compat::String)Get an appropriate minimum version for a package.
OrgMaintenanceScripts.has_failing_formatter_ci — Method
has_failing_formatter_ci(org::String, repo::String)Check if a repository has failing formatter CI.
OrgMaintenanceScripts.is_major_version_update — Method
is_major_version_update(current_compat::String, latest_version::String)Check if the latest version is a major version update compared to current compat.
OrgMaintenanceScripts.is_outdated_compat — Method
is_outdated_compat(compat_str::String, pkg_name::String)Check if a compat string indicates an outdated version by comparing to the latest release.
OrgMaintenanceScripts.is_subpackage — Method
is_subpackage(project_path::String, repo_path::String)Check if a Project.toml file is a subpackage (i.e., in the /lib directory).
OrgMaintenanceScripts.parse_compat_upper_bound — Method
parse_compat_upper_bound(compat_spec::String)Parse a compat specification to extract the upper bound version.
OrgMaintenanceScripts.parse_explicit_imports_output — Method
parse_explicit_imports_output(output::String)Parse the output from ExplicitImports checks to extract actionable issues. Returns a vector of issues with their types and details.
OrgMaintenanceScripts.parse_import_timings — Method
parse_import_timings(timing_data::Dict)Parse the raw timing data and create structured ImportTiming objects.
OrgMaintenanceScripts.parse_resolution_errors — Method
parse_resolution_errors(output::String, project_toml::Dict)Parse resolution errors to identify problematic packages.
OrgMaintenanceScripts.print_version_check_summary — Method
print_version_check_summary(checks::Vector{VersionCheck})
print_version_check_summary(io::IO, checks::Vector{VersionCheck})Print a summary of version checks to the specified IO stream (defaults to stdout).
OrgMaintenanceScripts.register_monorepo_packages — Method
register_monorepo_packages(repo_path::String; registry="General", push::Bool=false)Register all packages in a monorepo without bumping versions.
This function is similar to bump_and_register_repo but only performs registration without modifying package versions. Useful when versions have already been bumped or when you want to register packages at their current versions.
Arguments
repo_path::String: Path to the repository root directoryregistry: Name or path to the registry (default: "General")push::Bool: Whether to push the registration to the remote registry (default: false)
Returns
A NamedTuple with:
registered::Vector{String}: Names of successfully registered packagesfailed::Vector{String}: Names of packages that failed to register
Behavior
- Scans for all packages (main Project.toml and lib/*/Project.toml)
- Uses brute-force dependency resolution by repeatedly attempting registration
- Continues until all packages are registered or no more progress is possible
- Handles circular dependencies and complex dependency graphs
- Does NOT modify any Project.toml files or create commits
Examples
# Register all packages in a monorepo at current versions
result = register_monorepo_packages("/path/to/repo")
println("Successfully registered: ", length(result.registered), " packages")
# Register with custom registry
register_monorepo_packages("/path/to/repo"; registry="MyRegistry", push=true)See Also
bump_and_register_repo: For bumping versions before registrationregister_package: For registering a single package
OrgMaintenanceScripts.register_package — Method
register_package(package_dir::String; registry="General", push::Bool=false)Register a Julia package to the specified registry using LocalRegistry.
Arguments
package_dir::String: Path to the directory containing the package to registerregistry: Name or path to the registry (default: "General")push::Bool: Whether to push the registration to the remote registry (default: false)
Returns
Bool:trueif registration succeeded,falseotherwise
Examples
# Register a package to the General registry
register_package("/path/to/MyPackage")
# Register to a custom registry with push
register_package("/path/to/MyPackage"; registry="MyRegistry", push=true)OrgMaintenanceScripts.run_explicit_imports_check — Method
run_explicit_imports_check(package_path::String; verbose=true)Run ExplicitImports.jl checks on a package and return the report. Returns (success::Bool, report::String, issues::Vector)
OrgMaintenanceScripts.run_explicit_imports_check_all — Method
run_explicit_imports_check_all(repo_path::String; verbose=true, include_subpackages=true)Run ExplicitImports.jl checks on all packages in a repository. Supports repositories with subpackages in /lib directories. Returns a Dict mapping relative paths to (success, report, issues) tuples.
OrgMaintenanceScripts.run_package_tests — Method
run_package_tests(repo_path::String; timeout_minutes::Int = 30)Run tests for a Julia package and return whether they passed.
OrgMaintenanceScripts.run_tests — Method
run_tests(repo_path::String; timeout_minutes::Int = 10)Run tests for a Julia package.
Returns
trueif tests pass,falseotherwise
OrgMaintenanceScripts.setup_resolver — Method
setup_resolver(work_dir::String)Clone and setup Resolver.jl if not already present. Returns the path to Resolver.jl.
OrgMaintenanceScripts.test_min_versions — Method
test_min_versions(project_dir::String; julia_version="1.10", mode="alldeps", work_dir=mktempdir())Test if minimum versions can be resolved using Resolver.jl. Returns (success::Bool, error_output::String)
OrgMaintenanceScripts.update_compat! — Method
update_compat!(project_toml::Dict, updates::Dict{String, String})Update the compat section preserving upper bounds.
OrgMaintenanceScripts.update_project_version — Method
update_project_version(project_path::String) -> Union{Tuple{String,String}, Nothing}Update the version in a Project.toml file by bumping the minor version.
Arguments
project_path::String: Path to the Project.toml file to update
Returns
Tuple{String, String}: (oldversion, newversion) if successfulnothing: If file doesn't exist or has no version field
Behavior
- Reads the Project.toml file
- Extracts the current version
- Bumps the minor version (e.g., "1.2.3" → "1.3.0")
- Writes the updated Project.toml back to disk
- Logs the version change
Examples
result = update_project_version("path/to/Project.toml")
if !isnothing(result)
old_ver, new_ver = result
println("Updated from v", old_ver, " to v", new_ver)
endNotes
- Preserves all other fields in Project.toml
- Issues a warning if file not found or no version field exists
- Atomic write operation (full file rewrite)
OrgMaintenanceScripts.update_project_versions_all — Method
update_project_versions_all(repo_path::String; include_subpackages::Bool=true)Update the version in all Project.toml files in a repository by bumping the minor version. Supports repositories with subpackages in /lib directories. Returns a Dict mapping relative paths to (oldversion, newversion) tuples.
OrgMaintenanceScripts.write_import_timing_report — Method
write_import_timing_report(report::ImportTimingReport, output_file::String)Write a detailed import timing report to a JSON file.
OrgMaintenanceScripts.write_invalidation_report — Method
write_invalidation_report(report::InvalidationReport, output_file::String)Write a detailed invalidation report to a JSON file.
OrgMaintenanceScripts.write_org_version_checks_to_script — Function
write_org_version_checks_to_script(org_results::Dict{String, Vector{VersionCheck}}, output_file::String="fix_org_version_checks.jl")Write organization-wide version check results to a script file.
OrgMaintenanceScripts.write_version_checks_to_script — Function
write_version_checks_to_script(checks::Vector{VersionCheck}, output_file::String="fix_version_checks.jl")Write version check results to a Julia script file that can be executed to fix them.