mberk / shin

Python implementation of Shin's method for calculating implied probabilities from bookmaker odds
MIT License
74 stars 9 forks source link

Missing py.typed file #2

Closed peterschutt closed 5 months ago

peterschutt commented 5 months ago

Hi,

Just started using shin - thanks for making the package available!

In testing I've noticed that while the source is typed correctly mypy won't recognize it as typed due to missing the py.typed marker file.

Here is mypy output:

src/domain/utils.py:5: error: Skipping analyzing "shin": module is installed, but missing library stubs or py.typed marker  [import-untyped]
src/domain/utils.py:5: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
peterschutt commented 5 months ago

Closed in #3

mberk commented 5 months ago

Thanks for the interest and your contribution. I don't personally use mypy but having a play with your change, it seems to me that some additional changes would be required to fix the outstanding errors that mypy reports:

  1. A shin.pyi file providing type hints for the Rust optimise function
  2. A couple of problems with variable assignments

Can you please confirm and if so one of us can add these changes to the new release branch

peterschutt commented 5 months ago

Thanks for the interest and your contribution. I don't personally use mypy but having a play with your change, it seems to me that some additional changes would be required to fix the outstanding errors that mypy reports:

1. A `shin.pyi` file providing type hints for the Rust optimise function

2. A couple of problems with variable assignments

Can you please confirm and if so one of us can add these changes to the new release branch

I just opened another issue with some improvements I've been experimenting with.. I did also add a .pyi for shin too :)

def optimise(
    inverse_odds: list[float],
    sum_inverse_odds: float,
    n: int,
    max_iterations: int = 1000,
    convergence_threshold: float = 1e-12,
) -> tuple[float, float, float]:
    ...

I just assumed it would take the same args as the python func given how its used.

I'd be happy to tidy these things up and add mypy to your testing/ci?