diff --git a/README.md b/README.md index cb90f05b..4d3dfb1b 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,12 @@ running the following command inside it. pixi run --frozen dev-setup ``` Follow the prompts to configure the set-up to your liking. +Among other configurations, this set-up clones the other Auto-Mech repositories +into the parent directory of your mechdriver repository. +``` +ls .. +autochem autofile autoio mechanalyzer mechdriver +``` If you run into issues, see [Appendix C](#appendix-c-manual-developer-setup) for manual set-up instructions. @@ -107,6 +113,22 @@ For more information on activating Pixi environments, see You can then run any of the examples [in the `examples/` directory](./examples/) as [described above](#run). +### Git Helper Tasks + +The following Pixi tasks are available to facilitate Git operations with your +five local Auto-Mech repositories: + +1. `pixi run pull`. This does a `git pull --rebase upstream dev` on all five +repositories to update them against the central Auto-Mech upstream. +2. `pixi run git `. This runs whatever `git` commands you pass it in +all five repositories. + +For example, a common operation you might wish to do is: +``` +pixi run pull # Rebase each repo against upstream +pixi run git push origin dev # Push each repo to origin +``` + ### Test > [!TIP] @@ -178,7 +200,7 @@ override the commit hash check on GitHub Actions and allow your tests to pass. > [!WARNING] > Versions are now automatically handled by the BumpVer versioning tool. -> Therefore, do not manually change the version of a given package in its +> Therefore, **do not** manually change the version of a given package in its > `pyproject.toml`. Instead, the version will be automatically updated by > triggering the release workflow as described below. @@ -195,22 +217,23 @@ This will (1.) bump the version number, (2.) publish the conda package to the [`auto-mech` channel](https://anaconda.org/Auto-Mech/), and (3.) create an associated GitHub release. -For now, if you have updated the conda package for a lower-level module such as -`autoio` and want these changes to take effect in MechDriver, you will also need -to update the following two tables in the MechDriver `pyproject.toml`. +If you have done this for one or more of the lower-level repositories, you will +also need to update the MechDriver `pyproject.toml` file with their new version +numbers. +You can do so as follows: ``` -[tool.pixi.package.run-dependencies] -... -autoio = "==" - -[tool.pixi.dependencies] -... -autoio = "==" +pixi run pull # Pull the release commits from upstream +pixi run update # Update the version numbers in pyproject.toml ``` -These two dependency tables **must match exactly** to ensure that the packaged -version of the code matches the tested version. +This will update the `package.run-dependencies` and `dependencies` tables in +your `pyproject.toml` with the new version numbers of the lower-level +repositories and update the lockfile. +If you make any manual changes to these tables, +**make sure that they match exactly**. +This is necessary to ensure that the packaged version of the code matches the +tested version. -## Subtask Parallelization +## Experimental Feature: Subtask Parallelization As an experimental feature in MechDriver, you can parallelize across subtasks in your workflow with diff --git a/pixi.lock b/pixi.lock index 9f7d00b3..94512ae1 100644 --- a/pixi.lock +++ b/pixi.lock @@ -3216,7 +3216,7 @@ packages: - pypi: ./ name: mechdriver version: 0.2025.0 - sha256: 095f06371aecf34e3352a95aadf86ed5d9fb442b4e75005a80619a3eddc45695 + sha256: 2e82d94200ce04596d1b6e47b5502d1e0bd2f5b55fa1e71c6184bb79a1bbfa32 requires_dist: - hyperqueue requires_python: '>=3.11,<3.14' diff --git a/pyproject.toml b/pyproject.toml index 4e555692..75312869 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -133,7 +133,7 @@ dev-setup-hq = { cmd = "./scripts/dev-setup-hq.sh", cwd = "." } dev-setup-config = { cmd = "./scripts/dev-setup-config.sh", cwd = "." } dev-setup = { depends-on = ["dev-setup-repos", "dev-setup-hq", "dev-setup-config"] } git = { cmd = "./scripts/git.sh", cwd = "." } -update = { cmd = "./scripts/update.sh", cwd = "." } +pull = { cmd = "./scripts/pull.sh", cwd = "." } [tool.pixi.feature.test.tasks] test = { cmd = "./scripts/test.py" } @@ -145,6 +145,7 @@ dev-test = { cmd = "./scripts/test.py" } [tool.pixi.feature.build.tasks] upload = "rattler-build upload anaconda -o Auto-Mech *.conda" current-version = "bumpver show -n | awk -F': ' '/Current Version: / {print $2}'" +update = { cmd = "./scripts/update.sh", cwd = "." } [tool.bumpver] current_version = "0.2025.0" diff --git a/scripts/pull.sh b/scripts/pull.sh new file mode 100644 index 00000000..cee35a5c --- /dev/null +++ b/scripts/pull.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# This script updates each repo against a remote +# (It also updates the amech-dev repo.) +# +# Performs a pull --rebase +# +# Arguments: +# - Remote to update against (default: upstream) +# - Branch to update (default: dev) + +set -e # if any command fails, quit +REPOS=("autochem" "autoio" "autofile" "mechanalyzer" "mechdriver") + +# 0. Read arguments +REMOTE=${1:-upstream} +BRANCH=${2:-dev} + +echo "The following commands will be run in each repository:" +echo " git checkout ${BRANCH}" +echo " git pull --rebase ${REMOTE} ${BRANCH}" +read -p "Is this what you want to do? [y/n] " yn + +if [[ $yn =~ ^[Yy]$ ]]; then + # 1. Navigate to mechdriver parent directory + ( + cd .. + + # 2. Loop through each repo and update + for repo in ${REPOS[@]} + do + printf "\n*** Updating in $(realpath ${repo}) ***\n" + ( + cd ${repo} && \ + git checkout ${BRANCH} && \ + git pull --rebase ${REMOTE} ${BRANCH} + ) + printf "******\n" + done + ) +fi \ No newline at end of file diff --git a/scripts/update.sh b/scripts/update.sh index cee35a5c..fe8fbc2b 100644 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -10,32 +10,16 @@ # - Branch to update (default: dev) set -e # if any command fails, quit -REPOS=("autochem" "autoio" "autofile" "mechanalyzer" "mechdriver") +REPOS=("autochem" "autoio" "autofile" "mechanalyzer") -# 0. Read arguments -REMOTE=${1:-upstream} -BRANCH=${2:-dev} +# 1. Loop through each repo and update +for repo in ${REPOS[@]} +do + version=$(pixi run --manifest-path ../$repo current-version) + echo Setting $repo version to $version + sed -i -E "s/($repo *= *\"==)[0-9]+\.[0-9]+\.[0-9]+(\" *)/\1${version}\2/" pyproject.toml +done -echo "The following commands will be run in each repository:" -echo " git checkout ${BRANCH}" -echo " git pull --rebase ${REMOTE} ${BRANCH}" -read -p "Is this what you want to do? [y/n] " yn - -if [[ $yn =~ ^[Yy]$ ]]; then - # 1. Navigate to mechdriver parent directory - ( - cd .. - - # 2. Loop through each repo and update - for repo in ${REPOS[@]} - do - printf "\n*** Updating in $(realpath ${repo}) ***\n" - ( - cd ${repo} && \ - git checkout ${BRANCH} && \ - git pull --rebase ${REMOTE} ${BRANCH} - ) - printf "******\n" - done - ) -fi \ No newline at end of file +# 2. Update lockfile +echo Updating lockfile +pixi lock \ No newline at end of file diff --git a/tests/archive.tgz b/tests/archive.tgz index 19b2991b..5b4f5477 100644 Binary files a/tests/archive.tgz and b/tests/archive.tgz differ