[ANN] Automatically generate your specs and types

43 views
Skip to first unread message

Ambrose Bonnaire-Sergeant

unread,
Oct 13, 2017, 11:31:05 AM10/13/17
to clojure, core.typed
Hi,

Happy to announce a new set of tools to automatically
generate types and specs for your projects.

Dependency information:
    [org.clojure/core.typed "0.4.2"]
2. lein-typed
    [lein-typed "0.4.2"]
  [org.typedclojure/boot-typedclojure "0.1.0"]

Tutorial:
Here's how to try it out (for Lein projects using clojure.test):

1. Add {:user {:plugins [[lein-typed "0.4.2"]]}} to your ~/.lein/profiles.clj
2. Add a runtime dependency to [org.clojure/core.typed "0.4.2"] in your chosen Lein project.clj
3. To infer specs: Run lein typed infer-spec <insert-ns> 
4. To infer types: Run lein typed infer-type <insert-ns>

WARNING: This tool rewrites your files. Only try with backed up code.

Some examples:
clj-time:

cheshire

(Note: use the latest core.typed versions to reproduce on your machines)

Hints:
This tool instruments your namespace and runs your test suite. This
can be expensive. Try these options:

   Choose lein test selectors (here: [:integration :generative] selectors)
  lein typed infer-spec <insert-ns> :test-selectors "[:integration :generative]"

   Timeout individual tests (1000ms timeout)
  lein typed infer-spec <insert-ns> :test-timeout-ms 1000

If annotation generation hangs, try these options:

   Disable recursive type inference
  lein typed infer-spec <insert-ns> :infer-opts "{:no-squash-vertically true}"

If you see "No such namespace: s", try deleting existing automatically generated specs/types before regenerating them. (git checkout works well here)



Reply with your generated specs & types!

Thanks,
Ambrose
Reply all
Reply to author
Forward
0 new messages