Skip to content

Commit

Permalink
chor(socha): bump up to 2.0.2
Browse files Browse the repository at this point in the history
fix(socha): build on linux

fix(socha): build on linux

fix(socha): build on linux

fix(socha): build on linux

test(push): fix wrong test

chor(readme): update with docs info

chor(rtfd): rename

docs: auto update index.rst

chor(docs): correct deps

chor(docs): correct deps

chor(docs): correct doc link
  • Loading branch information
maxblan authored and maxblan committed Nov 12, 2023
1 parent 050c846 commit 5f9e54c
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 141 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "_socha"
version = "2.0.1"
version = "2.0.2"
edition = "2021"

[lib]
Expand All @@ -13,7 +13,7 @@ libmath = "0.2.1"
regex = "1.7.1"
yaserde = "0.8.0"
yaserde_derive = "0.8.0"
pyo3 = { version = "0.20.0", features = ["auto-initialize"] }
pyo3 = { version = "0.20.0" }
pyo3-log = "0.9.0"
log = "0.4.20"

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@

# Python Client for the Software-Challenge Germany 2024

[![Read the Docs](https://img.shields.io/readthedocs/socha-python-client.readthedocs?label=Docs)](https://socha-python-client.readthedocs.io/en/latest/)
[![PyPI](https://img.shields.io/pypi/v/socha?label=PyPi)](https://pypi.org/project/socha/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/socha?label=Python)](https://pypi.org/project/socha/)
[![Discord](https://img.shields.io/discord/233577109363097601?color=blue&label=Discord)](https://discord.gg/ARZamDptG5)
[![Documentation](https://img.shields.io/badge/Software--Challenge%20-Documentation-%234299e1)](https://docs.software-challenge.de/)

> **Be warned!** This package is currently experimental and has still a few known bugs. But please try it out and let us know if anything comes up.
> Hey there! To help you out, it's best to start by checking out the
> [documentation for this client](https://socha-python-client.readthedocs.readthedocs.io/en/latest/)
> before you ask any questions or open an issue.
> It'll provide you with some helpful information!

This repository contains the Python package for the
[Software-Challenge Germany](https://www.software-challenge.de), a programming competition for students. The students
have to develop an artificial intelligence that plays and competes against other opponents in an annually changing game.
Expand Down
10 changes: 6 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'socha player template'
copyright = '2022, Falcon'
author = 'Falcon'
project = 'socha python client'
copyright = '2023, maxblan'
author = 'maxblan'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc'
'autoapi.extension'
]

autoapi_dirs = ['../python/socha']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

Expand Down
18 changes: 17 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
Python Client for the Software-Challenge Germany 2024
=====================================================

|Discord|
|Read the Docs| |PyPI| |PyPI - Python Version| |Discord| |Documentation|

**Be warned!** This package is currently experimental and has still a
few known bugs. But please try it out and let us know if anything
comes up.

..
Hey there! To help you out, it's best to start by checking out the
`documentation for this
client <https://software-challenge-python-client.readthedocs.io/en/latest/>`__
before you ask any questions or open an issue. It'll provide you with
some helpful information!

This repository contains the Python package for the `Software-Challenge
Germany <https://www.software-challenge.de>`__, a programming
competition for students. The students have to develop an artificial
Expand Down Expand Up @@ -306,8 +314,16 @@ can use a logic written in Python and make changes in the Rust code.
Each time a change is made, ``maturin develop`` must be executed again
to make the change visible to the Python code.

.. |Read the Docs| image:: https://img.shields.io/readthedocs/software-challenge-python-client?label=Docs
:target: https://software-challenge-python-client.readthedocs.io/en/latest/
.. |PyPI| image:: https://img.shields.io/pypi/v/socha?label=PyPi
:target: https://pypi.org/project/socha/
.. |PyPI - Python Version| image:: https://img.shields.io/pypi/pyversions/socha?label=Python
:target: https://pypi.org/project/socha/
.. |Discord| image:: https://img.shields.io/discord/233577109363097601?color=blue&label=Discord
:target: https://discord.gg/ARZamDptG5
.. |Documentation| image:: https://img.shields.io/badge/Software--Challenge%20-Documentation-%234299e1
:target: https://docs.software-challenge.de/


Indices and tables
Expand Down
8 changes: 4 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx==4.0
sphinx-autodoc-typehints==1.12.0
furo==2022.4.7
xsdata==22.7
sphinx==6.1.0
sphinx-autoapi==3.0.0
furo==2023.9.10
xsdata==22.9
21 changes: 0 additions & 21 deletions docs/socha.api.networking.rst

This file was deleted.

21 changes: 0 additions & 21 deletions docs/socha.api.plugin.rst

This file was deleted.

37 changes: 0 additions & 37 deletions docs/socha.api.protocol.rst

This file was deleted.

20 changes: 0 additions & 20 deletions docs/socha.api.rst

This file was deleted.

29 changes: 0 additions & 29 deletions docs/socha.rst

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "socha"
version = "2.0.1"
version = "2.0.2"
authors = [{ name = "maxblan", email = "[email protected]" }]
description = "This is the package for the Software-Challenge Germany 2023. This Season the game will be 'Hey, danke für den Fisch' a.k.a. 'Penguins' in short."
readme = "README.md"
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions src/plugin/actions/accelerate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ impl Accelerate {

#[cfg(test)]
mod tests {
use pyo3::prepare_freethreaded_python;

use crate::plugin::board::Board;
use crate::plugin::constants::PluginConstants;
use crate::plugin::coordinate::{ CubeCoordinates, CubeDirection };
Expand Down Expand Up @@ -145,6 +147,7 @@ mod tests {

let result_error: PyErr = accelerate.perform(&game_state).unwrap_err();

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(result_error.value(py).to_string(), AccelerationProblem::ZeroAcc.message());
});
Expand All @@ -156,6 +159,7 @@ mod tests {

let result_error = accelerate.perform(&game_state).unwrap_err();

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
result_error.value(py).to_string(),
Expand All @@ -170,6 +174,7 @@ mod tests {

let result = accelerate.perform(&game_state).unwrap_err();

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(result.value(py).to_string(), AccelerationProblem::BelowMinSpeed.message());
});
Expand All @@ -185,6 +190,7 @@ mod tests {

let result = accelerate.perform(&mute_state).unwrap_err();

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
result.value(py).to_string(),
Expand Down
4 changes: 4 additions & 0 deletions src/plugin/actions/advance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ impl Advance {

#[cfg(test)]
mod tests {
use pyo3::prepare_freethreaded_python;

use crate::plugin::board::Board;
use crate::plugin::coordinate::{ CubeCoordinates, CubeDirection };
use crate::plugin::field::Field;
Expand Down Expand Up @@ -158,6 +160,7 @@ mod tests {
assert!(result.is_err());
let error: PyErr = result.unwrap_err();

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(error.value(py).to_string(), AdvanceProblem::InvalidDistance.message());
});
Expand All @@ -173,6 +176,7 @@ mod tests {
assert!(result.is_err());
let error: PyErr = result.unwrap_err();

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
error.value(py).to_string(),
Expand Down
7 changes: 6 additions & 1 deletion src/plugin/actions/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ impl Push {

#[cfg(test)]
mod tests {
use pyo3::prepare_freethreaded_python;

use crate::plugin::board::Board;
use crate::plugin::coordinate::{CubeCoordinates, CubeDirection};
use crate::plugin::field::Field;
Expand Down Expand Up @@ -159,7 +161,7 @@ mod tests {
let new_ship: Ship = result.unwrap();

assert_eq!(new_ship.position, CubeCoordinates::new(1, 0));
assert_eq!(new_ship.free_turns, 1);
assert_eq!(new_ship.free_turns, 2);
}

#[test]
Expand Down Expand Up @@ -207,6 +209,7 @@ mod tests {

assert!(result.is_err());

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
result.unwrap_err().value(py).to_string(),
Expand All @@ -227,6 +230,7 @@ mod tests {

assert!(result.is_err());

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
result.unwrap_err().value(py).to_string(),
Expand All @@ -247,6 +251,7 @@ mod tests {

assert!(result.is_err());

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
result.unwrap_err().value(py).to_string(),
Expand Down
3 changes: 3 additions & 0 deletions src/plugin/actions/turn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ impl Turn {

#[cfg(test)]
mod tests {
use pyo3::prepare_freethreaded_python;

use crate::plugin::board::Board;
use crate::plugin::coordinate::{CubeCoordinates, CubeDirection};
use crate::plugin::field::{Field, FieldType};
Expand Down Expand Up @@ -148,6 +150,7 @@ mod tests {

assert!(result.is_err());

prepare_freethreaded_python();
Python::with_gil(|py| {
assert_eq!(
result.unwrap_err().value(py).to_string(),
Expand Down

0 comments on commit 5f9e54c

Please sign in to comment.