generated from labteral/python-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
# python-package | ||
Python Package Boilerplate | ||
# safemode | ||
Replace the Python process with a shell when starting up if a key is pressed during a grace period. | ||
|
||
## Install | ||
```bash | ||
pip install safemode | ||
``` | ||
|
||
## Usage | ||
Just import the library in the first line of your Python script. The grace period can be configured through the `SAFEMODE_GRACE_PERIOD` environment variable. The default value is 5 seconds. | ||
|
||
main.py | ||
```python | ||
import stopover | ||
print('Hello World') | ||
``` | ||
git clone https://github.com/brunneis/python-package | ||
cd python-package | ||
./rename.sh | ||
|
||
Safe mode: | ||
```sh | ||
$ python main.py | ||
[safemode] To start a shell, press any key before 5 seconds... | ||
$ | ||
``` | ||
|
||
Normal execution: | ||
```sh | ||
$ python main.py | ||
[safemode] To start a shell, press any key before 5 seconds... | ||
[safemode] Starting up normally... | ||
Hello World | ||
``` |