Programming can at times be enjoyable, but it surely is frustrating when you find yourself repeating tasks. Repeatedly typing long multi-line inputs as I try to test and improve my code has been one of these frustrating moments for me. This small project is an attempt in improving the development process of single-file python programs, as well to document my progress with Python.
- Easier Testing: Store inputs as a text file and a test command for easier testing
- Version Control: Create a copy of the current program and its output to be able to easily compare file differences or go back to a previous version
- This project was developed with VS Code in mind. Using other Integrated Development Environments(IDEs) might lead to a different user experience
- This project was developed for efficiently making single-file Python programs intended for submission in OJ(DMOJ)
-
Clone or download
Create a copy of this project by either cloning the repository or downloading the project as a zip file and unzipping it
git clone https://github.com/ming-suhi/single-file-python-development.git
-
Open in VS Code
Open the project in VS Code and a terminal in the project's root directory
-
Create a new project
Create a new project by running the following command, replacing
<projectName>
with your desired project namepy -m create --name="<projectName>"
-
Edit input and expected output
Now you will see a newly created folder for your project. Edit
input.txt
with the test inputs you wish to test andexpected-output.txt
with the outputs your are expecting -
Write your program
Create your program in
index.py
like how you normally would -
Run your tests
To test your program in the terminal run
py -m testing.test --project="<projectName>"
To save a copy of the current program and its output run
py -m testing.test --project="<projectName>" --save="<fileName>"
The copy is stored as
.txt
file that can be found in thestream
directory of your project
MIT © Kyle Taton