diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 09c28380..c8b05249 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,9 +16,9 @@ jobs: - macos - windows python-version: - - "8" - "9" - "10" + - "11" include: - os: ubuntu platform: linux diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 41c52e6e..1a20d5d0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 }} diff --git a/docs/src/developers.md b/docs/src/developers.md index 8bacb111..956e8f76 100644 --- a/docs/src/developers.md +++ b/docs/src/developers.md @@ -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. \ No newline at end of file +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 + ``` diff --git a/pyproject.toml b/pyproject.toml index e1696c98..ddbe6059 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/rust/fastsim-cli/Cargo.toml b/rust/fastsim-cli/Cargo.toml index 79043bd4..fa728f63 100644 --- a/rust/fastsim-cli/Cargo.toml +++ b/rust/fastsim-cli/Cargo.toml @@ -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" diff --git a/rust/fastsim-core/Cargo.toml b/rust/fastsim-core/Cargo.toml index 5293fc30..16fc23c4 100644 --- a/rust/fastsim-core/Cargo.toml +++ b/rust/fastsim-core/Cargo.toml @@ -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" @@ -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", diff --git a/rust/fastsim-core/fastsim-proc-macros/Cargo.toml b/rust/fastsim-core/fastsim-proc-macros/Cargo.toml index 085fd1b8..47e69b7b 100644 --- a/rust/fastsim-core/fastsim-proc-macros/Cargo.toml +++ b/rust/fastsim-core/fastsim-proc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["NREL/MTES/CIMS/MBAP Group "] name = "fastsim-proc-macros" -version = "0.1.7" +version = "0.1.9" edition = "2021" license = "Apache-2.0" readme = "../../../README.md" diff --git a/rust/fastsim-core/src/simdrivelabel.rs b/rust/fastsim-core/src/simdrivelabel.rs index ea019e04..b7804c46 100644 --- a/rust/fastsim-core/src/simdrivelabel.rs +++ b/rust/fastsim-core/src/simdrivelabel.rs @@ -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, diff --git a/rust/fastsim-core/src/vehicle_import.rs b/rust/fastsim-core/src/vehicle_import.rs index 18d907b0..711bc0fe 100644 --- a/rust/fastsim-core/src/vehicle_import.rs +++ b/rust/fastsim-core/src/vehicle_import.rs @@ -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: @@ -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, @@ -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 /// @@ -1316,14 +1316,14 @@ fn load_fegov_data_for_given_years>( 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, diff --git a/rust/fastsim-core/src/vehicle_utils.rs b/rust/fastsim-core/src/vehicle_utils.rs index ad3615c2..ae084b1b 100644 --- a/rust/fastsim-core/src/vehicle_utils.rs +++ b/rust/fastsim-core/src/vehicle_utils.rs @@ -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, @@ -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, diff --git a/rust/fastsim-py/Cargo.toml b/rust/fastsim-py/Cargo.toml index 74d553f3..9829e7d4 100644 --- a/rust/fastsim-py/Cargo.toml +++ b/rust/fastsim-py/Cargo.toml @@ -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"