A Stepik CLI for students
Project description
stepik-cli
A command line interface for the Stepik API
Commands
$ stepik --help
Usage: stepik [OPTIONS] COMMAND [ARGS]...
The (unofficial) Stepik CLI for students
A command line tool for submitting solutions to stepik.org
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
auth Authenticate using your OAuth2 credentials.
content View the content of a course, section, or lesson by its ID.
course Switch to the course that has the provided course ID.
courses Display a list of your enrolled courses and their course IDs.
current Display the URL and step ID of the current step.
dataset Attempt a dataset challenge.
lang Lists the available programming languages for the current step.
next Navigate to the next step in a course.
prev Navigate to the previous step in a course.
step Navigate the current position to the step at the provided URL.
submit Submit a solution to stepik.
text Display the contents of the current step.
type Filter for steps with this step type.
Installation
Via conda
:
conda install -c conda-forge 'aryarm::stepik-cli'
Via pip
:
pip install stepik-cli
Setup
-
Create an account on stepik.org
-
Enroll in courses
-
Create a new OAuth2 application with the following information
- Name: stepikcli
- Client type: confidential
- Authorization Grant Type: client-credentials
- Redirect uris: N/A (ie leave this field blank)
Save the client ID and client secret for later use (see #4 below)
-
Authenticate yourself with the CLI
stepik auth
Enter the client ID and client secret from #3 above
-
View a list of the course IDs for each of your courses. Pick one of them to submit your solutions to.
stepik courses
-
Set the current course. You can always change this later.
stepik course <course-id>
For this command, replace
<course-id>
with the course ID you chose in #5.
Navigation
Just like the Stepik website, you can navigate between steps within your chosen course.
Once you've navigated to a step, the CLI will remember your position in the course.
Setting your current step
To start, you must jump to a step within the course:
stepik step <url>
You should replace <url>
with the link to the step (ex: https://stepik.org/lesson/9172/step/2
)
You can check your current position in the course at any time.
stepik current
You can also view the content of the current step.
stepik text
Navigating to the next or previous step
Once you've navigated to a step, you can move back or forth within the course.
stepik next
# or
stepik prev
Each step has a type that describes its content. For example, steps containing dataset challenges will have the dataset type. When navigating between steps, you can instruct the Stepik CLI to filter for a specific step type. To set the step type, use the type
command.
stepik type dataset
Viewing the table of contents of a course
Each course is made up of sections. Each section is made up of lessons. And each lesson is made up of steps.
You can view the content at any level of this hierarchy.
stepik content course <course-id>
stepik content section <section-id>
stepik content lesson <lesson-id>
Submissions
To submit a solution to a problem, you must first set the current step.
stepik step <url>
You should replace <url>
with the link to the step (ex: https://stepik.org/lesson/9172/step/2
)
Attempting a dataset challenge
To submit to a dataset challenge, you should first download a dataset from this step.
stepik dataset <dataset-path>
You should replace <dataset-path>
with the path to a file in which you'd like to store the dataset.
Submitting a solution
To submit to a dataset challenge, you must first write your solution to a file.
stepik submit <solution-path>
You should replace <solution-path>
with the path to the file that contains your solution.
Attempting a code or text challenge
To submit to a code or text challenge, you should use the -l
optional argument to specify the programming language of your submission.
stepik submit -l python3 solution.py # to submit to a code challenge
stepik submit -l text solution.txt # to submit to a text challenge
You can view a list of the available programming languages.
stepik lang
Example: Submitting to a dataset challenge
As an example, let's consider this dataset challenge. To follow along, you must first register for this course on the Stepik website and complete the setup process, including the authentication step.
# switch to this course
stepik course 1
# set the step
stepik step https://stepik.org/lesson/9172/step/2
# view the problem statement
stepik text
# download the dataset
stepik dataset dataset.txt
# solve the problem and create a solution file
cat dataset.txt | tr ' ' '+' | bc > solution.txt
# submit the solution
stepik submit solution.txt
Help
Every command in the CLI has a --help
argument with more detailed descriptions.
Bugs, Contributions, and Suggestions
I welcome reports of bugs and/or suggestions for improvements to this software within Github's issue tab.
However, I have limited capacity to maintain the code in this repository. If you would like to see a bug fixed, consider forking this repository and creating a pull request. I will gladly consider all submitted pull requests!
I am not a member of the Stepik team. Nor am I in any way affiliated with them. I make no guarantee that this software will not eventually break, especially if Stepik ever changes their API.
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 stepik-cli-0.4.2.tar.gz
.
File metadata
- Download URL: stepik-cli-0.4.2.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | accb51e0a7576c481d6ea7c79292a651847ea392bba27ea338a487346c5ace7e |
|
MD5 | ab227ea9626ab63543350366874ed361 |
|
BLAKE2b-256 | 905cbccbcb40d4e6ab33848f5cc046ab8cbe999c42f1c14861e2b2bf17899423 |
File details
Details for the file stepik_cli-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: stepik_cli-0.4.2-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c26fe763bb4980e75a4859d8644744fef2911d9527a555744df4cbc9e918d6c |
|
MD5 | dfb83f820f10a7ceafda4020eb3476c3 |
|
BLAKE2b-256 | 53258ebb2045d090f1ee9591dcec15fe777e6f27db708e61526d1ad186bbf79b |