About sklearn.metrics.average_precision_score documentation
According to the documentation, the value is not exactly the area under curve, it is
$$\text{AP} = \sum_n(R_n - R_{n-1})P_n.$$
which is a rectangular approximation.

For your specific example, i.e.

      R     P
  1   0.0   1.0   
  2   0.5   1.0   
  3   0.5   0.5   
  4   0.1   0.66


it is calculated as
$$\begin{align*}
\text{AP} &amp; = \overbrace{(0.5 - 0.0)\times1.0}^{(R_2 - R_1)P_2} + \overbrace{(0.5 - 0.5)\times 0.5}^{(R_3 - R_2)P_3} + \overbrace{(1.0 - 0.5) \times0.66}^{(R_4 - R_3)P_4} \\
&amp;= 0.5 + 0.00+ 0.33 = 0.83
\end{align*}$$
which is the area under the red curve as illustrated below:



compared to $$\text{AUPR}=0.5 + \overbrace{\frac{0.5 + 0.66}{2}  \times 0.5}^{\text{trapezoid area}} = 0.79$$
which is the area under the blue curve.