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

Justify + Nixify #339

Draft
wants to merge 13 commits into
base: dev
Choose a base branch
from
Draft

Justify + Nixify #339

wants to merge 13 commits into from

Conversation

bohendo
Copy link
Contributor

@bohendo bohendo commented Jan 3, 2023

Introduces 2 new files: justfile and flake.nix in the project root. These provide a few new commands that are helpful for developers:

  • just build: build an executable which will be available via a symlink at ./result/bin/crytic-compile
  • just install: after building, install the built result (aka add it to PATH) so that it's available by just typing crytic-compile
  • just dev: pre-packaged, hermetically sealed dev environment, no virtualenvwrapper needed. This command will open a new shell that exposes a temporary and hot-reloadable crytic-compile, this executable will update when the source code changes for a quick and easy tweak/check cycle. (TODO: this works nicely with nix-shell shell.nix but is not hot-reloadable via flake.nix, I should fix this)
  • just lint: runs black, darglint, mypy, and pylint code formatters/linters
    • just black: runs only the black code formatter (ditto for the other lint commands)
  • just test: runs all available tests (only hardhat and monorepo tests for now, more coming soon)
    • just test-hardhat: runs only the hardhat tests locally (also works with monorepo)

Keep in mind:

  • The above commands require nix and just to be installed. If nix is already installed, you can install just with nix-env -iA nixpkgs.just or add it to your configuration.nix file if you're using NixOS/nix-darwin.
  • The above commands utilize isolated dependencies so they will not interfere with any other python tools that you've already installed via homebrew, apt, pip, virtualenvwrapper, etc.
  • The prev point is nice but it has a downside: on the first run, all dependencies need to be downloaded so it will take some time and plenty of bandwidth. The second run of just lint should take on the order of 20 seconds and negligible bandwidth. Luckily, if some other project requires the same dependencies, they'll be cached & won't need to be downloaded again. The dependencies required to run the build, dev, and lint commands overlap but are not identical so each one will take a while to run the first time.
  • The above is accomplished without modifying any of the existing configuration files. If you dislike just and/or nix, ignore these few new files & continue developing as you always have, nothing else should be impacted.

bohendo added 11 commits January 3, 2023 12:55
use python 3.9 in some linters

consolidate linter CI workflows

debug lint ci

rm custom bash setup

set NIX_PATH

setup cachix

give cachix a name

set nixpkgs channel

rm nix path setter

log linter versions

enable cachix

pin nixpkgs in mypy

disable non-lint workflows for easier ci debugging

install mypy types before linting

tweak type installation

make mypy noninteractive

clean up

hack mypy linter
@bohendo bohendo changed the title WIP: Justify + Nixify Justify + Nixify Jan 6, 2023
@bohendo bohendo marked this pull request as draft February 1, 2023 20:15
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


bohendo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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