Skip to content

Commit 262e76b

Browse files
authored
Merge pull request Auto-Mech#603 from avcopan/dev
Adds Pixi task to update dependency version numbers
2 parents 02e2aef + cf19c04 commit 262e76b

File tree

6 files changed

+92
-43
lines changed

6 files changed

+92
-43
lines changed

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ running the following command inside it.
8787
pixi run --frozen dev-setup
8888
```
8989
Follow the prompts to configure the set-up to your liking.
90+
Among other configurations, this set-up clones the other Auto-Mech repositories
91+
into the parent directory of your mechdriver repository.
92+
```
93+
ls ..
94+
autochem autofile autoio mechanalyzer mechdriver
95+
```
9096
If you run into issues, see [Appendix C](#appendix-c-manual-developer-setup) for
9197
manual set-up instructions.
9298
@@ -107,6 +113,22 @@ For more information on activating Pixi environments, see
107113
You can then run any of the examples [in the `examples/` directory](./examples/)
108114
as [described above](#run).
109115
116+
### Git Helper Tasks
117+
118+
The following Pixi tasks are available to facilitate Git operations with your
119+
five local Auto-Mech repositories:
120+
121+
1. `pixi run pull`. This does a `git pull --rebase upstream dev` on all five
122+
repositories to update them against the central Auto-Mech upstream.
123+
2. `pixi run git <commands>`. This runs whatever `git` commands you pass it in
124+
all five repositories.
125+
126+
For example, a common operation you might wish to do is:
127+
```
128+
pixi run pull # Rebase each repo against upstream
129+
pixi run git push origin dev # Push each repo to origin
130+
```
131+
110132
### Test
111133
112134
> [!TIP]
@@ -178,7 +200,7 @@ override the commit hash check on GitHub Actions and allow your tests to pass.
178200
179201
> [!WARNING]
180202
> Versions are now automatically handled by the BumpVer versioning tool.
181-
> Therefore, do not manually change the version of a given package in its
203+
> Therefore, **do not** manually change the version of a given package in its
182204
> `pyproject.toml`. Instead, the version will be automatically updated by
183205
> triggering the release workflow as described below.
184206
@@ -195,22 +217,23 @@ This will (1.) bump the version number, (2.) publish the conda package to the
195217
[`auto-mech` channel](https://anaconda.org/Auto-Mech/), and (3.) create an
196218
associated GitHub release.
197219
198-
For now, if you have updated the conda package for a lower-level module such as
199-
`autoio` and want these changes to take effect in MechDriver, you will also need
200-
to update the following two tables in the MechDriver `pyproject.toml`.
220+
If you have done this for one or more of the lower-level repositories, you will
221+
also need to update the MechDriver `pyproject.toml` file with their new version
222+
numbers.
223+
You can do so as follows:
201224
```
202-
[tool.pixi.package.run-dependencies]
203-
...
204-
autoio = "==<new version number>"
205-
206-
[tool.pixi.dependencies]
207-
...
208-
autoio = "==<new version number>"
225+
pixi run pull # Pull the release commits from upstream
226+
pixi run update # Update the version numbers in pyproject.toml
209227
```
210-
These two dependency tables **must match exactly** to ensure that the packaged
211-
version of the code matches the tested version.
228+
This will update the `package.run-dependencies` and `dependencies` tables in
229+
your `pyproject.toml` with the new version numbers of the lower-level
230+
repositories and update the lockfile.
231+
If you make any manual changes to these tables,
232+
**make sure that they match exactly**.
233+
This is necessary to ensure that the packaged version of the code matches the
234+
tested version.
212235
213-
## Subtask Parallelization
236+
## Experimental Feature: Subtask Parallelization
214237
215238
As an experimental feature in MechDriver, you can parallelize across subtasks in
216239
your workflow with

pixi.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ dev-setup-hq = { cmd = "./scripts/dev-setup-hq.sh", cwd = "." }
133133
dev-setup-config = { cmd = "./scripts/dev-setup-config.sh", cwd = "." }
134134
dev-setup = { depends-on = ["dev-setup-repos", "dev-setup-hq", "dev-setup-config"] }
135135
git = { cmd = "./scripts/git.sh", cwd = "." }
136-
update = { cmd = "./scripts/update.sh", cwd = "." }
136+
pull = { cmd = "./scripts/pull.sh", cwd = "." }
137137

138138
[tool.pixi.feature.test.tasks]
139139
test = { cmd = "./scripts/test.py" }
@@ -145,6 +145,7 @@ dev-test = { cmd = "./scripts/test.py" }
145145
[tool.pixi.feature.build.tasks]
146146
upload = "rattler-build upload anaconda -o Auto-Mech *.conda"
147147
current-version = "bumpver show -n | awk -F': ' '/Current Version: / {print $2}'"
148+
update = { cmd = "./scripts/update.sh", cwd = "." }
148149

149150
[tool.bumpver]
150151
current_version = "0.2025.0"

scripts/pull.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
# This script updates each repo against a remote
4+
# (It also updates the amech-dev repo.)
5+
#
6+
# Performs a pull --rebase
7+
#
8+
# Arguments:
9+
# - Remote to update against (default: upstream)
10+
# - Branch to update (default: dev)
11+
12+
set -e # if any command fails, quit
13+
REPOS=("autochem" "autoio" "autofile" "mechanalyzer" "mechdriver")
14+
15+
# 0. Read arguments
16+
REMOTE=${1:-upstream}
17+
BRANCH=${2:-dev}
18+
19+
echo "The following commands will be run in each repository:"
20+
echo " git checkout ${BRANCH}"
21+
echo " git pull --rebase ${REMOTE} ${BRANCH}"
22+
read -p "Is this what you want to do? [y/n] " yn
23+
24+
if [[ $yn =~ ^[Yy]$ ]]; then
25+
# 1. Navigate to mechdriver parent directory
26+
(
27+
cd ..
28+
29+
# 2. Loop through each repo and update
30+
for repo in ${REPOS[@]}
31+
do
32+
printf "\n*** Updating in $(realpath ${repo}) ***\n"
33+
(
34+
cd ${repo} && \
35+
git checkout ${BRANCH} && \
36+
git pull --rebase ${REMOTE} ${BRANCH}
37+
)
38+
printf "******\n"
39+
done
40+
)
41+
fi

scripts/update.sh

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,16 @@
1010
# - Branch to update (default: dev)
1111

1212
set -e # if any command fails, quit
13-
REPOS=("autochem" "autoio" "autofile" "mechanalyzer" "mechdriver")
13+
REPOS=("autochem" "autoio" "autofile" "mechanalyzer")
1414

15-
# 0. Read arguments
16-
REMOTE=${1:-upstream}
17-
BRANCH=${2:-dev}
15+
# 1. Loop through each repo and update
16+
for repo in ${REPOS[@]}
17+
do
18+
version=$(pixi run --manifest-path ../$repo current-version)
19+
echo Setting $repo version to $version
20+
sed -i -E "s/($repo *= *\"==)[0-9]+\.[0-9]+\.[0-9]+(\" *)/\1${version}\2/" pyproject.toml
21+
done
1822

19-
echo "The following commands will be run in each repository:"
20-
echo " git checkout ${BRANCH}"
21-
echo " git pull --rebase ${REMOTE} ${BRANCH}"
22-
read -p "Is this what you want to do? [y/n] " yn
23-
24-
if [[ $yn =~ ^[Yy]$ ]]; then
25-
# 1. Navigate to mechdriver parent directory
26-
(
27-
cd ..
28-
29-
# 2. Loop through each repo and update
30-
for repo in ${REPOS[@]}
31-
do
32-
printf "\n*** Updating in $(realpath ${repo}) ***\n"
33-
(
34-
cd ${repo} && \
35-
git checkout ${BRANCH} && \
36-
git pull --rebase ${REMOTE} ${BRANCH}
37-
)
38-
printf "******\n"
39-
done
40-
)
41-
fi
23+
# 2. Update lockfile
24+
echo Updating lockfile
25+
pixi lock

tests/archive.tgz

86 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)