26 Commits

Author SHA1 Message Date
tsunyoku 642491f410 attempt to fix macos builds with newer setup-python 2024-09-01 17:20:36 +01:00
Josh Smith c9f1a72dc8 Create CODEOWNERS 2024-06-15 19:30:50 -04:00
tsunyoku d4f712e826 bump akatsuki-pp 2024-06-01 00:43:47 +01:00
tsunyoku a8cd1bc89d bump akatsuki-pp 2024-05-31 23:07:09 +01:00
tsunyoku e5bd157c62 bump akatsuki-pp 2024-05-31 22:44:31 +01:00
James Wilson 63e32758c4 update pp crate (#3)
* update pp crate

* update crate version

* update pyproject version
2024-05-12 01:05:22 +01:00
tsunyoku 4b2f5f5ba7 update pp version 2024-04-14 14:46:28 +01:00
tsunyoku 068f538643 update pyproject file 2023-11-16 20:39:40 +00:00
tsunyoku b1b647d1ea hotfix 2023-11-16 20:24:37 +00:00
James fdd668da2b fix pyproject version 2023-11-16 19:49:39 +00:00
tsunyoku 618c33486d deploy new pp version 2023-11-16 19:36:20 +00:00
tsunyoku cc222094b6 v0.9.8: fix typing pt 2 2023-09-23 23:35:49 +01:00
tsunyoku c881e301a4 v0.9.7: typing fixes 2023-09-23 23:21:18 +01:00
tsunyoku 56d7543627 v0.9.6: improve python typing 2023-09-23 22:53:10 +01:00
James 8b7da57138 Merge pull request #2 from aeongdesu/main
ci: update action packages, support linux aarch64
2023-09-22 08:23:47 +01:00
aeongdesu eb6f8e9946 chore: update actions/setup-python package 2023-09-07 09:38:14 +09:00
aeongdesu 326007bfd0 chore: update action packages 2023-09-07 09:29:00 +09:00
aeongdesu 1908302278 feat: support linux aarch64 2023-09-07 09:22:11 +09:00
James b7793f64c7 feat: update project to 0.9.5 2023-05-14 11:50:20 +01:00
James 3930184b32 feat: include 3.7 and 3.8 in workflow 2023-05-14 11:49:35 +01:00
James 994388be72 feat: update rust project to 0.9.5 2023-05-14 11:48:33 +01:00
James 7a1f968b2b fix: stringify python versions 2023-05-14 11:42:27 +01:00
James 795f95dc0e feat: publish for multiple python versions 2023-05-14 11:40:30 +01:00
tsunyoku 7edcaeeb46 chore: upgrade akatsuki-pp 2023-03-24 21:10:34 +00:00
James a51f2ed966 fix: maturin 2023-02-22 19:12:37 +00:00
James 8f06a746d4 fix: workflow? 2023-02-22 19:10:35 +00:00
8 changed files with 287 additions and 44 deletions
+31 -31
View File
@@ -9,28 +9,27 @@ on:
jobs:
macos:
runs-on: macos-latest
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Python setup
uses: actions/setup-python@v2
uses: actions/setup-python@v5.1.1
with:
python-version: 3.9
python-version: ${{ matrix.python_version }}
architecture: x64
- name: Rust setup
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
uses: dtolnay/rust-toolchain@stable
- name: Build wheels - x86_64
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: x86_64
args: --release --out dist
args: --release --out dist --sdist
- name: Install built wheel - x86_64
run: |
@@ -38,9 +37,9 @@ jobs:
python -c "import akatsuki_pp_py"
- name: Build wheels - universal2
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
args: --release --universal2 --out dist --no-sdist
args: --release --universal2 --out dist
- name: Install built wheel - universal2
run: |
@@ -57,29 +56,26 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [x64, x86]
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Python setup
uses: actions/setup-python@v2
uses: actions/setup-python@v5.1.1
with:
python-version: 3.9
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.target }}
- name: Rust setup
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --no-sdist
args: --release --out dist
- name: Install built wheel
run: |
@@ -93,26 +89,27 @@ jobs:
path: dist
linux:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
target: [x86_64, i686]
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [x86_64, i686, aarch64]
steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Python setup
uses: actions/setup-python@v2
uses: actions/setup-python@v5.1.1
with:
python-version: 3.9
python-version: ${{ matrix.python_version }}
architecture: x64
- name: Build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: --release --out dist --no-sdist
args: --release --out dist -i ${{ matrix.python_version }}
- name: Install built wheel
if: matrix.target == 'x86_64'
@@ -129,6 +126,9 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11']
needs: [ macos, windows, linux ]
steps:
- name: Get artifacts
@@ -137,9 +137,9 @@ jobs:
name: wheels
- name: Python setup
uses: actions/setup-python@v2
uses: actions/setup-python@v5.1.1
with:
python-version: 3.9
python-version: ${{ matrix.python_version }}
- name: Publish to PyPi
env:
+6
View File
@@ -0,0 +1,6 @@
* @tsunyoku @cmyui
# Infrastructure
/.github/* @cmyui
/tf/* @cmyui
/chart/* @cmyui
Generated
+3 -3
View File
@@ -4,12 +4,12 @@ version = 3
[[package]]
name = "akatsuki-pp"
version = "0.9.3"
source = "git+https://github.com/osuAkatsuki/akatsuki-pp-rs#4140dc70840044d9d4313731ce04c5793098ed62"
version = "1.0.1"
source = "git+https://github.com/osuAkatsuki/akatsuki-pp-rs?rev=b96019f50aa7d09bcbde60016481a69df04315e4#b96019f50aa7d09bcbde60016481a69df04315e4"
[[package]]
name = "akatsuki-pp-py"
version = "0.9.3"
version = "1.0.5"
dependencies = [
"akatsuki-pp",
"pyo3",
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "akatsuki-pp-py"
version = "0.9.3"
version = "1.0.5"
description = "osu! difficulty and pp calculation for all modes"
authors = ["Max Ohn <ohn.m@hotmail.de>", "tsunyoku <tsunyoku@gmail.com>"]
license = "MIT"
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = { version = "0.17", features = ["extension-module", "macros"] }
akatsuki-pp = { git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "61cb1564b4fdbffb21748b35f58805327dc4aac4" }
akatsuki-pp = { git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "b96019f50aa7d09bcbde60016481a69df04315e4" }
[profile.release]
lto = "fat"
+167 -1
View File
@@ -1,3 +1,6 @@
from typing import Optional
from typing import List
class Beatmap:
"""
A class containing a parsed beatmap.
@@ -25,7 +28,8 @@ class Beatmap:
Throws an exception if the map could not be parsed or an invalid kwarg was given
"""
def __init__(self, **kwargs) -> None: ...
def __init__(self, **kwargs) -> None:
...
def set_ar(self, ar: float) -> None:
"""
@@ -230,6 +234,45 @@ class BeatmapAttributes:
Amount of spinners
"""
@property
def ar(self) -> float: ...
@property
def cs(self) -> float: ...
@property
def hp(self) -> float: ...
@property
def od(self) -> float: ...
@property
def ar_hit_window(self) -> float: ...
@property
def od_hit_window(self) -> float: ...
@property
def clock_rate(self) -> float: ...
@property
def bpm(self) -> float: ...
@property
def mode(self) -> int: ...
@property
def version(self) -> int: ...
@property
def n_circles(self) -> int: ...
@property
def n_sliders(self) -> int: ...
@property
def n_spinners(self) -> int: ...
class DifficultyAttributes:
"""
@@ -283,6 +326,69 @@ class DifficultyAttributes:
Amount of tiny droplets (C)
"""
@property
def mode(self) -> int: ...
@property
def stars(self) -> float: ...
@property
def max_combo(self) -> int: ...
@property
def aim(self) -> Optional[float]: ...
@property
def speed(self) -> Optional[float]: ...
@property
def flashlight(self) -> Optional[float]: ...
@property
def slider_factor(self) -> Optional[float]: ...
@property
def speed_note_count(self) -> Optional[float]: ...
@property
def ar(self) -> Optional[float]: ...
@property
def od(self) -> Optional[float]: ...
@property
def n_circles(self) -> Optional[int]: ...
@property
def n_sliders(self) -> Optional[int]: ...
@property
def n_spinners(self) -> Optional[int]: ...
@property
def stamina(self) -> Optional[float]: ...
@property
def color(self) -> Optional[float]: ...
@property
def rhythm(self) -> Optional[float]: ...
@property
def peak(self) -> Optional[float]: ...
@property
def hit_window(self) -> Optional[float]: ...
@property
def n_fruits(self) -> Optional[int]: ...
@property
def n_droplets(self) -> Optional[int]: ...
@property
def n_tiny_droplets(self) -> Optional[int]: ...
class PerformanceAttributes:
"""
@@ -312,6 +418,33 @@ class PerformanceAttributes:
Difficulty based portion of the performance points (T, M)
"""
@property
def mode(self) -> int: ...
@property
def pp(self) -> float: ...
@property
def difficulty(self) -> DifficultyAttributes: ...
@property
def pp_acc(self) -> Optional[float]: ...
@property
def pp_aim(self) -> Optional[float]: ...
@property
def pp_speed(self) -> Optional[float]: ...
@property
def pp_flashlight(self) -> Optional[float]: ...
@property
def effective_miss_count(self) -> Optional[float]: ...
@property
def pp_difficulty(self) -> Optional[float]: ...
class Strains:
"""
@@ -344,3 +477,36 @@ class Strains:
`'strains': Optional[List[float]]`
Strain values (M)
"""
@property
def mode(self) -> int: ...
@property
def section_len(self) -> float: ...
@property
def aim(self) -> Optional[List[float]]: ...
@property
def aim_no_sliders(self) -> Optional[List[float]]: ...
@property
def speed(self) -> Optional[List[float]]: ...
@property
def flashlight(self) -> Optional[List[float]]: ...
@property
def color(self) -> Optional[List[float]]: ...
@property
def stamina(self) -> Optional[List[float]]: ...
@property
def rhythm(self) -> Optional[List[float]]: ...
@property
def movement(self) -> Optional[List[float]]: ...
@property
def strains(self) -> Optional[List[float]]: ...
+6 -3
View File
@@ -1,10 +1,10 @@
[build-system]
requires = ["maturin>=0.12,<0.13", "setuptools", "setuptools-rust", "wheel"]
requires = ["maturin>=0.14,<0.15"]
build-backend = "maturin"
[project]
name = "akatsuki-pp-py"
version = "0.9.3"
version = "1.0.5"
requires-python = ">=3.7"
description = "osu! difficulty and pp calculation for all modes"
classifiers = [
@@ -17,7 +17,10 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]
packages = [{ include = "akatsuki_pp_py" }]
authors = [{ name = "Max Ohn", email = "ohn.m@hotmail.de" }, { name = "tsunyoku", email = "tsunyoku@gmail.com" }]
authors = [
{ name = "Max Ohn", email = "ohn.m@hotmail.de" },
{ name = "tsunyoku", email = "tsunyoku@gmail.com" },
]
readme = "README.md"
license = { file = "LICENSE" }
repository = "https://github.com/osuAkatsuki/akatsuki-pp-py"
+67 -1
View File
@@ -1,4 +1,8 @@
use akatsuki_pp::{AnyPP, AnyStars, DifficultyAttributes, GameMode};
use akatsuki_pp::{
osu::{OsuDifficultyAttributes, OsuPerformanceAttributes},
osu_2019::OsuPP,
AnyPP, AnyStars, DifficultyAttributes, GameMode, Mods, PerformanceAttributes,
};
use pyo3::{
exceptions::{PyTypeError, PyValueError},
pyclass, pymethods,
@@ -227,7 +231,69 @@ impl PyCalculator {
Ok(calc.calculate().into())
}
fn performance_2019(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
let mut calc = OsuPP::new(&map.inner);
set_calc! { calc, self:
mods,
combo,
n300,
n100,
n50,
passed_objects,
};
if let Some(n_misses) = self.n_misses {
calc = calc.misses(n_misses);
}
if let Some(acc) = self.acc {
calc = calc.accuracy(acc as f32);
}
let attrs = calc.calculate();
let new_attrs = OsuPerformanceAttributes {
difficulty: OsuDifficultyAttributes {
aim: attrs.difficulty.aim_strain,
speed: attrs.difficulty.speed_strain,
flashlight: 0.0,
slider_factor: 0.0,
speed_note_count: 0.0,
ar: attrs.difficulty.ar,
od: attrs.difficulty.od,
hp: attrs.difficulty.hp,
n_circles: attrs.difficulty.n_circles,
n_sliders: attrs.difficulty.n_sliders,
n_spinners: attrs.difficulty.n_spinners,
stars: attrs.difficulty.stars,
max_combo: attrs.difficulty.max_combo,
aim_difficult_strain_count: 0.0,
speed_difficult_strain_count: 0.0,
},
pp: attrs.pp,
pp_acc: attrs.pp_acc,
pp_aim: attrs.pp_aim,
pp_flashlight: attrs.pp_flashlight,
pp_speed: attrs.pp_speed,
effective_miss_count: attrs.effective_miss_count,
};
Ok(PerformanceAttributes::Osu(new_attrs).into())
}
fn performance(&self, map: &PyBeatmap) -> PyResult<PyPerformanceAttributes> {
// criteria:
// - is relax
// - is osu!standard
// or mode is not specified and map is osu!standard, as that will be the inferred mode
if (self.mods.is_some() && self.mods.unwrap().rx())
&& ((self.mode.is_none() && map.inner.mode == GameMode::Osu)
|| self.mode == Some(GameMode::Osu))
{
return self.performance_2019(map);
}
let mut calc = AnyPP::new(&map.inner);
set_calc! { calc, self:
+2
View File
@@ -234,4 +234,6 @@ getters! {
n_tiny_droplets as usize: (Catch),
ar as f64: (Osu, Catch),
hit_window as f64: (Taiko, Mania),
aim_difficult_strain_count as f64: (Osu),
speed_difficult_strain_count as f64: (Osu),
}