Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate from make to just #314

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

lucabello
Copy link

@lucabello lucabello commented Dec 9, 2024

This PR shows how you would replace make with just.

My detailed thoughts on the matter are summarized in this Discourse post, but I'll post here my main conclusions from that post:

  • just recipes are easier to run, better documented, and more clearly explained to the user;
  • just recipes are more robust and can let you require tools and environment variables;
  • just is easier to write and maintain;
  • make is ubiquitous, but just has a snap (and you can technically run justfiles with uv instead of just).

The Makefile here is extremely simple (recipes with no parameters, or ALL the positional arguments), so some benefits are not visible here.

How do I run things?

just will show you the available commands:

∮ just
Available recipes:
    clean                 # Cleanup transient files
    fmt                   # Format the code
    generate-requirements # Generate requirements.txt from pyproject.toml
    integration *args=''  # Run integration tests
    lint                  # Lint the code
    lock                  # Update uv.lock with the latest deps
    unit *args=''         # Run unit tests

If you want to pass parameters to a recipe, simply specify them after:

# Don't do:
# ARGS="-k test_charm_basic" make integration

# Do:
just integration -k test_charm_basic

What if I don't want an extra dependency?

Read this section of my Discourse post.

I still recommend snap-installing just, but if you really don't want an extra dependency (even though we just had tox around, we're essentially swapping it):

  1. use a shebang: #!/usr/bin/env -S uvx --from=rust-just just --justfile
  2. chmod +x justfile
  3. now you can run ./justfile without just on your system

    clean                 # Cleanup transient files
    fmt                   # Format the code
    generate-requirements # Generate requirements.txt from pyproject.toml
    integration *args=''  # Run integration tests
    lint                  # Lint the code
    lock                  # Update uv.lock with the latest deps
    unit *args=''         # Run unit tests
@jnsgruk jnsgruk self-requested a review December 9, 2024 14:07
CONTRIBUTING.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants