• Stars
    star
    106
  • Rank 325,871 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 12 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An JSON+HTTP server for the rope Python refactoring library

Build Status License: MIT

Traad: A Python refactoring server

Traad is an refactoring server for Python code. It listens for HTTP requests to perform refactorings, performs them, and allows clients to query for the status. There is also talk from EuroPython 2014 with design description and some live demo: https://www.youtube.com/watch?v=NvV5OrVk24c

Setup

To use traad you'll normally need both the server and a client.

Emacs

The only client code (that I know of) is the emacs-traad package for Emacs. emacs-traad is able to install the server for you, so if you're using it you should just need to follow its setup instruction.

Installing the server with pip

If you just want to install the most recent release of the Python server components (i.e. this project), you can use pip:

pip install traad

Installing the server from source

If you want to install the server from source - perhaps because you're doing development on it - you should first clone the repository:

git clone https://github.com/abingham/traad

Then you can install everything with setup.py:

cd traad
python setup.py install

Python 2 vs. Python 3

Note that if you install traad into a Python 3 environment, the server name will be traad3. If you install it into a Python 2 environment it will simply be traad. This makes it somewhat simpler to have system-wide installations of both on systems with both Python 2 and 3.

Tests

traad has a suite of tests in the tests directory. They are based on pytest. In order to run them, go to the project's root directory (i.e. the one containing this README) and use:

pytest tests

Rationale

I (the author of traad) use emacs for most of my Python development, and I've often been jealous of the cool refactoring tools that my colleagues get with their fancy IDEs. Not jealous enough to actually switch, of course. I'm way to stubborn for that. But I was jealous enough that I investigated the options available for emacs.

One of the best options available is the rope Python refactoring library. Rope is very powerful and does all of the things I'd like. Unfortunately, I could never find a satisfactory way of integrating it into emacs. The pymacs-based approaches never quite worked for me, and in any case that approach struck me as somehow incorrect.

So, in the spirit of open-source development, I decided to try my own approach. I wanted a way to access rope functionality without having to contort either emacs or Python in unnatural ways. Thus the idea of using a client-server approach was born. It may strike others as odd or incorrect, but it works well for me.

Design

Traad is a client-server approach to using the rope Python refactory library. It involves two basic components:

  1. A HTTP server exposing the rope API via JSON, and
  2. Client libraries (currently just emacs lisp) for talking to the server

The hope is that this approach will make it easier - at least in some cases - to use rope from various other tools.

Since rope is written in Python, any tool that wants to use rope needs to either embed Python, or it needs to find a way to communicate with a Python process running rope. The embedding approach is difficult if the target environment is not written in Python, and it also faces challenges when dealing with more than one Python version.

So traad aims to simplify communication with rope running in an independent process. HTTP communication and JSON data handling is well supported in many, many languages, so any environment that wants to use rope should be able to easily communicate with traad.

More Repositories

1

emacs-ycmd

Emacs client for ycmd, the code completion system.
Emacs Lisp
384
star
2

flycheck-vale

Flycheck integration for the vale natural language linter
Emacs Lisp
64
star
3

jupyter-elm-kernel

A Jupyter kernel for running Elm code.
Python
63
star
4

codesearch.el

An emacs extension for using the codesearch sourcecode indexer.
Emacs Lisp
47
star
5

emacs-traad

Emacs client for the traad Python refactoring tool.
Emacs Lisp
40
star
6

outline-toc.el

Table-of-contents sidebar for Emacs.
Emacs Lisp
39
star
7

prosjekt

A emacs extension for working with "projects"
Emacs Lisp
22
star
8

emacs-codesearch

Emacs package for working with Google's codesearch tools.
Emacs Lisp
15
star
9

categories-for-programmers

A sphinx project for Bartosz Milewski's book "Categories for Programmers"
Python
15
star
10

cython-sphinx-example

Demonstration of Cython function signatures in Sphinx documentation
Python
13
star
11

boost_python_tutorial

An IPython Notebook-based tutorial on Boost.Python
Python
12
star
12

spor

externalized source code metadata
Rust
12
star
13

docopt-subcommands

Create subcommand-based command-line programs with docopt
Python
12
star
14

python-transducers

Transducers for Python.
Python
9
star
15

accu-2017-elm-app

An Elm-based web app for the ACCU 2017 schedule
Elm
8
star
16

elisp_rough_intro

A rough introduction to emacs lisp
Emacs Lisp
3
star
17

pitacard

a flashcard program
Python
3
star
18

vector_translator

Convertes from stl vectors to python lists and back again (boost.python)
C++
3
star
19

ultan

Python name and documentation provider
Python
2
star
20

therapy

Emacs hooks for switching between Python major version.
Emacs Lisp
2
star
21

pyloc

a simple tool for counting lines of python code
Python
2
star
22

spacemacs-layers

My private spacemacs layers
Emacs Lisp
2
star
23

spacemacs-cheatsheet

Just my notes while learning spacemacs (i.e. vim in emacs)
2
star
24

outta

Parsing escape sequences and control codes.
Python
2
star
25

traad_rope_presentation

A presentation on traad and rope
JavaScript
2
star
26

emacs_config

emacs configuration
Emacs Lisp
2
star
27

org-babel-python-guide

Notes and instructions on using Python with org-mode and babel in Emacs.
2
star
28

spotify_ctl

A script for controlling spotify on linux via dbus.
Python
1
star
29

misc

misc
Python
1
star
30

breathe_test

A test project for demonstrating issues and features with breathe
Python
1
star
31

mandelbrot

Doodling around with mandelbrot generation in python.
1
star
32

roid-rage-rust

Rusty roid rage.
Rust
1
star
33

surl

A URL extractor and browser launcher for mutt, like urlview.
Python
1
star
34

python-testing-presentation

Presentation on testing in Python
Jupyter Notebook
1
star
35

elm-yasnippets

elm-mode yasnippets for Emacs
Emacs Lisp
1
star
36

emacs-ivy-ycmd

Ivy integration with ycmd
Emacs Lisp
1
star
37

bespoke

Library for creating simple Python classes without the boilerplate.
Python
1
star
38

vsc-spor

Spor integration with VS Code
TypeScript
1
star
39

eagertools

Eager versions of Python's itertools module
Python
1
star
40

aight-fish-theme

A theme for fish.
Shell
1
star
41

rosalind-go

Rosalind implementation in go
Go
1
star
42

ao-toolbox

A collection of tools for working with AO fracture classifications
Python
1
star
43

python-version-probe

A tool to probe python source code for its major language version.
Python
1
star
44

see_stats

A web-based system for viewing Python profiling data
CSS
1
star
45

decktape.io

Website for running decktape conversions.
JavaScript
1
star
46

prosemirror-tauri

Small experiment using ProseMirror with Tauri
CSS
1
star
47

pb11-noodling

Python
1
star