Project Initialization Cheatsheet
Here's a quick cheatsheet to get barebones repos setup in the few languages I still attempt side projects in.
Elixir, because it's graceful, and I enjoyed learning it last year.
Python, because it's the only thing my dad still writes.
And Javascript (eventually) - I still feel unclear about package manager tradeoffs there. I'll leave myself some breadcrumbs to pick up again the next time I make something functional.
Before we begin - I assume you're on a Mac and have brew installed.
Python
Useful for everyday scraping and scripting.
Prerequisites
I have fought with Python virtual environments and lost. I'm currently in favor of uv, which seems to avoid most of that pain (as much as I can tell from my cursory pass).
brew install uv
Validation
Run this to make sure you have Python 31 installed:
python --version
> Python 3.9.10
Run this if you can't remember whether you have uv
:
uv version
> uv 0.5.11 (Homebrew 2024-12-20)
Setup
Once ready, here's all you need:
uv init hello_python
cd hello_python
# adding a linting package
uv add ruff
uv run ruff check
# lints your code with python / package version specified by the project
The above does the following:
- creates a directory
/hello_python
and runsgit init
inside - specifies your Python version in
pyproject.toml
- adds
ruff
as a dependency and installs it - configures installed versions in
uv.lock
- runs the lint command in the project based on your tagged Python version
Easy enough.
Elixir
I'm hoping to only use Elixir for full stack / DB-backed toy projects (no more Ruby + Rails). It also fits well with code puzzles like Advent of Code and Project Euler.
Prerequisites
You should have recent versions of Elixir and Erlang on your machine. If you don't, start here.
This should also get you hex
, the Elixir and Erlang package manager.
Validation
Run the following to validate your language versions:
elixir --version
> Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
>
> Elixir 1.15.5 (compiled with Erlang/OTP 26)
Setting up a basic Elixir project
For a simple project (ex: ), use the following command (from the mix new tasks docs):
mix new hello_elixir
...
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating lib
* creating lib/hello_elixir.ex
* creating test
* creating test/test_helper.exs
* creating test/hello_elixir_test.exs
Your Mix project was created successfully.
You can use "mix" to compile it, test it, and more:
cd hello_elixir
mix test
Run "mix help" for more commands.
The above does the following:
- creates a directory
/hello_elixir
and runsgit init
inside - specifies your Elixir version in
mix.exs
- puts dummy application logic in
lib/hello_elixir.ex
- configures a trivial test and helper inside
/test/...
Setting up an Elixir and Phoenix app
The quick and dirty installation and setup commands:
# install the Phoenix CLI
mix archive.install hex phx_new
# scaffold a new app called "groundhog"
mix phx.new groundhog
If you're coming from Ruby on Rails, this should feel quite familiar.
A more robust walkthrough on Phoenix setup and deployment can be found elsewhere on this blog here.
Javascript
⚠️ Under construction! ⚠️
I need stronger opinions here before writing something down.