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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyjetbrains-1.1.0.tar.gz
.
File metadata
- Download URL: pyjetbrains-1.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4234f9927cca91fe0966b7182abf64f1512580bc37f677f96b16693f482ce4e |
|
MD5 | 04cb6778fd18bc3d4dfd87070153249d |
|
BLAKE2b-256 | 8505eaffb5d93ae30c371437f1ea1f013b2c09ca81587654729b4633459f20fc |
File details
Details for the file pyjetbrains-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: pyjetbrains-1.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be5b7562c9dc4b624cb88a29832e799b75bd52c68f23fc195c9b38f9aba10090 |
|
MD5 | a5cfdf1a451e005d50b67a6a54cfc889 |
|
BLAKE2b-256 | 776247cb6f430fb69ede7e719efb2d197691f454f69302755a4df3ce5ab3b8aa |