dckc / madmode-blog

my tinkering notebook (blog)
https://www.madmode.com
0 stars 2 forks source link

mypy for python2 project (heron-admin) with nix and direnv #191

Closed dckc closed 1 year ago

dckc commented 5 years ago

I'd like to add static typing to a new module in heron-admin. And, of course, I'd like to have emacs flycheck give real-time feedback.

I tried:

(use-package direnv
 :config
 (direnv-mode))

from https://github.com/wbolster/emacs-direnv

but I got:

Error (use-package): direnv/:config: Symbol’s function definition is void: file-attribute-size

Turns out file-attribute-size was added in Emacs 26.1 (https://github.com/alphapapa/org-web-tools/commit/e7abbfbd3ea7f277302656249b239eda3de40c94)

This would be nice:

Essentially what I do in my projects is use the following .envrc: ... -- https://nixos.org/nix-dev/2016-September/021635.html

use nix

I tried it, but starting mypy or even just python would give me:

AttributeError: module 'enum' has no attribute 'IntFlag'

cf https://stackoverflow.com/questions/43124775/why-python-3-6-1-throws-attributeerror-module-enum-has-no-attribute-intflag

Somehow the python2 site-packages were getting pulled into python3 runs. (Of course, now I can't reproduce it.)

Thinking maybe the unstable nix channel was to blame, I tried falling back to the 19.03 stable release; but then I was in real trouble:

dconnolly@bid-bse02:~/projects/heron-admin$ . ~/.nix-profile/etc/profile.d/nix.sh 
dconnolly@bid-bse02:~/projects/heron-admin$ nix search -u nix
warning: Nix search path entry '/home/dconnolly/.nix-defexpr/channels/nixpkgs' does not exist, ignoring
dckc commented 5 years ago

related: idris with packages for ERTP

https://ariya.io/2016/06/isolated-development-environment-using-nix

dckc commented 1 year ago

I'm no longer working on heron-admin. and python2 is fading