Skip to main content

Hapy Logo

Hapy - Write Python in Hausa with braces!

Hapy is a simple programming language that uses Hausa vocabulary and compiles to Python. Originally as a final year school project.

Installation

Hapy can be installed using pip (pre-release versions)

note: Hapy is still in development so it might change a lot before full release. You can still join us for the ride!

pip install hapy

If you have installation problems on Windows, try installing Python from the Python website gan and not Microsoft Store.

Check if Hapy is accessible globally, open a new Command-line/terminal and run hapy --help. If you're not seeing Hapy your Python packages directory may not be in PATH or some other pip/python issue. We noticed all problems disappear when we get Python from their website.

Usage

All these commands are to be run in the command line:

hapy --help - prints the help message

hapy --version or hapy -v - prints the installed Hapy version

hapy or hapy repl - launches the REPL. Exit via exit(), or Ctrl-C. Pass --english to use Hapy english vocabulary.

hapy <filename> - execute a script. Hapy uses .hapy file extension. For example: hapy lagbaja.hapy. Pass --compile-only to just print the compiled script or you can pass --save to save the compiled Python in a file.

hapy run <filename> - same as above.

hapy do "<code to evaluate>" - compiles and executes Hapy code as a string. Pass --compile-only to skip execution or pass --english/-e to use Hapy english vocabulary.

More options on the way :)

Example

Let's say 'ayyana' is def keyword in Hausa and 'buga' is the print keyword. Sample Hapy code

    # example.hapy

    # wannan sharhi ne
    ayyana muje(){
        nuna("Let's Goooooo");
    };

    muje();

Python output after running hapy example.hapy --save

    # example.ha.py

    # wannan sharhi ne
    def muje():
        print("Let's Goooooo")

    muje()
    >>> "Let's Goooooo"

Contributing

OH MY GOSH 😂😭, WE'RE SO DESPERATE FOR CONTRIBUTIONS THAT WE'RE LITERALLY BEGGING FOR PULL REQUESTS 🙏🏼💻! WE'RE SERIOUSLY ABOUT TO START CRYING OVER HERE. PLEASE, PLEASE, PLEASE SEND A PR AND MAKE OUR DAY. WE'LL LOVE YOU FOREVER AND EVER ❤️🤗.

Documentation

on it's way...

Hausa -> English Dictionary

key (Hausa): value (English)

keywords = {
     "in": "if",
    "kokuma": "elif",
    "then": "then",
    "indai": "while",
    "ma": "for",
    "karo": "import",
    "tsarin": "class",  #Changed from irin to tsarin(structure) in 0.5.0
    "yanada": "has",
    "gada": "inherits",
    "anfani": "use",
    "wuce": "pass",
    "daga": "from",
    "imbahakaba": "else",
    "cikin": "in",
    "Babu": "None",
    "dawo": "return",
    "ayyana": "def",
    "Gaskiya": "True",
    "Karya": "False",
}

operators_words = {
    "ba": "not",
    "da": "and",
    "ko": "or",
    "shine": "=",
    "cikin": "in",
    "of": "of",
    "ba cikin": "not in",
    "is equal": "is equal",
    "is not equal": "is not equal",
    "times": "*",
    "hada": "+",
    "raba": "/",
    "chire": "-"
}

builtin_functions = {
    "__farada__": "__init__",
    "__donnunawa__": "__repr__",
    "nuna": "print",
    "iri": "type",
    "tsakanin": "range",
    "kirga": "len",
    "rubuta": "input",
    "duka": "all",
    "tace": "filter",
    "koyar": "help",
    "id": "id",
    "lissafta": "eval",
}

Goals

  • Be able to write code in Hausa
  • Support some Python constructs
  • Have a limited set of custom modules :)
  • Be able to upload and install other snippets (called bites) online [soon...]

Non-goals / Limitations

  • Hapy won't try to support all Python things.
  • Error messages are not the best currently and won't be translated
  • No multi-file Hapy packages, only single file modules (called bites)
  • Performance has not been measured yet

Differences with Python syntax

  • For design and implementation reasons, Hapy uses braces :-)
  • I'm not exactly sure why but Hapy requires semi-colons at the end of statements :-(
  • We have some arithmetic word operators such as plus, times
  • Classes are different. More details in the (soon to come) docs

Standard library

On it's way...

Noticed something wrong with Hapy or have a suggestion?

SEND A PR MY BROTHA/SISTA or create an issue on the github

Other projects

On it's way...

Credits and inspiration

Similar projects

  • Yorlang: Yoruba language programming language (Nodejs/Javascript)
  • Enkelt: Swedish language programming language Enkelt (Python)

License

Hapy is released under the MIT License

Reference

If you found Hapy useful enought to cite, please cite using the following BibTeX:

@software{segunlean2021,
  author = {Segun-Lean, Emmanuel and Wuta, Shugaba},
  title = {Hapy: Hausa Programming Language},
  month = December,
  year = 2021,
  url = {https://github.com/hapy-lang/hapy}
}

Metadata

Release files for hapy 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hapy 0.5.3
File Size Uploaded Provenance Actions
hapy-0.5.3.tar.gz 29.2 kB Without provenance Details for hapy-0.5.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hapy 0.5.3
File Interpreter ABI Platform Actions
hapy-0.5.3-py3-none-any.whl Python 3 none any Details for hapy-0.5.3-py3-none-any.whl

Total release size: 67.4 kB

Release files / hapy-0.5.3.tar.gz

Download URL hapy-0.5.3.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
28d32158bc5d9068afc7ee98f96ef95760ae2dfc93d31387aaa01285e861b201
BLAKE2b-256 checksum
How to use checksums
a6a0cda63b42c6dc69a4afd0986d8b8fb9c3a6ef779ab425c3f2ceb3aa4b3a98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / hapy-0.5.3-py3-none-any.whl

Download URL hapy-0.5.3-py3-none-any.whl
Size 38.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
080cd77993f2b0f623d82e2a2db73497f3e0a797957a0fb75506b6ed69258428
BLAKE2b-256 checksum
How to use checksums
c976ac7740fdabe8a65a2ae957940e1b66500b66a9e60de38aff880bdc73f8f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Security for hapy 0.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page