An example of a package developed with pyenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.
Project description
Pyfarmsay
Expanding on the existing package, pycowsay, pyfarmsay does not only feature a talking cow, but an entire talking farm! Our beautiful farm features a talking cow, pig, chicken, dog, penguin, and sheep.
Install
To install our package on your local machine, run the following command:
pip install pyfarmsay
To install into a virtual environment, make sure you install pipenv by running the following:
pip install pipenv
and then use the following command to install our package into an isolated virtual environment.
pipenv install pyfarmsay
This will create a virtual environment, which you can access by running pipenv shell
Run
Once pyfarmsay is installed on your machine (or virtual environment), you can use it from the command line or from within a python file.
From the Command Line
To run the package from the command line, all you have to do is invoke the package name, followed by the animal of your choice and your desired message:
pyfarmsay [ANIMAL] [MESSAGE]
For example,
pyfarmsay cow i say moo
will output
-----------
< i say moo >
-----------
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
Import into a python module
Use the following import statement at the very top of your .py
file to use the functions from within your module.
from pyfarmsay import pyfarmsay
or
from pyfarmsay.pyfarmsay import [function name]
Build and Test the package
To build and test our package for yourself, make sure to have pipenv installed.
Install our package into a virtual environment following the instructions above.
Run:
pipenv shell
Install build into the virtual environment using:
pip install build
Build the project using:
python3 -m build
To test, install pytest from the virtual environment shell using:
pip install pytest
Run unit tests using:
python3 -m pytest tests/test
Package functions
Pyfarmsay comes with the following 7 main functions, each accepting a message argument: Use the following command to run the program:
python3 ex_2.py [ANIMAL] [MESSAGE]
cowsay
(usecow
for the animal argument if you are invoking the function from the command line)pigsay
(usepig
for the animal argument if you are invoking the function from the command line)chickensay
(usechicken
for the animal argument if you are invoking the function from the command line)sheepsay
(usesheep
for the animal argument if you are invoking the function from the command line)penguinsay
(usepenguin
for the animal argument if you are invoking the function from the command line)dogsay
(usedog
for the animal argument if you are invoking the function from the command line)farmsay
(usefarm
for the animal argument if you are invoking the function from the command line)
Our animals can only repeat what you tell them to say, so if no message is given, each animal will call out their native animal sound.
Authors
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
Hashes for pyfarmsay-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b87911bb28d8800ca56ee40d789a0369d6a1f673ebb225fd4f63de91697723d |
|
MD5 | d74878209e9ade31f830a16921c3af33 |
|
BLAKE2b-256 | 6a3d73c80b9b37bbaeeb7e3761005926f750f78d5a1f26cda976b25572574fb8 |