# Convert project code to a package (and maintain git commit history)

**URL:** https://discourse.julialang.org/t/convert-project-code-to-a-package-and-maintain-git-commit-history/43438
**Category:** General Usage
**Tags:** question, package
**Created:** [July 21, 2020, 4:57pm UTC](https://discourse.julialang.org/t/convert-project-code-to-a-package-and-maintain-git-commit-history/43438 "2020-07-21T16:57:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)
#### Post date: [July 21, 2020, 4:57pm UTC](https://discourse.julialang.org/t/convert-project-code-to-a-package-and-maintain-git-commit-history/43438/1 "2020-07-21T16:57:34Z")

</div>

I have some code in a project directory that is being tracked by git. The project directory looks like this:

```julia
MyProj/
├── .gitignore
├── .git
│ └── # .git folder
├── Manifest.toml
├── Project.toml
├── examples
│ ├── example1.jl
│ └── example2.jl
├── run
│ ├── run1.jl
│ └── run2.jl
└── src
    ├── code1.jl
    └── code2.jl

```

The Project.toml file looks like this:

```julia
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DecisionTree = "7806a523-6efd-50cb-b5f6-3fa6f1930dbb"
LIBSVM = "b1bec4e5-fd48-53fe-b0cb-9723c09d164b"
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJLinearModels = "6ee0df7b-362f-4a72-a706-9e79364fb692"
MLJModels = "d491faf4-2d78-11e9-2867-c94bc002c0b7"
XGBoost = "009559a3-9522-5dbb-924b-0b6ed2b22bb9"

```

What would be the most robust way to turn this project into a package? Of course I want to maintain my git history by continuing to use the same git repository.

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [July 21, 2020, 5:08pm UTC](https://discourse.julialang.org/t/convert-project-code-to-a-package-and-maintain-git-commit-history/43438/2 "2020-07-21T17:08:15Z")

</div>

I could be wrong but I’m first so that makes it ok.

I think you just need to create a `MyProj.jl` file under `src` which defines a Module of the same name. You should also add the identifier lines to the top of the Project.toml file

```julia
name = "MyProj"
uuid = "a-long-uuid"
authors = "Your Name "
version = "0.1.0"

```

the only thing I can’t exactly remember is how to manually generate the `uuid`. There is a function in `Pkg.jl` that does it, look for it there. If you can’t find it, just make a fake package elsewhere with the same name, and copy its `uuid` over lol (only half joking).

Of course adding `docs` and `test` toplevel folders (with content) is also recommended.

---

<div class="post-metadata">

### Author: ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)
#### Post date: [July 21, 2020, 5:25pm UTC](https://discourse.julialang.org/t/convert-project-code-to-a-package-and-maintain-git-commit-history/43438/3 "2020-07-21T17:25:20Z")

</div>

Thanks! It looks like the [Pkg docs](https://julialang.github.io/Pkg.jl/v1/toml-files/#The-uuid-field-1) recommend using `UUIDs.uuid4()` to generate a UUID. [`UUIDs`](https://docs.julialang.org/en/v1/stdlib/UUIDs/) is a module in the standard library, so the UUID can be generated like this:

```julia
using UUIDs
id = uuid4()

```
