Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FASTSim 2.1.0 #29

Merged
merged 5 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 40 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: wheels
name: release

on:
push:
tags:
# 'r[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. r2.0.8
- "r[0-9]+.[0-9]+.[0-9]+"
# 'v[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. v2.0.8
- "v[0-9]+.[0-9]+.[0-9]+"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


jobs:
build:
name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os:
- ubuntu
Expand All @@ -30,11 +30,6 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: set up rust
if: matrix.os != 'ubuntu'
uses: actions-rs/toolchain@v1
Expand All @@ -54,22 +49,29 @@ jobs:
override: true
- run: cd rust/ && cargo test

- name: install python dependencies
run: pip install -U setuptools wheel twine cibuildwheel plotly
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: build sdist
if: matrix.os == 'ubuntu' && matrix.python-version == '8'
- name: install Python dependencies
run: pip install -U setuptools wheel twine cibuildwheel pytest

- name: build source distribution
if: matrix.os == 'ubuntu' && matrix.python-version == '10'
run: |
pip install -U setuptools-rust
python setup.py sdist
python -c "import setuptools; setuptools.setup()" sdist

- name: build ${{ matrix.platform || matrix.os }} binaries
run: cibuildwheel --output-dir dist
env:
CIBW_BUILD: "cp3${{ matrix.python-version }}-*"
CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64"
CIBW_PLATFORM: ${{ matrix.platform || matrix.os }}
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests"
# TODO: why doesn't pytest work with cibuildwheel?
# CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests"
CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests"
CIBW_ARCHS_MACOS: 'universal2'
# see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2
CIBW_TEST_SKIP: '*_universal2:arm64'
Expand All @@ -85,6 +87,7 @@ jobs:
pip install -U setuptools-rust &&
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
rustup show

# - name: build windows 32bit binaries
# if: matrix.os == 'windows'
# run: cibuildwheel --output-dir dist
Expand All @@ -100,18 +103,33 @@ jobs:
# rustup default nightly-i686-pc-windows-msvc &&
# rustup override set nightly-i686-pc-windows-msvc &&
# rustup show

- name: list dist files
run: ${{ matrix.ls || 'ls -lh' }} dist/

- uses: actions/upload-artifact@v3
with:
path: ./dist/*

- name: twine check
run: twine check dist/*

- name: upload to pypi
run: twine upload dist/*
release:
needs: build
name: release files to PyPI
runs-on: ubuntu-latest
steps:
- name: download files
uses: actions/download-artifact@v2.1.1

- name: set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- run: pip install twine

- run: twine check ./artifact/*

- name: upload files
run: twine upload ./artifact/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.fastsim_pypi_token }}
TWINE_PASSWORD: ${{ secrets.fastsim_pypi_token }}
38 changes: 20 additions & 18 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: wheels

on:
push:
tags:
# 'v[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. v2.0.8
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

jobs:
build:
name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os:
- ubuntu
Expand All @@ -30,18 +27,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: set up rust
if: matrix.os != 'ubuntu'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- run: rustup target add aarch64-apple-darwin
if: matrix.os == 'macos'

Expand All @@ -53,22 +46,29 @@ jobs:
override: true
- run: cd rust/ && cargo test

- name: install python dependencies
run: pip install -U setuptools wheel twine cibuildwheel plotly
- name: set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install Python dependencies
run: pip install -U setuptools wheel twine cibuildwheel pytest

- name: build sdist
if: matrix.os == 'ubuntu' && matrix.python-version == '8'
- name: build source distribution
if: matrix.os == 'ubuntu' && matrix.python-version == '10'
run: |
pip install -U setuptools-rust
python setup.py sdist
python -c "import setuptools; setuptools.setup()" sdist

- name: build ${{ matrix.platform || matrix.os }} binaries
run: cibuildwheel --output-dir dist
env:
CIBW_BUILD: "cp3${{ matrix.python-version }}-*"
CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64"
CIBW_PLATFORM: ${{ matrix.platform || matrix.os }}
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests"
# TODO: why doesn't pytest work with cibuildwheel?
# CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests"
CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests"
CIBW_ARCHS_MACOS: 'universal2'
# see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2
CIBW_TEST_SKIP: '*_universal2:arm64'
Expand All @@ -84,6 +84,7 @@ jobs:
pip install -U setuptools-rust &&
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
rustup show

# - name: build windows 32bit binaries
# if: matrix.os == 'windows'
# run: cibuildwheel --output-dir dist
Expand All @@ -99,9 +100,10 @@ jobs:
# rustup default nightly-i686-pc-windows-msvc &&
# rustup override set nightly-i686-pc-windows-msvc &&
# rustup show

- name: list dist files
run: ${{ matrix.ls || 'ls -lh' }} dist/

- uses: actions/upload-artifact@v3
with:
path: ./dist/*
path: ./dist/*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ out = component output
Rust versions of classes have limited Language Server Protocol integration, and we are actively working on fixing this.

# Release Notes
2.1.0 -- release and installation improvements, RustVehicle init cleanup, calibration improvements
2.0.11 - 2.0.22 -- PyPI fixes. Also, Rust version is now >100x faster than Python version.
2.0.10 -- logging fixes, proc macro reorganization, some CAVs performance fixes
2.0.9 -- support for mac ARM/RISC architecture
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "fastsim"
version = "2.0.22"
version = "2.1.0"
authors = [{ name = "NREL/MTES/CIMS/MBAP Group", email = "fastsim@nrel.gov" }]
description = "Tool for modeling vehicle powertrains"
readme = "README.md"
Expand All @@ -21,16 +21,18 @@ dependencies = [
"pandas>=1",
"matplotlib>=3.3",
"numpy>=1.18",
"scipy",
"seaborn>=0.10",
"typing_extensions",
"pyyaml",
"pytest",
]

[project.urls]
Homepage = "https://www.nrel.gov/transportation/fastsim.html"

[project.optional-dependencies]
dev = ["black", "pytest", "maturin", "plotly", "ipykernel", "pymoo==0.6.0.1",]
dev = ["black", "maturin", "plotly", "ipykernel", "pymoo==0.6.0.1",]

[tool.setuptools]
zip-safe = false
Expand Down