Skip to content

Commit

Permalink
chore: switch project to Rye
Browse files Browse the repository at this point in the history
  • Loading branch information
koehlma committed Jul 29, 2024
1 parent c9f739f commit 973c1a9
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 2,749 deletions.
4 changes: 0 additions & 4 deletions .devcontainer/Dockerfile

This file was deleted.

59 changes: 0 additions & 59 deletions .devcontainer/devcontainer.json

This file was deleted.

202 changes: 71 additions & 131 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,141 +3,81 @@ name: Pipeline
on: [push, pull_request, workflow_dispatch]

jobs:
lint_black:
name: Lint (black)
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Black
- name: Install Rye
run: |
pip install black
- name: Run Black
run: |
black --check --diff momba tests
lint_flake8:
name: Lint (flake8)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Flake8
run: |
pip install flake8 flake8-bugbear pep8-naming
- name: Run Flake8
run: |
flake8 momba tests
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install Poetry and Maturin
run: |
pip install poetry maturin
- name: Build Momba
run: |
mkdir artifacts
poetry build
mv dist/* artifacts
- name: Export development requirements
run: |
poetry export --without-hashes --extras all --dev -f requirements.txt --output artifacts/dev-requirements.txt
- name: Build Engine
run: |
cd engine
maturin build --manylinux=off --out ../artifacts -i $(which python)
- uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts
curl -sSf https://rye.astral.sh/get | bash
- run: |
rye fmt --all --check
rye lint --all
rye run check-types
test:
name: Tests
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: artifacts
path: artifacts
- name: Install packages
run: |
pip install -r artifacts/dev-requirements.txt
pip install --ignore-installed artifacts/*.whl
- name: Run tests
run: |
pytest tests
# test:
# name: Tests
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Install Rye
# run: |
# curl -sSf https://rye.astral.sh/get | bash
# - run: |
# rye run run-tests

type_check:
name: Type Check
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: artifacts
path: artifacts
- name: Install packages
run: |
pip install -r artifacts/dev-requirements.txt
pip install --ignore-installed artifacts/*.whl
- name: Run MypPy
run: |
mypy momba
# type_check:
# name: Type Check
# needs: [build]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python 3.10
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# name: artifacts
# path: artifacts
# - name: Install packages
# run: |
# pip install -r artifacts/dev-requirements.txt
# pip install --ignore-installed artifacts/*.whl
# - name: Run MypPy
# run: |
# mypy momba

documentation:
name: Documentation
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: artifacts
path: artifacts
- name: Install packages
run: |
pip install -r artifacts/dev-requirements.txt
pip install --ignore-installed artifacts/*.whl
- name: Build documentation
run: |
sphinx-build -b dirhtml docs build/docs
- name: Create CNAME file
run: |
echo "momba.dev" > build/docs/CNAME
- name: Deploy documentation
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/docs
# documentation:
# name: Documentation
# needs: [build]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Set up Python 3.10
# uses: actions/setup-python@v2
# with:
# python-version: "3.10"
# - name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# name: artifacts
# path: artifacts
# - name: Install packages
# run: |
# pip install -r artifacts/dev-requirements.txt
# pip install --ignore-installed artifacts/*.whl
# - name: Build documentation
# run: |
# sphinx-build -b dirhtml docs build/docs
# - name: Create CNAME file
# run: |
# echo "momba.dev" > build/docs/CNAME
# - name: Deploy documentation
# if: github.ref == 'refs/heads/main'
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./build/docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ docs/_build

.mypy_cache
.pytest_cache
.ruff_cache

.ipynb_checkpoints

Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import sys
import subprocess
import re
import subprocess

from pygments.lexer import RegexLexer
from pygments import token
Expand Down Expand Up @@ -130,7 +129,7 @@ class BNFLexer(RegexLexer): # type:ignore
"path_to_docs": "docs/",
"logo_only": True,
"extra_footer": EXTRA_FOOTER,
"extra_navbar" : "",
"extra_navbar": "",
"use_repository_button": True,
"use_issues_button": True,
}
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Welcome to Momba's documentation!
=================================

[![PyPi Package](https://img.shields.io/pypi/v/momba.svg?label=latest%20version)](https://pypi.python.org/pypi/momba)
[![Tests](https://img.shields.io/github/workflow/status/koehlma/momba/Pipeline?label=tests)](https://github.com/koehlma/momba/actions)
[![Tests](https://img.shields.io/github/actions/workflow/status/koehlma/momba/pipeline.yml?branch=main&label=tests)](https://github.com/koehlma/momba/actions)
[![Docs](https://img.shields.io/static/v1?label=docs&message=master&color=blue)](https://koehlma.github.io/momba/)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Gitter](https://badges.gitter.im/koehlma/momba.svg)](https://gitter.im/koehlma/momba?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Expand Down
4 changes: 2 additions & 2 deletions engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ hashbrown = "*"

[dependencies.pyo3]
version = "0.17"
# Minimal Python version is `3.8`.
features = ["extension-module", "abi3-py38"]
# Minimal Python version is `3.9`.
features = ["extension-module", "abi3-py39"]
23 changes: 21 additions & 2 deletions engine/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
[project]
name = "momba_engine"
version = "0.6.10"
description = "Momba's state space exploration engine."
authors = [
{ name = "Maximilian Köhl", email = "koehl@cs.uni-saarland.de" }
]
dependencies = []
requires-python = ">= 3.8"

[build-system]
requires = ["maturin>=0.14,<0.15"]
build-backend = "maturin"
requires = ["maturin>=1.2,<2.0"]
build-backend = "maturin"

[tool.rye]
managed = true
dev-dependencies = []

[tool.maturin]
python-source = "python"
module-name = "momba_engine"
features = ["pyo3/extension-module"]
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def analyze(output_dir: pathlib.Path, exclude_fault_runs: bool) -> None:

for fault_sporadic in results.keys():
print(fault_sporadic)
for (length, value) in sorted(results[fault_sporadic].items()):
for length, value in sorted(results[fault_sporadic].items()):
print(f"({length},{value})")


Expand Down
2 changes: 1 addition & 1 deletion examples/racetrack/racetrack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from . import model, tracks

from . import _ipython # noqa:
from . import _ipython # noqa: F401


__all__ = ["model", "tracks"]
4 changes: 3 additions & 1 deletion examples/racetrack_seed.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import random


import racetrack

from momba import engine
Expand All @@ -18,7 +21,6 @@

print(transition.instances)

import random

random.seed(0)

Expand Down
11 changes: 2 additions & 9 deletions momba/engine/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,8 @@ def parse_constants(cmd_input: str) -> t.Any:
elif is_float(l.split("=")[1]):
data[idx] = float(l.split("=")[1])
elif (l.split("=")[1]).lower() in ("false", "true"):
match l.split("=")[1]:
case "False":
data[idx] = False
case "false":
data[idx] = False
case "True":
data[idx] = True
case "true":
data[idx] = True
value = l.split("=")[1]
data[idx] = value == "True" or value == "true"
return data


Expand Down
Loading

0 comments on commit 973c1a9

Please sign in to comment.