Arrr.py - Pirate Speak for Python

A simple script / module to turn plain English into Pirate speak. Arrr.

Someone mentioned something called “Pirate Python”, I idly wondered if anyone had made an English to Pirate-ish module/command written in Python (they hadn’t), I realised I had a burning desire to make one, and things got out of hand. :-)

We have an entirely serious code of conduct and a not-so-serious code of mis-conduct for those of a more Piratical disposition.

Installation

To install simply type:

$ pip install arrr

…and the package will download from PyPI. If you wish to upgrade to the latest version, use the following command:

$ pip install --no-cache --upgrade arrr

Command Usage

Once installed, you’ll find you have a pirate command to use in your shell.

To read the (non-Pirate friendly) help, simply type:

$ pirate --help

or:

$ pirate -h

To translate plain English into something Pirate-ish simply call the command followed by some English sentence:

$ pirate hello there. how are you today?
Ahoy there. Weigh anchor and hoist the mizzen! How are ye today?

The pirate command will reply with a Pirate-ish equivalent (as shown above).

Note

This software misbehaves like a Pirate.

Sometimes, the pirate command will not only translate English to Pirate-ish, but will also interject with Pirate sayings (such as, “Weigh anchor and hoist the mizzen!” as shown above).

This is entirely normal and perfectly Piratical behaviour. What else were you expecting..?

Using the API

The arrr module’s API is fully documented below. All you really need is to import the translate function and use that to return Pirate-ish sentences from a given input in English:

from arrr import translate


english = "Hello there. How are you?"
pirate = translate(english)
print(pirate)

The script above will print output similar to that for the command-line usage example shown above.

Development

The source code is hosted in GitHub. Please feel free to fork the repository and contribute. Assuming you have Git installed you can download the code from the canonical repository with the following command:

$ git clone https://github.com/ntoll/arrr.git

Ensure you have the correct dependencies for development installed by creating a virtualenv and running:

$ pip install -r requirements.txt

Pull requests are most welcome! Honestly, the arrr module was cobbled together in about 5 minutes and I went overboard (geddit?) with creating a simple yet well packaged and documented project so arrr can act as a good example for beginner developers.

If you find any bugs, submit a new issue.

Contributing to Arrr

Ahoy there, matey! Many thanks for wanting to improve Arrr.

Contributions are welcome without prejudice from anyone irrespective of age, gender, religion, race or sexuality. If you’re thinking, “but they don’t mean me”, then we especially mean YOU. Good quality code and engagement with respect, humour and intelligence wins every time.

  • If you’re from a background which isn’t well-represented in most geeky groups, get involved - we want to help you make a difference.
  • If you’re from a background which is well-represented in most geeky groups, get involved - we want your help making a difference.
  • If you’re worried about not being technical enough, get involved - your fresh perspective will be invaluable.
  • If you think you’re an imposter, get involved.
  • If your day job isn’t code, get involved.
  • This isn’t a group of experts, just people. Get involved!
  • We are interested in educational, social and technical problems. If you are too, get involved.
  • This is a new community. No-one knows what they are doing, so, get involved.

We expect contributors to follow the Python Software Foundation’s Code of Conduct: https://www.python.org/psf/codeofconduct/

Feedback may be given for contributions and, where necessary, changes will be politely requested and discussed with the originating author. Respectful yet robust argument is most welcome.

Finally, contributions are subject to the following caveat: the contribution was created by the contributor who, by submitting the contribution, is confirming that they have the authority to submit the contribution and place it under the license as defined in the LICENSE file found within this repository.

Checklist

  • Your code should be commented in plain English (British or Pirate spelling).
  • If your contribution is for a major block of work and you’ve not done so already, add yourself to the AUTHORS file following the convention found therein.
  • We don’t have tests because THEY’RE FOR LANDLUBBERS!
  • If in doubt, ask a question. The only stupid question is the one that’s never asked.
  • Most importantly, Have fun!

Arrr!

API

A module for turning plain English into Pirate speak. Arrr.

arrr.get_version()[source]

Returns a string representation of the version information of this project.

arrr.main(arrrgv=None)[source]

Entry point for the command line tool ‘pirate’.

Will print help text if the optional first argument is “help”. Otherwise, takes the text passed into the command and prints a pirate version of it.

arrr.translate(english)[source]

Take some English text and return a Pirate-ish version thereof.

Release History

1.0.0.beta.3

  • Better arrrg parsing contributed by Tony “buccaneer baloney” Shaw.
  • Corrections of speeling mistaiks by Esteve “make mine an Aranjuez” Fernandez.

1.0.0.beta.2

  • Major code optimizations by old salty sea dog Terry Jones.
  • A more terrifying logo by Cap’n Steve “Inkspot” Hawkes.
  • Addition of a code of mis-conduct (for Pirates) by terror of the seas, Tim “No beard” Golden.

1.0.0.beta.1

  • Minor documentation fixes.
  • Minor corrections in the code.

1.0.0.alpha.1

  • Initial release.
  • Very simple implementation.
  • Documentation.
  • No tests.

License

Copyright (c) 2017 Nicholas H.Tollervey.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.