Skip to content

Commit

Permalink
Merge pull request #178 from NREL/fastsim-2.1.4
Browse files Browse the repository at this point in the history
Fastsim 2.1.4
  • Loading branch information
calbaker authored Jan 3, 2025
2 parents 91c4460 + bcdaad7 commit 0d7b5f3
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
- macos
- windows
python-version:
- "8"
- "9"
- "10"
- "11"
include:
- os: ubuntu
platform: linux
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11']

env:
PYTHON: ${{ matrix.python-version }}
Expand Down
61 changes: 60 additions & 1 deletion docs/src/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,63 @@
`cargo test` should compile when run in /rust because there are no tests in `/rust/fastsim-py`.

## build_and_test.sh
Running `sh build_and_test.sh` from the root fastsim directory compile/tests the Rust code, and tests the Python code. It should compile without errors.
Running `sh build_and_test.sh` from the root fastsim directory compile/tests the Rust code, and tests the Python code. It should compile without errors.


# Releasing
## Incrementing the Version Number
Increment the 3rd decimal place in the version number for small changes (e.g.
minor bug fixes, new variables), the 2nd for medium changes (e.g. new methods
or classes), and the 1st for large changes (e.g. changes to the interface that
might affect backwards compatibility / the API interface).

## Instructions
1. Create and check out a new branch, e.g. for version X.X.X:
```
git checkout -b fastsim-X.X.X
```
1. Update the version number in the `pyproject.toml` file
1. If changes have happened in `rust/`, increment the Rust crate version numbers in `rust/fastsim-core/Cargo.toml` and `rust/fastsim-core/fastsim-proc-macros/Cargo.toml`
1. Commit changes, as appropriate:
```
git add pyproject.toml README.md rust/fastsim-core/Cargo.toml rust/fastsim-core/fastsim-proc-macros/Cargo.toml
```
```
git commit -m "vX.X.X"
```
1. Tag the commit with the new version number, prepended with a `v`:
```
git tag vX.X.X
```
Or, optionally, you can also add a tag message with the `-m` flag, for example:
```
git tag vX.X.X -m "release version X.X.X"
```
1. Push the commit to the GitHub.com repository (for Git remote setup instructions, see [this page](https://github.nrel.gov/MBAP/fastsim/wiki/Setting-up-FASTSim-Git-remotes-for-development)):
```
git push -u external fastsim-X.X.X
```
1. Push the tag:
```
git push external vX.X.X
```
This will start the `wheels.yaml` GitHub Actions workflow and run all tests
1. Create a PR for the new version in the external repository, using the `release` label for organization
1. When all tests pass, and a review has been completed, merge the PR
1. If changes were made in `rust/`, publish the crates (you must be listed as an owner of both crates on crates.io):
If necessary, log into crates.io first after adding and verifying your email at https://crates.io/settings/profile:
```sh
cargo login
```
Then, run these commands to update the crates (order matters):
```sh
(cd rust/fastsim-core/fastsim-proc-macros && cargo publish)
(cd rust/fastsim-core && cargo publish)
```
1. Start a new release at /~https://github.com/NREL/fastsim/releases/new, selecting `vX.X.X` as both the tag and the release name. Click "Generate release notes" to automatically create a detailed change log.
1. Click "Publish release". Wheels will then be built for various platforms and automatically uploaded to the PyPI at https://pypi.org/project/fastsim/. **Check that the release workflow finished properly at /~https://github.com/NREL/fastsim/actions/workflows/release.yaml!**
1. Synchronize changes to the internal GitHub repository:
```
git pull external fastsim-2
git push origin fastsim-2
```
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ build-backend = "maturin"

[project]
name = "fastsim"
version = "2.1.3"
version = "2.1.4"
authors = [{ name = "NREL/MTES/CIMS/MBAP Group", email = "fastsim@nrel.gov" }]
description = "Tool for modeling vehicle powertrains"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.8,<3.11"
requires-python = ">=3.9,<3.12"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
Expand Down
2 changes: 1 addition & 1 deletion rust/fastsim-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fastsim-cli"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
rust-version.workspace = true
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions rust/fastsim-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fastsim-core"
version = "0.1.7"
version = "0.1.9"
edition = "2021"
rust-version.workspace = true
license = "Apache-2.0"
Expand All @@ -11,7 +11,7 @@ readme = "../../README.md"
repository = "/~https://github.com/NREL/fastsim"

[dependencies]
fastsim-proc-macros = { package = "fastsim-proc-macros", path = "./fastsim-proc-macros", version = "0.1.5" }
fastsim-proc-macros = { package = "fastsim-proc-macros", path = "./fastsim-proc-macros", version = "0.1.9" }
pyo3 = { workspace = true, features = [
"extension-module",
"anyhow",
Expand Down
2 changes: 1 addition & 1 deletion rust/fastsim-core/fastsim-proc-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["NREL/MTES/CIMS/MBAP Group <fastsim@nrel.gov>"]
name = "fastsim-proc-macros"
version = "0.1.7"
version = "0.1.9"
edition = "2021"
license = "Apache-2.0"
readme = "../../../README.md"
Expand Down
2 changes: 1 addition & 1 deletion rust/fastsim-core/src/simdrivelabel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub fn get_label_fe(

#[cfg(feature = "pyo3")]
#[pyfunction(name = "get_label_fe")]
#[pyo3(signature = (veh, full_detail=None, verbose=None))]
#[cfg_attr(feature = "pyo3", pyo3(signature = (veh, full_detail=None, verbose=None)))]
/// pyo3 version of [get_label_fe]
pub fn get_label_fe_py(
veh: &vehicle::RustVehicle,
Expand Down
16 changes: 8 additions & 8 deletions rust/fastsim-core/src/vehicle_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ pub struct VehicleDataEPA {
impl SerdeAPI for VehicleDataEPA {}

#[cfg_attr(feature = "pyo3", pyfunction)]
#[pyo3(signature = (
#[cfg_attr(feature = "pyo3", pyo3(signature = (
year,
make,
model,
cache_url=None,
data_dir=None,
))]
)))]
/// Gets options from fueleconomy.gov for the given vehicle year, make, and model
///
/// Arguments:
Expand Down Expand Up @@ -342,12 +342,12 @@ pub fn get_options_for_year_make_model(
}

