Skip to content

Commit 96d7ab9

Browse files
authored
Merge pull request #60 from NREL/feature/workspace-dependency-cleanup
cleaned up workspace dependency structure
2 parents 426f50e + 91789aa commit 96d7ab9

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed

docs/src/developers.md

+26-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Clone the repository:
1212
1. Open git bash, and inside the directory you created,
1313
[clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
1414
the [ALTRIOS repository](https://github.com/NREL/ALTRIOS) with e.g. `git clone
15-
https://github.com/NREL/ALTRIOS.git`.
15+
https://github.com/NREL/ALTRIOS.git`.
1616

1717
## Installing the Python Package
1818

@@ -65,52 +65,63 @@ tests pass. Also, be sure to rebuild the Python API regularly to ensure that it
6565
Python unit tests run with `python -m unittest discover` in the root folder of the git repository.
6666

6767
### With GitHub Actions
68+
6869
Any time anyone pushes to `main` or does any pull request, the [GitHub Actions test
69-
workflows](https://github.com/NREL/altrios/tree/main/.github/workflows) are triggered.
70+
workflows](https://github.com/NREL/altrios/tree/main/.github/workflows) are triggered.
7071

7172
## Releasing
7273

7374
### To PyPI With GitHub Actions
75+
7476
To release the package with GitHub Actions, you can follow these steps:
7577

7678
1. Create a new branch in the format `v<major>.<minor>.<patch>`, for example `v0.2.1`.
77-
1. Update the version number in the `pyproject.toml` file. Commit and push to
78-
https://github.com/NREL/altrios.
79+
1. Update the version number in the `pyproject.toml` file. Commit and push to
80+
https://github.com/NREL/altrios.
7981
1. Open a pull request into the main branch and make sure all checks pass.
8082
1. Once the pull request is merged into the main branch by a reviewer, create a new GitHub release
8183
and create a tag that matches the branch name. Once the release is created, a [GitHub
8284
action](https://github.com/NREL/altrios/blob/686e8c28828cb980cc45567d08091e69b7bee52c/.github/workflows/wheels.yaml#L5)
83-
will be launched to build the wheels and publish them to PyPI.
85+
will be launched to build the wheels and publish them to PyPI.
8486

8587
### To crates.io
88+
8689
#### altrios-core
90+
8791
If you've updated `altrios-proc-macros`, be sure to publish that crate first and then update the
88-
Cargo.toml dependency for this crate.
92+
Cargo.toml dependency for this crate.
93+
94+
To release this crate, you need to be setup as developer for this crate in crates.io. Follow these steps:
8995

90-
To release this crate, you need to be setup as developer for this crate in crates.io. Follow these steps:
9196
1. Increment the version number in
92-
[rust/altrios-core/Cargo.toml](https://github.com/NREL/altrios/blob/main/rust/altrios-core/Cargo.toml).
97+
[rust/altrios-core/Cargo.toml](https://github.com/NREL/altrios/blob/426f50e4ebd0fbf1d7e346aa31604107df8f83fe/rust/altrios-core/Cargo.toml#L8):
98+
99+
`version = "0.2.1"`.
93100
1. If changes were made in `altrios-proc-macros`, follow [the release process for that
94101
crate](#altrios-proc-macros) first, and then update the `altrios-proc-macros` dependency version
95-
to match the new `altrios-proc-macros` version in `rust/altrios-core/Cargo.toml`.
102+
to match the new `altrios-proc-macros` version in `rust/altrios-core/Cargo.toml`.
96103
1. Run `git tag ac<major>.<minor>.<patch>`, where `ac<major>.<minor>.<patch>` should look like
97104
`ac0.1.4`, reflecting whatever the current version is.
98105
1. Push the tag with `git push public ac<major>.<minor>.<patch>`, where `public` is this remote:
99106
`[email protected]:NREL/altrios.git`.
100107
1. Run `cargo publish --dry-run` to make sure everything checks.
101-
1. Run `cargo publish` to release the update.
108+
1. Run `cargo publish` to release the update.
102109

103-
In the future, we may incorporate this into GitHub Actions.
110+
In the future, we may incorporate this into GitHub Actions.
104111

105112
#### altrios-proc-macros
106-
To release this crate, you need to be setup as developer for this crate in crates.io. Follow these steps:
113+
114+
To release this crate, you need to be setup as developer for this crate in crates.io. Follow these steps:
115+
107116
1. Increment the version number in
108-
[rust/altrios-core/altrios-proc-macros/Cargo.toml](https://github.com/NREL/altrios/blob/main/rust/altrios-core/altrios-proc-macros/Cargo.toml).
117+
[rust/Cargo.toml](https://github.com/NREL/altrios/blob/dced44b42c456da88363d03dc43259b039a94e6d/rust/Cargo.toml#L48):
118+
119+
`altrios-proc-macros = { path = "./altrios-core/altrios-proc-macros", version = "0.2.0" }`.
109120
1. Run `git tag apm<major>.<minor>.<patch>`, where `apm<major>.<minor>.<patch>` should look like
110121
`apm0.1.4`, reflecting whatever the current version is.
111122
1. Push the tag with `git push public apm<major>.<minor>.<patch>`, where `public` is this remote:
112123
`[email protected]:NREL/altrios.git`.
113124
1. Run `cargo publish --dry-run` to make sure everything checks.
114-
1. Run `cargo publish` to release the update.
125+
1. Run `cargo publish` to release the update.
115126

116-
In the future, we may incorporate this into GitHub Actions.
127+
In the future, we may incorporate this into GitHub Actions.

rust/Cargo.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[workspace]
22
members = [
3-
"altrios-core", # pure rust core with optional pyo3 feature
4-
"altrios-py", # python module exposing altrios-core
3+
"altrios-core", # pure rust core with optional pyo3 feature
4+
"altrios-core/altrios-proc-macros", # proc macros for altrios-core
5+
"altrios-py", # python module exposing altrios-core
56
]
67
resolver = "2"
78

@@ -41,3 +42,7 @@ polars-lazy = { version = "0.32" }
4142
pyo3-polars = { version = "0.6" }
4243
uom = { version = "0.35.0", features = ["use_serde"] }
4344
eng_fmt = "0.1.2"
45+
46+
# local crates in this workspace
47+
altrios-core = { path = "./altrios-core" }
48+
altrios-proc-macros = { path = "./altrios-core/altrios-proc-macros", version = "0.2.0" }

rust/altrios-core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ serde_json = "1.0"
1717
uom = { workspace = true }
1818
paste = "1.0.7"
1919
easy-ext = "1.0.0"
20-
altrios-proc-macros = { version = "0.2.0", path = "altrios-proc-macros" }
20+
altrios-proc-macros = { workspace = true }
2121
argmin = "0.5.1"
2222
rayon = "1.5.3"
2323
bincode = "1.3.3"

rust/altrios-py/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ version = "0.1.0"
1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

1212
[dependencies]
13-
altrios-core = { path = "../altrios-core", features = ["pyo3"] }
13+
altrios-core = { workspace = true, features = ["pyo3"] }
1414
pyo3 = { workspace = true, features = ["extension-module", "anyhow"] }
1515
pyo3-log = { workspace = true }
1616
polars = { workspace = true }

0 commit comments

Comments
 (0)