leet2git 0.2.1

Creator: bigcodingguy24

Last updated:

Add to Cart

Description:

leet2git 0.2.1

leet2git











This repository tries to automate the steps needed to integrate your leetcode answers with github.
This includes:

Importing a question:

generates the question file,
generates the test file (python3 only),
updates the README


Submiting a question solution
Importing the latest accepted solution for each question with a single command

Installation
To install the needed libraries, activate a virtual environment (recommended) and run:
$ pip install leet2git

Install from Source
To install from source, download this repository, navigate to the folder and run:
$ pip install -e .[dev]

Usage
Currently, it is necessary to log into leetcode on either chrome or firefox before running the commands.
$ leet2git --help
Usage: leet2git [OPTIONS] COMMAND [ARGS]...

Options:
--version Show the version and exit.
-s, --source-repository TEXT The path to the folder where the code will be saved.
Overrides the default config
-l, --language TEXT The language to run the command.
Overrides the default config
--help Show this message and exit.

Commands:
delete Delete a question and its files
get Generates all the files for a question
import-all Get all solutions and generate their files
init Creates a new configuration file and can generate a git repository.
reset Reset the configuration file
run Run a question on Leetcode Servers
submit Submit a question to Leetcode

Init Repository
Navigate to the source repository and run:
$ leet2git init --help
Usage: leet2git init [OPTIONS]

Creates a new configuration file and can generate a git repository.

Options:
-s, --source-repository TEXT the path to the folder where the code will be saved
-l, --language TEXT the default language
-c, --create-repo generates a git repository

Running this command will open the configuration file in the default editor.
Dowloading All Submissions
To download the latest accepted submission for each solved problem:
$ leet2git import-all

Downloading a Question to Solve
To generate the files of a given question:
$ leet2git get --help
Usage: leet2git get [OPTIONS] QUESTION_ID

Generates all the files for a question

Args: question_id (int): the question id

Running a Question
To run a question on leetcode servers:
$ leet2git run --help
Usage: leet2git submit [OPTIONS] QUESTION_ID

Run a question on Leetcode Servers

Args: question_id (int): the question id

Submitting a Question
To submit a question to leetcode:
$ leet2git submit --help
Usage: leet2git submit [OPTIONS] QUESTION_ID

Submit a question to Leetcode

Args: question_id (int): the question id

Removing a Question
To remove a downloaded problem (delete files and remove from readme):
$ leet2git delete --help
Usage: leet2git delete [OPTIONS] QUESTION_ID

Delete a question and its files

Args: question_id (int): the question id

Reset Repository
Warning: This will delete the current question database and cannot be undone. Navigate to the source repository and run:
$ leet2git reset --help
Usage: leet2git reset [OPTIONS]

Reset the configuration file

Options:
-s, --source-repository TEXT the path to the folder where the code will be saved
-l, --language TEXT the default language
--soft (default) / --hard A soft reset only erases the database.
A hard reset also erase the files.

Running this command will open the configuration file in the default editor.
Configuration
Running either the init or the reset command will open the configuration file in the default editor.
The file location will also be printed in the terminal, so you can edit in manually later.
Example Configuration
{
"language": "python3",
"source_path": "path_to_repository",
"readme": {
"show_difficulty": true,
"show_category": true
},
"source_code": {
"add_description": true
},
"test_code": {
"generate_tests": true
}
}

language
The default language the Download/Submit the questions. Can be overriden when running a command with the -l option.
Available Options:

"bash"
"c"
"cpp"
"csharp"
"golang"
"java"
"javascript"
"kotlin"
"mysql"
"php"
"python"
"python3"
"ruby"
"rust"
"scala"
"swift"

source_path
The path to the code repository
readme

show_difficulty: If true, will generate an extra section on README with different tables for each difficulty.
show_category: If true, will generate an extra section on README with different tables for each category.

source_code

add_description: If True, will add the problem description as comments in the source file.

test_code

generate_tests: If true, will try to generate local test files for the question. Currently only python3 is supported.

Language Support



Language
Generate/Import Question
Generate Local Tests
Submit/Run Question
Auto Import/Include Libraries




bash
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


c
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


cpp
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


csharp
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


golang
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


java
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


javascript
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


kotlin
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


mysql
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


php
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


python
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


python3
:heavy_check_mark:
:heavy_check_mark:
:heavy_check_mark:
:large_orange_diamond:


ruby
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


rust
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


scala
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:


swift
:heavy_check_mark:
:x:
:heavy_check_mark:
:x:



:heavy_check_mark:: Fully Supported
:large_orange_diamond:: Partially Supported
:x:: Not Supported
After stabilizing the code, I am planning to improve the language suport. Contributions are always welcomed ;)
Contributors ✨
Thanks goes to these wonderful people (emoji key):





Yuri Rocha💻
sungho-joo💻 🐛





This project follows the all-contributors specification. Contributions of any kind welcome!

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.