-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve 3d visualisation * update base model init * add version bump + publish to CI * refactor model to use trampoline dispatch * Bump requests from 2.28.2 to 2.31.0 in /examples * custom timelines * doc updates * add docker release * make seeder optional
- Loading branch information
1 parent
e2afc44
commit 2d09162
Showing
86 changed files
with
853 additions
and
721 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
.github/workflows/pip-package.yml → .github/workflows/build-test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
name: Python coverage | ||
name: Code coverage | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: PyPI release | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
bump-version: | ||
name: Bump package version | ||
if: "!contains(github.event.head_commit.message, 'Bump version')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
- name: current_version | ||
run: echo "current_version=$(grep __version__ neworder/__init__.py | cut -d ' ' -d'"' -f2)" >> $GITHUB_ENV | ||
- name: bump2version-action | ||
uses: FragileTech/[email protected] | ||
with: | ||
current_version: "${{ env.current_version }}" | ||
files: neworder/__init__.py | ||
commit_name: Version autobump | ||
commit_email: [email protected] | ||
login: virgesmith | ||
token: "${{ secrets.REPO_PAT }}" | ||
# part defaults to patch | ||
part: minor | ||
- name: Create dist | ||
run: | | ||
pip install pybind11 numpy | ||
python setup.py sdist | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
repository-url: https://upload.pypi.org/legacy/ | ||
- name: new_version | ||
run: echo "new_version=$(grep __version__ neworder/__init__.py | cut -d ' ' -d'"' -f2)" >> $GITHUB_ENV | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PAT }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and push Docker images | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
${{ secrets.DOCKER_USER }}/neworder:${{ env.new_version }} | ||
${{ secrets.DOCKER_USER }}/neworder:latest | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,10 @@ examples/people_multi/data | |
*.egg-info/ | ||
junk | ||
dist/* | ||
stubs/ | ||
|
||
test-coverage/ | ||
.env | ||
# osmnx cache | ||
cache/ | ||
cache/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: 90% | ||
threshold: 1% # leeway | ||
patch: | ||
default: | ||
target: 80% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import neworder | ||
|
||
|
||
class AsymptoticTimeline(neworder.Timeline): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
self.t = 1.0 | ||
|
||
@property | ||
def start(self) -> float: | ||
return 0.0 | ||
|
||
@property | ||
def end(self) -> float: | ||
return 1.0 | ||
|
||
@property | ||
def nsteps(self) -> int: | ||
return -1 | ||
|
||
@property | ||
def time(self) -> float: | ||
return 1.0 - self.t | ||
|
||
@property | ||
def dt(self) -> float: | ||
return self.t / 2 | ||
|
||
def _next(self) -> None: | ||
self.t /= 2 | ||
|
||
@property | ||
def at_end(self) -> bool: | ||
return False | ||
|
||
|
||
class Model(neworder.Model): | ||
def __init__(self) -> None: | ||
super().__init__(AsymptoticTimeline()) | ||
|
||
def step(self) -> None: | ||
neworder.log(f"{self.timeline.index}: {self.timeline.time}") | ||
if self.timeline.time > 0.99: | ||
self.halt() | ||
|
||
neworder.run(Model()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
!!! note "Examples Source Code" | ||
Source code for all the examples can be downloaded using one of the the links below: | ||
The code for all the examples can be obtained by either: | ||
|
||
**[neworder-1.2.1-examples-src.tgz](./neworder-1.2.1-examples-src.tgz)** | **[neworder-1.2.1-examples-src.zip](./neworder-1.2.1-examples-src.zip)** | ||
- pulling the docker image `virgesmith/neworder:latest` (more [here](/#docker)), or | ||
- downloading the source code from the `neworder` [releases](https://github.com/virgesmith/neworder/releases) page | ||
|
||
The contained file `requirements.txt` lists the package dependencies of the examples, which can be installed using e.g.: | ||
|
||
```sh | ||
pip install -r requirements.txt | ||
``` | ||
If using the latter option, navigate to the `examples` subdirectory in the archive and install the dependencies required for the examples: `pip install -r requirements.txt` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.