#[cfg_attr(feature = "pyo3", pyfunction)]
#[pyo3(signature = (
#[cfg_attr(feature = "pyo3", pyo3(signature = (
id,
year,
cache_url=None,
data_dir=None,
))]
)))]
pub fn get_vehicle_data_for_id(
id: i32,
year: &str,
Expand Down Expand Up @@ -775,13 +775,13 @@ pub struct OtherVehicleInputs {
impl SerdeAPI for OtherVehicleInputs {}

#[cfg_attr(feature = "pyo3", pyfunction)]
#[pyo3(signature = (
#[cfg_attr(feature = "pyo3", pyo3(signature = (
vehicle_id,
year,
other_inputs,
cache_url=None,
data_dir=None,
))]
)))]
/// Creates RustVehicle for the given vehicle using data from fueleconomy.gov and EPA databases
/// The created RustVehicle is also written as a yaml file
///
Expand Down Expand Up @@ -1316,14 +1316,14 @@ fn load_fegov_data_for_given_years<P: AsRef<Path>>(
Ok(data)
}
#[cfg_attr(feature = "pyo3", pyfunction)]
#[pyo3(signature = (
#[cfg_attr(feature = "pyo3", pyo3(signature = (
year,
make,
model,
other_inputs,
cache_url=None,
data_dir=None,
))]
)))]
/// Import All Vehicles for the given Year, Make, and Model and supplied other inputs
pub fn import_all_vehicles(
year: u32,
Expand Down
4 changes: 2 additions & 2 deletions rust/fastsim-core/src/vehicle_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub const NETWORK_TEST_DISABLE_ENV_VAR_NAME: &str = "FASTSIM_DISABLE_NETWORK_TES
#[cfg_attr(feature = "pyo3", pyfunction)]
#[allow(clippy::too_many_arguments)]
#[cfg(feature = "default")]
#[pyo3(signature = (
#[cfg_attr(feature = "pyo3", pyo3(signature = (
veh,
a_lbf,
b_lbf__mph,
Expand All @@ -37,7 +37,7 @@ pub const NETWORK_TEST_DISABLE_ENV_VAR_NAME: &str = "FASTSIM_DISABLE_NETWORK_TES
custom_rho_elevation_m=None,
simdrive_optimize=None,
_show_plots=None,
))]
)))]
pub fn abc_to_drag_coeffs(
veh: &mut RustVehicle,
a_lbf: f64,
Expand Down
2 changes: 1 addition & 1 deletion rust/fastsim-py/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fastsim-py"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
rust-version.workspace = true
license = "Apache-2.0"
Expand Down

0 comments on commit 0d7b5f3

Please sign in to comment.