An example of a package developed with pyenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.
Project description
PyPrankError
PyPrankError is a Python package that lets the user create silly (or serious) error messages, stack traces, crash reports, and hacked messages for a pranks purpose.
Team members
link to our package's page on the PyPI website
How to Install and Use
Install pipenv
if you have not already done so: pip install pipenv
In your project directory, run pipenv install -i https://test.pypi.org/simple/ pyprankerror==1.0.2
.
(If you get error, include python -m
before pipenv.)
Or if it does not work, run pip install pyprankerror==1.0.2
To activate virtual environment: pipenv shell
Now import pyprankerror to use it your own program:
from PyPrankError import pyprankerror
(If import gives back error, change it to import pyprankerror
)
Documentation for all functions:
generate_hacked_message(is_long, is_silly)
Description: Returns a message that makes it look like the user is being hacked. Return nothing.
- is_long (bool): False indicates shorter output, True indicates longer output.
- is_silly (bool): True indicates silly less realistic and silly variable and function names.
generate_stacktrace(length, is_silly)
Description: Prints a fake stack trace and returns nothing.
- length (int): 0 indicates short (9 lines) output, 1 indicates long (26 lines) output.
- is_silly (bool): True indicates less realistic and silly variable names in the stack trace.
generate_crash_report(is_long, is_silly)
Description: Prints a fake crash report
- is_long (bool): False indicates shorter (19 lines) output, True indicates longer output (38 lines).
- is_silly (bool): True indicates a silly and less realistic crash report.
generate_error(err_type, isSilly)
Description: Returns a fake error message
- err_type (str): Indicate a “syntax”, “runtime” or “logical” error type.
- is_silly (bool): True indicates silly and less realistic and crash report.
Example project
Run python example-program.py
How to contribute
To test, build, and distribute with GitHub repo code
- To contribute to our package, please clone this repository.
- Move into the project directory and proceed to following steps:
- Install
pipenv
if you have not already done so:pip install pipenv
- If you have already installed but cannot use
pipenv
, usepython -m pipenv
for allpipenv
commands instead. - Activate the virtual environment and install project dependencies with pipenv:
pipenv --python 3.x
# Replace '3.x' with your desired Python version - Activate the virtual environment:
pipenv shell
(You might need to installpipenv
in the virtual environment again if you receive error when activating it.) - Install project dependencies, including dev packages:
pipenv install --dev
- Test the source code with Pytest from the main project directory:
pytest
- Install build if you haven't:
pip install build
- When you are satisfied with the change and wish to build and distribute, make the build:
python -m build
, increment the version number, and then upload to GitHub or PyPI depending on the need of the developers.
To test, build, and distribute with package from PyPI
- Try installing and using your package in a separate Python project
- Install
pipenv
if you have not already done so:pip install pipenv
- Create a pipenv-managed virtual environment and install the latest version of your package installed:
pipenv install -i https://test.pypi.org/simple/ pyprankerror==1.0.2
(Note that if you've previously created a pipenv virtual environment in the same directory, you may have to delete the old one first. Find out where it is located with the pipenv --venv command.) - Activate the virtual environment:
pipenv shell
- Write test code. Note that when testing a PyPI package, the import statement should look like
from PyPrankError import pyprankerror
. If you use any test code from the repository, remove thesrc.
in the import statements. - Test the source code with Pytest from the root directory:
pytest
- Install build if you haven't:
pip install build
- Include a pyproject.toml file. You can copy from the repository and increment the version number.
- When you are satisfied with the change and wish to build and distribute, make the build:
python -m build
and then upload to GitHub or PyPI depending on the need of the developers.
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.