# How do you write library wrappers?

**URL:** https://clojureverse.org/t/how-do-you-write-library-wrappers/9932
**Category:** How to?
**Created:** [April 8, 2023, 7:27am UTC](https://clojureverse.org/t/how-do-you-write-library-wrappers/9932 "2023-04-08T07:27:56Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![joinr](https://clojureverse.org/user_avatar/clojureverse.org/joinr/32/1861_2.png) [@joinr](https://clojureverse.org/u/joinr)
#### Post date: [April 8, 2023, 10:55am UTC](https://clojureverse.org/t/how-do-you-write-library-wrappers/9932/3 "2023-04-08T10:55:02Z")

</div>

I use [import-vars](https://github.com/clj-commons/potemkin#import-vars) for this kind of plumbing. I have seen projects that have a common facing api that want to pass through references to the dependent ns or coalesce stuff in a common api (like [tech.v3.dataset.api](https://github.com/techascent/tech.ml.dataset/blob/master/src/tech/v3/dataset_api.clj#L53) using a similar mechanism via the `export-symbols` macro).

So one strategy might be to write something like:

```clojure
(ns mycsv 
   (:require [clojure.data.csv] 
             [potemkin :as pot]))

(pot/import-vars 
   [clojure.data.csv
   read-csv
   write-csv])

(defn my-stuff [arg] 
  ;;use your imagination
  )

```

In another ns:

```clojure
(ns blah 
   (:require [mycsv :as csv]))

;;public vars from mycsv should be exposed, including imports:

;;csv/my-stuff 
;;csv/read-csv - should actually map to clojure.data.csv/read-csv e.g. if you look at the doc string
;;csv/write-csv - same

```

---

_[View the full topic](https://clojureverse.org/t/how-do-you-write-library-wrappers/9932)._
