Package Development
Bender makes it easy to develop multiple packages simultaneously. If you find yourself needing to modify a dependency, you don’t have to manually manage local paths and Git remotes. Instead, you can use the clone and snapshot workflow.
The Development Workflow
1. Clone the Dependency
Use the clone command to move a dependency from Bender’s internal cache into a local directory where you can modify it:
bender clone <PKG_NAME>
By default, the package is checked out into a working_dir folder (you can change this with -p/--path). Bender automatically:
- Performs a
git cloneof the dependency into that folder. - Adds a
pathoverride to yourBender.localfile.
Now, any changes you make in that folder are immediately reflected in your top-level project when you run Bender commands.
2. Modify and Commit
You can now work on the cloned package as if it were a normal Git repository. You can add files, fix bugs, and commit your changes within that directory.
3. Snapshot the State
Once you have committed changes in your cloned dependency and want to record that specific state (for sharing with others or for CI), use the snapshot command:
bender snapshot
Bender will:
- Detect all dependencies that are currently overridden by a local path.
- Check the current Git commit hash of those local repositories.
- Update
Bender.localto use agitoverride with that specificrev(commit hash). - Automatically update
Bender.lockto include these exact revisions.
Why use Snapshot?
The main benefit of a snapshot is portability. Because the lockfile is updated with the specific commit hashes, you can commit Bender.lock and share it with colleagues or run it in CI. The other environments will download the exact revisions you were working on from the Git remotes, without needing access to your local development paths.
Useful flags:
--working-dir <DIR>: scan a different directory for local checkouts (defaults toworking_dir, matchingbender clone’s default).--checkout: after writing the lockfile, also check out the resolved revisions into the configuredcheckout_dir(if any). Dependencies with uncommitted changes are skipped by default; warningW25is emitted for each one. Pass--no-skipto snapshot them anyway.--force: combined with--checkout, overwrite an existing customcheckout_dir. Use with care, as this can discard local work.
Finalizing Changes
Once your changes are stable and you are ready to “release” them:
- Tag the Dependency: Push your changes to the remote repository and create a new version tag (e.g.,
v1.2.2). - Update Manifest: Update the version requirement in your
Bender.ymlto include the new version. - Clean Up: Remove the local overrides from your
Bender.localfile. - Resolve: Run
bender updateto re-resolve the dependency tree and updateBender.lockto point to the new official version.