Skip to content

Commit 6847ba6

Browse files
✨ Refactor genshin artifact core
Co-authored-by: kotoriのねこ <minamiktr@outlook.com>
1 parent 5f7033d commit 6847ba6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1718
-460
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,19 @@ jobs:
6767
shell: bash
6868
run: |
6969
source activate_env.sh
70-
cd python_genshin_artifact_core
7170
maturin develop
7271
7372
- name: Export install file
7473
shell: bash
7574
run: |
7675
source activate_env.sh
77-
cd python_genshin_artifact_core
7876
maturin build --out ./dist
7977
8078
- name: Upload Artifact
8179
uses: actions/upload-artifact@v3
8280
with:
8381
name: genshin-artifact-core
84-
path: python_genshin_artifact_core/dist
82+
path: ./dist
8583

8684
upload-core:
8785
runs-on: ubuntu-latest
@@ -110,38 +108,3 @@ jobs:
110108
env:
111109
TWINE_USERNAME: __token__
112110
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
113-
114-
build-artifact:
115-
runs-on: ubuntu-latest
116-
117-
steps:
118-
- uses: actions/checkout@v4
119-
120-
- name: Set up Python
121-
uses: actions/setup-python@v3
122-
with:
123-
python-version: 3.11
124-
125-
- name: Install Poetry and Twine
126-
run: |
127-
pip install poetry twine
128-
129-
- name: Install dependencies
130-
run: poetry install
131-
132-
- name: Build wheel
133-
run: poetry build
134-
135-
- name: upload to pypi
136-
if: startsWith(github.ref, 'refs/tags/')
137-
run: twine upload dist/*
138-
env:
139-
TWINE_USERNAME: __token__
140-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
141-
142-
- name: upload to artifact
143-
if: github.ref == 'refs/heads/main'
144-
uses: actions/upload-artifact@v3
145-
with:
146-
name: Python-Genshin-Artifact
147-
path: dist/*.whl

Cargo.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[package]
2+
name = "python_genshin_artifact"
3+
version = "0.1.4"
4+
edition = "2021"
5+
license = "MIT"
6+
include = [
7+
"/pyproject.toml",
8+
"/README.md",
9+
"/LICENSE",
10+
"/Makefile",
11+
"/src",
12+
"/watchfiles",
13+
"/tests",
14+
"/requirements",
15+
"/.cargo",
16+
"!__pycache__",
17+
"!tests/.mypy_cache",
18+
"!tests/.pytest_cache",
19+
"!*.so",
20+
]
21+
22+
[lib]
23+
name = "_python_genshin_artifact"
24+
crate-type = ["cdylib"]
25+
26+
[dependencies]
27+
pyo3 = { version = "0.19.2", features = ["anyhow"] }
28+
mona_wasm = { path = "genshin_artifact/mona_wasm" }
29+
mona = { path = "genshin_artifact/mona_core" }
30+
mona_generate = { path = "genshin_artifact/mona_generate" }
31+
num = "0.4"
32+
serde="1.0"
33+
serde_json = "1.0"
34+
anyhow = "1.0.75"
35+
pythonize = "0.19.0"
36+
37+
[features]
38+
default = ["pyo3/extension-module"]

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
black~=23.10.1
2+
pytest~=4.1.0

pyproject.toml

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,55 @@
1-
[tool.poetry]
2-
name = "Python-Genshin-Artifact"
1+
[project]
2+
name = "python_genshin_artifact"
3+
requires-python = ">=3.8"
34
version = "0.1.4"
4-
description = "A Python library that binds to Genshin Artifact damage calculation and analysis engine."
5-
authors = ["luoshuijs"]
6-
license = "MIT license"
7-
readme = "README.md"
8-
packages = [
9-
{ include = "python_genshin_artifact" },
5+
authors = [
6+
{name = "luoshuijs", email = "luoshuijs@outlook.com"},
7+
{name = "kotori", email = "minamiktr@outlook.com"}
8+
]
9+
classifiers = [
10+
"Development Status :: 5 - Production/Stable",
11+
"Environment :: Console",
12+
"Programming Language :: Python",
13+
"Programming Language :: Python :: 3",
14+
"Programming Language :: Python :: 3 :: Only",
15+
"Programming Language :: Python :: 3.8",
16+
"Programming Language :: Python :: 3.9",
17+
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
19+
"Programming Language :: Python :: 3.12",
20+
"Intended Audience :: Developers",
21+
"Intended Audience :: Information Technology",
22+
"Intended Audience :: System Administrators",
23+
"License :: OSI Approved :: MIT License",
24+
"Operating System :: POSIX :: Linux",
25+
"Operating System :: Microsoft :: Windows",
26+
"Operating System :: MacOS",
27+
"Topic :: Software Development :: Libraries :: Python Modules",
28+
"Topic :: System :: Filesystems",
29+
"Framework :: AnyIO",
30+
]
31+
dynamic = [
32+
"license",
33+
"readme",
34+
"version"
1035
]
1136

12-
[tool.poetry.dependencies]
13-
python = "^3.8"
14-
pydantic = "^1.10.7"
37+
[tool.maturin]
38+
module-name = "python_genshin_artifact._python_genshin_artifact"
39+
bindings = "pyo3"
40+
#python-source = "python"
1541

1642
[build-system]
17-
requires = ["poetry-core"]
18-
build-backend = "poetry.core.masonry.api"
19-
43+
requires = ["maturin>=1.0,<2.0"]
44+
build-backend = "maturin"
2045

2146
[tool.pytest.ini_options]
22-
asyncio_mode = "auto"
2347
log_cli = true
2448
log_cli_level = "INFO"
2549
log_cli_format = "%(message)s"
2650
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
2751

28-
2952
[tool.black]
3053
include = '\.pyi?$'
3154
line-length = 120
32-
target-version = ['py38']
55+
target-version = ["py38"]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from ._python_genshin_artifact import (
2+
get_damage_analysis,
3+
get_transformative_damage,
4+
gen_character_meta_as_json,
5+
gen_weapon_meta_as_json,
6+
gen_artifact_meta_as_json,
7+
gen_generate_locale_as_json,
8+
TransformativeDamage,
9+
CharacterInterface,
10+
WeaponInterface,
11+
BuffInterface,
12+
Artifact,
13+
SkillInterface,
14+
EnemyInterface,
15+
CalculatorConfig,
16+
DamageResult,
17+
DamageAnalysis,
18+
)
19+
20+
__all__ = (
21+
"get_damage_analysis",
22+
"get_transformative_damage",
23+
"gen_character_meta_as_json",
24+
"gen_weapon_meta_as_json",
25+
"gen_artifact_meta_as_json",
26+
"gen_generate_locale_as_json",
27+
"TransformativeDamage",
28+
"CharacterInterface",
29+
"WeaponInterface",
30+
"BuffInterface",
31+
"Artifact",
32+
"SkillInterface",
33+
"EnemyInterface",
34+
"CalculatorConfig",
35+
"DamageResult",
36+
"DamageAnalysis",
37+
)

0 commit comments

Comments
 (0)