diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2737ff..3e27f3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,8 +175,8 @@ jobs: python3 -m venv venv source venv/bin/activate python3 -m pip install -U pip typing-extensions - python3 -m pip install rosu_pp_py --no-index --no-deps --find-links dist --force-reinstall - python3 -c "import rosu_pp_py" + python3 -m pip install rina_pp_pyb --no-index --no-deps --find-links dist --force-reinstall + python3 -c "import rina_pp_pyb" test-builds-os: name: Test build on ${{ matrix.os }} @@ -206,8 +206,8 @@ jobs: - run: | pip install typing-extensions - pip install rosu_pp_py --no-index --no-deps --find-links dist --force-reinstall - python -c "import rosu_pp_py" + pip install rina_pp_pyb --no-index --no-deps --find-links dist --force-reinstall + python -c "import rina_pp_pyb" release: name: Release diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index ecfc2a7..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,63 +0,0 @@ -# v1.0.0 (2024-04-03) - -- Updated to [rosu-pp v1.0.0](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v100-2024-04-02) -- Breaking changes ahead! There are now multiple different calculators: - - `Difficulty` to calculate `DifficultyAttributes`, `Strains`, or create gradual calculators - - `Performance` to calculate `PerformanceAttributes` - - `BeatmapAttributesBuilder` to calculate `BeatmapAttributes` - - `GradualDifficulty` to calculate `DifficultyAttributes` for each hitobject - - `GradualPerformance` to calculate `PerformanceAttributes` for each hitresult - -## v0.9.4 (2023-02-09) - -- Updated to [rosu-pp v0.9.4](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v094-2023-02-09). - -## v0.9.3 (2023-01-28) - -- Updated to [rosu-pp v0.9.3](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v093-2023-01-28). Only includes some bug fixes. -- Fixed the hitobjects counts of map attributes on converted maps. - -## v0.9.1 (2022-10-29) - -- Updated to [rosu-pp v0.9.1](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v091-2022-10-26) including the big changes in [v0.9.0](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v090-2022-10-24) -- The binding interface is rewritten completely, see the readme. - -## v0.8.0 (2022-08-02) -- Updated to [rosu-pp v0.8.0](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v080-2022-08-02) -- The calculation result now contains a `timePreempt` field for osu!standard and `greatHitWindow` for -osu!standard, osu!taiko, and osu!mania. -- Fixed map attributes when mods were interacting with custom clock rates - -## v0.7.2 (2022-07-16) -- Apply mods before acc to fix pp values sometimes calculating incorrectly for osu!catch ([#3] - [@tsunyoku]) - -## v0.7.1 (2022-07-12) -- Updated to [rosu-pp v0.7.1](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v071-2022-07-12) - -## v0.7.0 (2022-07-07) -- Removed the `GameMode` class again; use simple numbers instead (0/1/2/3) -- Updated to [rosu-pp v0.7.0](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v070-2022-07-06) -- Added `strains` method for `Calculator` which returns instances of `Strains` - -## v0.6.0 (2022-07-05) -- Updated to [PyO3 v0.16](https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md#0165---2022-05-15) from v0.15 -- Updated to [rosu-pp v0.6](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v060-2022-07-05) -- Added the class `GameMode` to serve as enum e.g. `GameMode.Taiko` -- `ScoreParams` now have an additional field `mode: Optional[GameMode]` which can be used to convert to other modes - -## v0.5.2 (2022-06-14) -- Bumped patch version of dependencies, including a [rosu-pp](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md#v052-2022-06-14) update - -## v0.5.1 (2022-03-22) -- Updated to [rosu-pp v0.5.1](https://github.com/MaxOhn/rosu-pp/blob/main/CHANGELOG.md) -- `Calculator` now accepts the kwargs `ar`, `cs`, `hp`, and `od` to adjust the map's attributes -- Additionally to the kwargs, `Calculator` also has new methods `set_ar(v)`, `set_cs(v)`, `set_hp(v)`, and `set_od(v)`. -- `ScoreParams` has the additional field `clockRate` to specify a custom clock rate, providable as kwarg or through the setter -- `CalculateResult` now also includes a `clockRate` field - -## v0.4.0 (2021-12-29) -- Initial release with rosu-pp v0.4.0 - -[@tsunyoku]: https://github.com/tsunyoku - -[#3]: https://github.com/MaxOhn/rosu-pp-py/pull/3 diff --git a/Cargo.lock b/Cargo.lock index 2facd7e..b9e2c7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,8 +189,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c55926c8f0fed1db12fbe96f7a6083a2c4186443dd32532ab34e6902467a4f3" [[package]] -name = "rosu-pp" -version = "1.0.0" +name = "rina-pp" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26f146c66bed5900ee1fa2b55ef5cc5dd2dbd45e6cac0f7bee5cae535980afbc" dependencies = [ @@ -198,11 +198,11 @@ dependencies = [ ] [[package]] -name = "rosu-pp-py" -version = "1.0.0" +name = "rina-pp-pyb" +version = "0.9.25" dependencies = [ "pyo3", - "rosu-pp", + "rina-pp", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c2bf08c..94dfdb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "rosu-pp-py" +name = "rina-pp-pyb" version = "1.0.0" edition = "2021" -authors = ["Max Ohn "] +authors = ["Max Ohn ", "Simon G."] license = "MIT" readme = "README.md" -repository = "https://github.com/MaxOhn/rosu-pp-py" +repository = "https://github.com/osuthailand/rina-pp-pyb" description = "Difficulty and performance calculation for osu!" [lib] -name = "rosu_pp_py" +name = "rina_pp_pyb" crate-type = ["cdylib"] [dependencies] pyo3 = { version = "0.21", features = ["extension-module", "macros"] } -rosu-pp = { version = "1.0.0", features = ["sync"] } +rina-pp = { version = "0.9.25", features = ["sync"] } [profile.release] lto = true diff --git a/README.md b/README.md index c19583c..7369e9f 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,35 @@ -# rosu-pp-py +# rina-pp-pyb Library to calculate difficulty and performance attributes for all [osu!] modes. -This is a python binding to the [Rust] library [rosu-pp] which was bootstrapped through [PyO3]. +This is a python binding to the [Rust] library [rina-pp] which was bootstrapped through [PyO3]. As such, its performance is much faster than a native python library. ## Usage The library exposes multiple classes: -- [`Beatmap`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L23-L101): Parsed `.osu` file -- [`GameMode`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L5-L13) +- [`Beatmap`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L23-L101): Parsed `.osu` file +- [`GameMode`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L5-L13) - Calculators - - [`Difficulty`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L103-L251): Class to calculate difficulty attributes, strains, or create gradual calculators - - [`Performance`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L253-L439): Performance attributes calculator - - [`GradualDifficulty`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L441-L465): Calculator to calculate difficulty attributes after each hitobject - - [`GradualPerformance`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L467-L493): Calculator to calculator performance attributes after each hitresult - - [`BeatmapAttributesBuilder`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L495-L617): Beatmap attributes calculator + - [`Difficulty`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L103-L251): Class to calculate difficulty attributes, strains, or create gradual calculators + - [`Performance`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L253-L439): Performance attributes calculator + - [`GradualDifficulty`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L441-L465): Calculator to calculate difficulty attributes after each hitobject + - [`GradualPerformance`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L467-L493): Calculator to calculator performance attributes after each hitresult + - [`BeatmapAttributesBuilder`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L495-L617): Beatmap attributes calculator - Results - - [`DifficultyAttributes`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L666-L853) - - [`Strains`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L928-L998): Strain values of a difficulty calculation, suitable to plot difficulty over time - - [`PerformanceAttributes`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L855-L926) - - [`BeatmapAttributes`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L1000-L1030) -- [`HitResultPriority`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L15-L21): Passed to `Performance`, decides whether specified accuracy should be realized through good or bad hitresults -- [`ScoreState`](https://github.com/MaxOhn/rosu-pp-py/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rosu_pp_py.pyi#L619-L664): Hitresults and max combo of a score, found in `PerformanceAttributes` and passed to gradual calculators + - [`DifficultyAttributes`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L666-L853) + - [`Strains`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L928-L998): Strain values of a difficulty calculation, suitable to plot difficulty over time + - [`PerformanceAttributes`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L855-L926) + - [`BeatmapAttributes`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L1000-L1030) +- [`HitResultPriority`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L15-L21): Passed to `Performance`, decides whether specified accuracy should be realized through good or bad hitresults +- [`ScoreState`](https://github.com/osuthailand/rina-pp-pyb/blob/f0f08fe9c9a94331840db67d5cf3b9b8cd15ea55/rina_pp_pyb.pyi#L619-L664): Hitresults and max combo of a score, found in `PerformanceAttributes` and passed to gradual calculators ## Example ### Calculating performance ```py -import rosu_pp_py as rosu +import rina_pp_pyb as rosu # either `path`, `bytes`, or `content` must be specified when parsing a map map = rosu.Beatmap(path = "/path/to/file.osu") @@ -76,7 +76,7 @@ print(f'PP: {attrs.pp}/{max_attrs.pp} | Stars: {max_attrs.difficulty.stars}') ### Gradual calculation ```py -import rosu_pp_py as rosu +import rina_pp_pyb as rosu # Parsing the map, this time through the `content` kwarg with open("/path/to/file.osu") as file: @@ -118,29 +118,29 @@ while True: i += 1 ``` -## Installing rosu-pp-py +## Installing rina-pp-pyb -Installing rosu-pp-py requires a [supported version of Python and Rust](https://github.com/PyO3/PyO3#usage). +Installing rina-pp-pyb requires a [supported version of Python and Rust](https://github.com/PyO3/PyO3#usage). Once [Python] and [Rust](https://www.rust-lang.org/learn/get-started) are ready to go, you can install the project with pip: ```sh -$ pip install rosu-pp-py +$ pip install rina-pp-pyb ``` or ``` -$ pip install git+https://github.com/MaxOhn/rosu-pp-py +$ pip install git+https://github.com/osuthailand/rina-pp-pyb ``` ## Learn More -- [rosu-pp] +- [rina-pp] - [Rust] - [PyO3] [osu!]: https://osu.ppy.sh/home [Rust]: https://www.rust-lang.org -[rosu-pp]: https://github.com/MaxOhn/rosu-pp +[rina-pp]: https://github.com/osuthailand/rina-pp [PyO3]: https://github.com/PyO3/pyo3 [Python]: https://www.python.org/downloads/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b1b794b..e8618a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["maturin>=1,<2"] build-backend = "maturin" [project] -name = "rosu-pp-py" +name = "rina-pp-pyb" version = "1.0.0" requires-python = ">=3.7" description = "Difficulty and performance calculation for osu!" diff --git a/rosu_pp_py.pyi b/rina_pp_pyb.pyi similarity index 100% rename from rosu_pp_py.pyi rename to rina_pp_pyb.pyi diff --git a/src/error.rs b/src/error.rs index aadc6ab..791ef90 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,5 @@ use pyo3::{create_exception, exceptions::PyException}; -create_exception!(rosu_pp_py, ArgsError, PyException); -create_exception!(rosu_pp_py, ParseError, PyException); -create_exception!(rosu_pp_py, ConvertError, PyException); +create_exception!(rina_pp_pyb, ArgsError, PyException); +create_exception!(rina_pp_pyb, ParseError, PyException); +create_exception!(rina_pp_pyb, ConvertError, PyException); diff --git a/src/lib.rs b/src/lib.rs index 80d8fa0..74db49e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ mod score_state; mod strains; #[pymodule] -fn rosu_pp_py(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { +fn rina_pp_pyb(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?;