Skip to content

Switch to using Justfile instead of Makefile#61

Open
blag wants to merge 1 commit into
mainfrom
switch-to-justfile
Open

Switch to using Justfile instead of Makefile#61
blag wants to merge 1 commit into
mainfrom
switch-to-justfile

Conversation

@blag

@blag blag commented Aug 29, 2025

Copy link
Copy Markdown
Collaborator

This switches the project away from using a Makefile to using a Justfile. This utilizes Just (installation packages/commands available here).

The Justfile creates a virtualenv in .venv and uses it within subsequent recipes. Activating the virtualenv manually is not required when running Just recipes. However, part of my intent here was to allow developers -- after they had activated that virtualenv manually with . .venv/bin/activate -- to simply run commands normally, like tox and pytest, and produce the same result. Meaning that I tried to keep CLI tool configuration flags (like pytest --cov --cov-branch) out of the Justfile and in normal configuration files like tox.ini and pyproject.toml.

I also outlined the intended building and publishing process in the README.


A few notes...

The build process currently throws up the following warning:

SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!

        ********************************************************************************
        Please consider removing the following classifiers in favor of a SPDX license expression:

        License :: OSI Approved :: MIT License

        See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
        ********************************************************************************

!!

It's not an error yet, so I say we ignore it for this release and fix it in the next one.

Additionally, when Twine checks the built distributables, it emits this warning:

Checking dist/django_email_log-1.5.0-py3-none-any.whl: FAILED
ERROR    `long_description` has syntax errors in markup and would not be rendered on PyPI.
         line 71: Warning: "include" directive disabled.
Checking dist/django_email_log-1.5.0.tar.gz: FAILED
ERROR    `long_description` has syntax errors in markup and would not be rendered on PyPI.
         line 71: Warning: "include" directive disabled.
error: Recipe `dist` failed on line 44 with exit code 1

I think the issue is the include directive for the changelog in the README, because this patch fixes it:

diff --cc README.rst
index cec70fe,cec70fe..ec57484
--- a/README.rst
+++ b/README.rst
@@@ -67,5 -67,5 +67,3 @@@ Thanks to the following related project
  .. _django-celery-email: https://github.com/pmclanahan/django-celery-email
  .. _django-post_office: https://github.com/ui/django-post_office
  .. _stackoverflow answer: http://stackoverflow.com/a/7553759/98187
--
--.. include:: CHANGES.rst

@treyhunner I'm not sure what you wanted to do about this, so I left it alone. If we do nothing, I think PyPI will display the unrendered rST README verbatim, but I have not confirmed this.

@blag blag requested a review from treyhunner August 29, 2025 20:37

@treyhunner treyhunner left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few commits in a separate branch to show some things I've been doing in my just files. One of them also renames the file to lowercase (jusfile instead of Justfile). For some reason, my text editor will syntax highlight the lowercased name but not the uppercased version.

I like self-documenting tasks and hiding tasks that I probably won't ever call directly (by using an _ prefix).

I also like using task groups, but there aren't many tasks in this project, so I didn't add a commit for that, as it may not be worthwhile yet.

Feel free to pull any or all of those changes or take inspiration from them in this branch.

Comment thread Justfile
venv-test: venv
.venv/bin/python3 -m pip install .[test]

init: venv-build venv-test

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is missing a venv-docs:

init: venv-build venv-test venv-docs

Comment thread Justfile
@@ -0,0 +1,50 @@
all: init docs clean test

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I often like to make the default just command do the the equivalent of just --list --unsorted because I often forget which commands various projects include.

Thoughts on something like this?

_default:
    @just --list --unsorted

@treyhunner

Copy link
Copy Markdown
Owner

Additionally, when Twine checks the built distributables, it emits this warning

Odd! I see the changes listed on PyPI currently: https://pypi.org/project/django-email-log/

I wonder whether PyPI changed or whether this still works. If the include still works, maybe we should just ignore this warning.

Comment thread Justfile
find . -name '*~' -exec rm -f {} +

venv:
if [[ ! -d .venv ]]; then python3 -m venv .venv; fi

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemed to be an error in my shell (ZSH):

...
if [[ ! -d .venv ]]; then python3 -m venv .venv; fi
sh: 1: [[: not found
.venv/bin/python3 -m pip install .[build]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be pretty bog standard Bash/ZSH - I developed that using ZSH myself. Is your Just shelling out to sh instead of zsh?

Can you copy and paste that command out of the justfile and straight into your shell? If it works then Just is doing something interesting.

@treyhunner

Copy link
Copy Markdown
Owner

Additionally, when Twine checks the built distributables, it emits this warning

Odd! I see the changes listed on PyPI currently: https://pypi.org/project/django-email-log/

I wonder whether PyPI changed or whether this still works. If the include still works, maybe we should just ignore this warning.

I just tried to deploy a release and PyPI rejected the README as invalid:

ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
         The description failed to render for 'text/x-rst'. See https://pypi.org/help/#description-content-type for
         more information.

Removing it worked, so I think we need to remove that include for future releases to be valid.

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