Skip to content

marc-dantas/sned

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sned Alpha

Sned (SNake EDitor) is a minimalistic Python code editor written 100% in Python programming language.

Sned was a very old project (originally named Snake Editor) I've already written al ongside @Kamasoo, but I lost the project files. So I decided to rewrite it.

The goal of Sned is to be an fan-made alternative to the built-in IDLE with high customization capabilities. If you are new in Python or want to contribute this is also a good project for you.

Sned is also built to be an educational project. Not means to be used in production.

Getting things running

NOTE: You need an instance of the Python interpreter version 3.9 or higher and pip installed.

Installing Dependencies

If you are a Unix/Linux user, make sure to install the full standard library of Python 3 before using Sned:

  • Debian/Ubuntu based systems:
    $ sudo apt install libpython3-stdlib

Could not find the equivalents for Arch and Fedora based systems. If you find one of these or both, please make a pull request.

Using Sned

To install it now, you need to install Sned via pip:

$ python -m pip install git+https://github.com/marc-dantas/sned.git#egg=sned

Now you can use it:

$ python -m sned

Developer Milestones

  • Base project
  • Improved layout
  • Dark mode (see customization section below for more information)
  • Line numbers
  • Python package

Tutorial

Usage

Sned has a very simple command line interface to add some simple functionality to the user.

usage: sned [-h] [-r RESOLUTION] [-s SETTINGS]

Sned CLI

options:
  -h, --help            show this help message and exit
  -r RESOLUTION, --resolution RESOLUTION
                        changes the window resolution.
  -s SETTINGS, --settings SETTINGS
                        changes the settings file path to be read.

Copyright (c) 2024 @marc-dantas. This software is licensed under MIT License.

Configuration

It works with configuration files. By default, Sned will search for the file settings.json in the current directory. If you want Sned to load other configuration file, you can use the -s (--settings) flag via command line:

$ python -m sned # This will search for default `./settings.json`
$ python -m sned -s foo.json # This will search for `foo.json`

Configuration Format

The configuration format is very simple:

  • editor: Text editor configuration
    • font: Name of the font used in the text editor
    • font_size: Size of the font used in the text editor
    • tab_size: Amount of spaces inserted when [TAB] is pressed.
    • background: Background of the application
    • foreground: Foreground (text color) of the application
  • syntax: Syntax highlighting customization
    • COMMENT: Python comment color (e.g. # ram spam eggs)
    • KEYWORD: Python keyword color (e.g. def, if, import)
    • BUILTIN: Python built-in function or name color (e.g. print, filter, any)
    • STRING: String literal color (e.g. "Hello World!")
    • DEFINITION: Definition literal color (function, class, etc.)

Here's an example configuration file:

{
  "editor": {
    "font": "Consolas",
    "font_size": 20,
    "tab_size": 4,
    "foreground": "#000000",
    "background": "#FFFFFF"
  },
  "syntax": {
    "COMMENT": "#6A9955",
    "KEYWORD": "#0000FF",
    "BUILTIN": "#267F99",
    "STRING": "#B51515",
    "DEFINITION": "#795E26"
  }
}

Customization

Sned was always meant to be a very customizable Python editor. So, in this repository, there's a folder templates where you can find two different configuration files with specific color settings. To load them, just use the command line flag -s (--settings) to use the themes.

NOTE: Inside the editor you can customize the theme in the Settings window (shortcut: Ctrl+.)

  • Light theme (lighttheme.json)
    $ python -m sned -s templates/lighttheme.json
  • Dark theme (darktheme.json)
    $ python -m sned -s templates/darktheme.json

If you do not provide the configuration file, Sned will use the settings.json file.


By @marc-dantas

By @Kamasoo

About

A minimalistic and customizable Python code editor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages