Skip to main content
https://img.shields.io/pypi/v/idris-python.svg

idris-cam

Finally, we reached dependent types in Python community.

Install

pip install idris-python

Usage

  • Command: Idris-Python

https://raw.githubusercontent.com/thautwarm/idris-python/master/cmd-idris-python.png
  • Command: Run-Cam

https://raw.githubusercontent.com/thautwarm/idris-python/master/cmd-run-cam.png

## Example

Quite verbose for the lack of encapsulations, not a good example but I’m so busy..

Following example just revealed that I’ve alredy implmented such a big task.

module Main
import Cam.FFI
import Cam.IO
import Cam.Data.Collections
import Cam.Data.FCollections
import Cam.Data.Compat
import Data.Vect
import Data.HVect

%access export

main : IO ()
main = do
    putStrLn $ show vect
    sklearn   <- camImport $ TheModule "sklearn.datasets"
    load_iris <- camImportFrom sklearn "load_iris"
    iris      <- unsafeCall load_iris $ zero_ary
    data'     <- getattr iris "data"
    tag       <- getattr iris "target"
    rfc       <- let ensemble = camImport $ TheModule "sklearn.ensemble" in
                 camImportFrom !ensemble "RandomForestClassifier"
    clf       <- unsafeCall rfc zero_ary
    fit       <- getattr clf "fit"
    unsafeCall fit . unsafe $ the (FList _) [data', tag]
    score <- getattr clf "score"
    value <- unsafeCall score . unsafe $ the (FList _) [data', tag] -- overfit
    println value
  where
    vect : HVect [Int]
    vect = the (HVect _) [1]

    zero_ary : Unsafe
    zero_ary = unsafe $  the (FList Unsafe) $ []

    getattr' : IO Unsafe
    getattr' = do
        b <- camImport $ TheModule "builtins"
        camImportFrom b "getattr"

    getattr : Unsafe -> String -> IO Unsafe
    getattr obj s =
        let s = unsafe . the (Boxed String) $ s in
        let args = unsafe . the (FHVect [_, _]) $ [obj, toText s] in
        unsafeCall !getattr' args

You might got

[1]
0.99

If you run it as a file with command idris-python.

Metadata

Release files for idris-python 0.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for idris-python 0.25
File Interpreter ABI Platform
idris_python-0.25-py3-none-any.whl Python 3 none any Details

Release files / idris_python-0.25-py3-none-any.whl

Download URL idris_python-0.25-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd5b1d9a4fa571b4143dbba66db1635a6d1582e80376394fc781e52d467dedcc
BLAKE2b-256 checksum
How to use checksums
ec3d53b6930fec3aec67d5d3a0a6fa83b616f66c3b6774354fb55495c95eea25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.25 This release

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page