GithubHelp home page GithubHelp logo

joshkarpel / dis-cli Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 0.0 825 KB

Display Python source code and bytecode side-by-side at the command line

License: MIT License

Python 100.00%
bytecode command-line-tool dissassembler python

dis-cli's Introduction

Hello Worlds!

I'm Josh Karpel!

Interests:

  • 🐍 Python
  • πŸ¦€ Rust
  • 🦺 Typescript
  • πŸ§ͺ Testing
  • ⌨️ CLI Tools
  • πŸ•ΈοΈ Distributed Systems

I'm currently a Software Engineer in Machine Learning at Workday. I design and develop systems for serving machine learning models.

Before that, I was a postdoc at the Morgridge Institute for Research / Center for High-Throughput Computing. I facilitated high-throughput computing projects that involved machine learning, image processing, and Python. I also helped maintain the HTCondor Python Bindings and worked on projects like HTMap. Before that, I got a PhD in Physics at the University of Wisconsin-Madison in the Yavuz Group, working on simulating interactions between quantum systems and high-power lasers.

dis-cli's People

Contributors

dependabot[bot] avatar joshkarpel avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dis-cli's Issues

Module-level code can print output

If you have something like

# foo.py

print("hi")

def bar(x):
    return x

then

$ dis foo.bar
hi
3 def bar(x):                                                                                       3 OFF              OPERATION                                               ARGS
4     return x                                                                                      4 0                LOAD_FAST                                               0                   x
                                                                                                      2                RETURN_VALUE

The hi should not appear in the output.

Module-level exceptions do not produce a nice error message

Example:

# foo.py

raise Exception

def bar(x):
    return x

Output:

$ dis foo.bar
Traceback (most recent call last):
  File "/home/jtk/.python/envs/dis-cli/bin/dis", line 33, in <module>
    sys.exit(load_entry_point('dis-cli', 'console_scripts', 'dis')())
  File "/home/jtk/.python/envs/dis-cli/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/jtk/.python/envs/dis-cli/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/jtk/.python/envs/dis-cli/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jtk/.python/envs/dis-cli/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/mnt/c/Users/joshk/projects/dis-cli/dis_cli.py", line 40, in cli
    for idx, disp in enumerate(
  File "/mnt/c/Users/joshk/projects/dis-cli/dis_cli.py", line 51, in make_source_and_bytecode_display_for_targets
    for func in map(find_function, targets):
  File "/mnt/c/Users/joshk/projects/dis-cli/dis_cli.py", line 64, in find_function
    obj = importlib.import_module(module_path)
  File "/home/jtk/.python/envs/dis-cli/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/c/Users/joshk/projects/dis-cli/foo.py", line 1, in <module>
    raise Exception
Exception

We should print a nice message to give some context to what's happening, followed by the underlying exception.

Allow "collective" targets

  • Targeting a module should target all of its direct contents (using the same discovery logic as for suggestions).
  • Targeting a class should target all of its methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.