library(metapip)
#> ── Attaching packages ───────────────────────────────────────── metapip 0.1.1 ──Overview
When developing a PIP package (e.g., pipapi,
wbpip), you need the other PIP ecosystem packages available
at their correct versions. metapip automatically detects
when you’re working inside a PIP package directory and excludes it from
updates, so you never accidentally overwrite the code you’re actively
developing.
Default and Custom Branches
The global default branch:
get_default_branch()
#> [1] "PROD"Per-package overrides:
get_custom_branch()
#>
#> ── metapip custom branches: ──
#>
#> ◌ pipapi : DEV
#> ◌ pipfaker: main
#> ◌ wbpip : DEV
#> ◌ pipster : DEVChange the global default:
set_default_branch("DEV")Inspecting Branch Assignments
See all current assignments:
get_current_branches()
#> ── metapip current branches (default in red): ──
#>
#> ◌ pipapi : DEV
#> ◌ pipload : PROD
#> ◌ wbpip : DEV
#> ◌ pipfun : PROD
#> ◌ pipdata : PROD
#> ◌ pipster : DEV
#> ◌ pipaux : PROD
#> ◌ pipfaker: mainGet the branch for a single package:
get_package_current_branch("pipdata")
#> pipdata
#> "PROD"Setting Custom Branches
Override individual packages:
set_custom_branch(pipdata = "main", pipapi = "DEV_v3")
#> ── metapip custom branches: ──
#>
#> ◌ pipapi : DEV_v3
#> ◌ pipfaker: main
#> ◌ wbpip : DEV
#> ◌ pipster : DEV
#> ◌ pipdata : mainListing Core Packages
get_core_pagkages()
#> [1] "pipapi" "pipload" "wbpip" "pipfun" "pipdata" "pipster" "pipaux"
#> [8] "pipfaker"Auto-Exclusion Logic
When called with exclude = NA (the default),
get_core_pagkages() automatically detects if your working
directory is a PIP package and excludes it. This is what
init_metapip() and update_pip_packages() use
internally.
# Current directory is not a PIP package
get_core_pagkages(exclude = NA)
#> [1] "pipapi" "pipload" "wbpip" "pipfun" "pipdata" "pipster" "pipaux"
#> [8] "pipfaker"
# Simulate working inside pipapi
pipapi_dir <- file.path(tempdir(), "pipapi")
dir.create(pipapi_dir, recursive = TRUE, showWarnings = FALSE)
withr::with_dir(
pipapi_dir,
print(get_core_pagkages(NA))
)
#> [1] "pipload" "wbpip" "pipfun" "pipdata" "pipster" "pipaux" "pipfaker"Package Development Workflow
- Navigate to your package directory (e.g.,
~/repos/pipapi). - Run
update_pip_packages()– all core packages exceptpipapiare updated to their configured branch HEADs. - Run
init_metapip()– all core packages exceptpipapiare installed (if outdated) and attached. - Develop your package with the correct dependency versions.
- When done, run
pip_snapshot()from a neutral directory to update the team lock.