Skip to main content

Python package to take control over JetBrains IDEs

Project description

pyjetbrains

Take the control over JetBrains IDEs Family with python code!


Installation

Pyjetbrains can be installed via Python Package Index (PyPi) command:

pip install pyjetbrains

Features

  • Open IDE projects (whole folder)
  • Open files for editing
  • Open file at specific character and line
  • Compare multiple files
  • Format files
  • Currently supports Windows only, Linux and Mac comming soon!

It also tries to search for installed path on it's own, so you don't have to specify location of any of installed IDE inside pyjetbrains.

For Toolbox Users: Toolbox installs with CLI path automatically so it's much easier to find jetbrains IDE with toolbox.


Documentation

All pyjetbrains have required parameter of IDE as value of Enum.

All methods have their documentation visible while using IDE!

Checking if IDE is Installed

Before using any of pyjetbrains method, pyjetbrains automatically checks whether is desired IDE installed or not, but you can check it manually.

import pyjetbrains

pyjetbrains.is_installed(pyjetbrains.IDE.PYCHARM)

Opening files and folders

For opening files or folders (as project) there is subprocess.open() method.

import pyjetbrains

pyjetbrains.open(
    pyjetbrains.IDE.INTELLIJ_IDEA,  # IDE
    "hello_world.txt",              # Path
    line=5,                         # Line caret cursor position
    column=7                        # Column caret cursor position
)

pyjetbrains.open(
    pyjetbrains.IDE.CLION,                  # IDE
    "main.cpp", "hero.cpp", "vilain.cpp"    # Multiple Paths
)

my_paths = ["main.cpp", "hero.cpp", "vilain.cpp"]

pyjetbrains.open(
    pyjetbrains.IDE.PHPSTORM,   # IDE
    my_paths                    # Multiple paths passed as list
)

pyjetbrains.open(
    pyjetbrains.IDE.RUBYMINE,   # IDE
    "my_awesome_project"        # Folder which will open as project
)

Comparing files (2 up to 3 files)

Comparing files is done with pyjetbrains.compare_files() method, that takes from two to three files. After execution, difference tab of provided paths is opened.

import pyjetbrains

pyjetbrains.compare_files(
    pyjetbrains.IDE.PYCHARM,    # IDE
    "project1/main.py",         # First path
    "project2/main.py",         # Second path
    "project3/main.py"          # Third path
)

Formating files

For formatting files you cannot have already opened instance of desired IDE, because Jetbrains assumes that you can use format command in IDE rather than do it with CLI.

Then you specify files or folders with code to format it with and whether it should be recursive.

About mask, here is cite from jetbrains site:

Specify a comma-separated list of file masks that define the files to be processed. You can use the * (any string) and ? (any single character) wildcards.

import pyjetbrains

pyjetbrains.format_files(
    pyjetbrains.IDE.PYCHARM, # IDE
    "my_python_project",     # Paths to format (project folder in this case)
    mask="file??.py",        # File mask
    recursive=True           # Processing directories recursively
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjetbrains-1.1.0.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

pyjetbrains-1.1.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page