Porcupine is an editor written with the notorious Tkinter library. It supports most things you would expect from an editor, such as autocompletions and syntax highlighting.
Most important features:
- Syntax highlighting with Pygments (supports many programming languages and color themes, extensible)
- Autocompletions when pressing tab
- Jump to definition with Ctrl+click
- Langserver support
- Editorconfig support
- Git support
- Compiling files inside the editor window
- Running files in a separate terminal or command prompt window
- Automatic indenting and trailing whitespace stripping when Enter is pressed
- Indent/dedent block with Tab and Shift+Tab
- Commenting/uncommenting multiple lines by selecting them and typing a #
- Highlighting matching parentheses
- Line numbers
- Line length marker
- Find/replace
- Code folding
- Multiple files can be opened at the same time like tabs in a web browser
- The tabs can be dragged out of the window to open a new Porcupine window conveniently
Porcupine also has a very powerful plugin API, and most of the above features are implemented as plugins. This means that if you know how to use Python 3 and tkinter, you can easily customize your editor to do anything you want to. In fact, the plugin API is so powerful that if you run Porcupine without plugins, it shows up as an empty window.
See below.
Open a terminal and run these commands:
sudo apt install python3-tk python3-pip
sudo apt install --no-install-recommends tkdnd # for drop_to_open plugin
python3 -m pip install --user --upgrade pip wheel
python3 -m venv porcupine-venv
source porcupine-venv/bin/activate
python3 -m pip install https://github.com/Akuli/porcupine/archive/v0.99.2.zip
porcu
If you want to leave Porcupine running and use the same terminal for something else,
you can use python3 -m porcupine &
instead of python3 -m porcupine
.
To run porcupine later, you need to activate the virtualenv before running it:
source porcupine-venv/bin/activate
porcu
You can uninstall Porcupine by deleting porcupine-venv
.
Install Python 3.7 or newer with pip and tkinter somehow. If you want drag and drop support, also install tkdnd for the Tcl interpreter that tkinter uses. Then run these commands:
python3 -m pip install --user --upgrade pip wheel
python3 -m venv porcupine-venv
source porcupine-venv/bin/activate
python3 -m pip install https://github.com/Akuli/porcupine/archive/v0.99.2.zip
porcu
If you want to leave Porcupine running and use the same terminal for something else,
you can use python3 -m porcupine &
instead of python3 -m porcupine
.
To run porcupine later, you need to activate the virtualenv before running it:
source porcupine-venv/bin/activate
porcu
You can uninstall Porcupine by deleting porcupine-venv
.
I don't have a Mac. If you have a Mac, you can help me a lot by installing Porcupine and letting me know how well it works.
I think you can download Python with tkinter from python.org and then run the commands for "other Linux distributions" above.
Download a Porcupine installer from the releases page and run it. Because I haven't asked Microsoft to trust Porcupine installers, you will likely get a warning similar to this one:
You should still be able to run the installer by clicking "More info". When installed, you will find Porcupine from the start menu.
See CHANGELOG.md.
You will likely get syntax highlighting without any configuring and autocompletions with a few lines of configuration file editing. See the instructions on Porcupine wiki.
Please install the latest version. If it still doesn't work, let me know by creating an issue on GitHub.
Yes. I wrote the very first version in nano
, but Porcupine has changed a lot since.
I think because I didn't find other projects named porcupine, but I don't remember exactly. Originally, Porcupine was named "Akuli's Editor".
Maybe it can, see the more_plugins directory. If you don't find what you are looking for, you can write your own plugin, or alternatively, you can create an issue on GitHub and hope that I feel like writing the plugin for you.
Because I can.
Because I can.
See porcupine/X.py or porcupine/plugins/X.py.
Because Porcupine is better.
Of course not. IDLE is an awful mess that you should stay far away from.
Porcupine is meant to be a serious editor, in fact you might regret even touching it. https://www.youtube.com/watch?v=Y3iUoFkDKjU
If you want to do something to Porcupine, that's awesome! I have tried to make contributing easy:
- Some issues are labeled as "good first issue".
- If you don't understand what I meant in an issue, please ask me to clarify it. I have written most issues so that I understand what I wrote, and if you are new to Porcupine, you likely need a longer explanation to understand what the problem is.
- Don't worry about asking too many questions! It's not annoying, and if you create several pull requests after I answer all your questions, I think answering the questions was definitely worth it.
- There is not much boilerplate involved in the contributing process. You just create a pull request and that's it. You can choose an issue and start working on it, without prior permission. Instead of working on an issue, you can also create something that you would like to have in an editor.
- You don't need to read anything before you can get started. I recommend having a look at the Porcupine plugin API docs, but that's not required.
- Don't worry too much about whether your code is good or not. I will review the pull requests and try to help you out. There are also checks running on GitHub Actions.
You can talk with me on GitHub issues, or chat at ##learnpython on libera. I am on ##learnpython at about 6PM to 10PM UTC.
To get started, make a fork of Porcupine with the button in the top right corner of this page. Then install Python 3.7 or newer and git, and run these commands:
git clone https://github.com/YourUserName/porcupine
cd porcupine
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
python3 -m porcupine
This should run Porcupine. If you change some of Porcupine's
code in the porcupine
directory and you run python3 -m porcupine
again, your changes
should be visible right away.
Windows-specific notes:
- You need to use
py
instead ofpython3
when creating the venv, andenv\Scripts\activate
instead ofsource env/bin/activate
to activate it. - If creating the venv fails with an error message like
Error: [Errno 13] Permission denied: ...\\python.exe
, try creating the venv into a different folder. It is created into whatever folder you are currentlycd
'd to (i.e. the folder that shows up on the command prompt before the>
).
After doing some development and closing the terminal that you set up the
environment in, you can go back to the environment by cd
'ing to the correct
place and running source env/bin/activate
again. You can run deactivate
to undo
the source env/bin/activate
.
Here is a list of the commands I use when developing Porcupine:
- Git commands. I'll assume that you know how to use Git and GitHub.
- Type checking with mypy:
mypy porcupine more_plugins
python3 -m pytest
runs tests. You will see lots of weird stuff happening while testing, and that's expected. A good way to debug a test to see what is actually going on is to add traces. It pauses the test to show you the current state of the program.- Use
import pdb
andpdb.set_trace()
to set the pause points in the test. You can set as many as you like, and it can conveniently be done on one line:import pdb; pdb.set_trace()
. - When the test pauses, type
cont
in terminal to continue the test. - If you at any time need to interact with the program during the pause,
type
interact
in terminal. Exit interactive mode withctrl + D
.
- Use
- Code formatting tools:
black porcupine/
andisort porcupine/
- To see a report of test coverage, add
--cov=porcupine
to the above pytest command and then runcoverage html
. Openhtmlcov/index.html
in your favorite browser to view it. cd docs
followed bypython3 -m sphinx . build
creates HTML documentation. Opendocs/build/index.html
in your favorite browser to view it.- Linter commands run automatically on pull request or push. Usually I don't run them on my computer.
I also use these commands, but I don't recommend running these yourself. Instead, ask me to run them if you need to.
-
python3 scripts/release.py major_or_minor_or_patch
increments the version number and runs all the commands needed for doing a new Porcupine release. Run it from inside a virtualenv with master or bugfix-release branch checked out in git, and withCHANGELOG.md
updated. The argument works like this:major
: version goes0.bla.bla --> 1.0.0
(porcupine becomes stable)minor
: version goes0.71.4 --> 0.72.0
(backwards-incompatible changes)patch
: version goes0.71.3 --> 0.71.4
(bug fixes without breaking compatibility)
Docs and Windows exe are built automatically after running the release script (see
.github/workflows/on-release.yml
), butporcupine.wiki
may need manual updating.