Skip to main content

HelloNexus

A simple yet powerful greeting library with repeat functionality.

Installation

python -m pip install hellonexus

Quick Start

from hellonexus import hellonexus as hn

# Print "Hello, World!" once
hn.say()

# Print "Hello, World!" 5 times
hn.say(5)

# Print with custom message
from hellonexus.hellonexus import HelloNexus

nexus = HelloNexus("Welcome to Nexus!")
nexus.say(3)

Features

  • ✅ Repeat functionality - Print greetings 1-indexed times
  • ✅ Flexible input - Accepts integers or strings as repeat count
  • ✅ Keyboard Interrupt handling - Graceful Ctrl+C handling
  • ✅ EOF handling - Graceful EOF (Ctrl+D) handling
  • ✅ Call counter - Track how many times you've greeted
  • ✅ Custom messages - Personalize your greetings
  • ✅ Module-level functions - Quick and easy usage
  • ✅ Class-based design - Object-oriented approach
  • ✅ Type hints - Better IDE support and code quality
  • ✅ Unit tested - Comprehensive test coverage

Why choose HelloNexus?

Feature HelloNexus Other HelloWorld programs
Repeat functionality ✅ ❌
1-indexed counting ✅ ❌
Keyboard interrupt handling ✅ ⚠️
EOF handling ✅ ❌
Call counter ✅ ❌
Custom messages ✅ ✅
Type hints ✅ ⚠️
Unit tests ✅ ❌
Module-level functions ✅ ❌
Object-oriented design ✅ ⚠️
String repeat support ✅ ❌
Graceful error handling ✅ ❌

Usage Examples

Basic Usage

from hellonexus import hellonexus as hn

# Single greeting
hn.say()  # Output: 1: Hello, World!

# Multiple greetings
hn.say(3)  # Output: 1: Hello, World!
           #         2: Hello, World!
           #         3: Hello, World!

Using Strings as Input

hn.say("4")  # Works with string numbers too!

Custom Messages

from hellonexus.hellonexus import HelloNexus

nexus = HelloNexus("Welcome to the Nexus!")
nexus.say(2)
# Output:
# 1: Welcome to the Nexus!
# 2: Welcome to the Nexus!

Tracking Calls

nexus = HelloNexus()
nexus.say(3)
print(nexus.get_call_count())  # Output: 3

nexus.reset()  # Reset counter to 0
print(nexus.get_call_count())  # Output: 0

Graceful Interrupt Handling

nexus = HelloNexus("Press Ctrl+C to stop")
nexus.say(100)  # Press Ctrl+C to interrupt gracefully
# Output: [Interrupted] Goodbye from HelloNexus!

API Reference

HelloNexus Class

__init__(default_message: str = "Hello, World!")

Create a new HelloNexus instance with optional custom message.

say(repeat: Optional[Union[int, str]] = None) -> None

Print the greeting message, optionally repeated.

  • repeat=None: Prints once
  • repeat=int: Prints that many times
  • repeat=str: Converts to int and prints that many times
  • Raises ValueError for invalid values

get_call_count() -> int

Returns the total number of successful say() calls.

reset() -> None

Resets the call counter to 0.

Module-Level Function

say(repeat: Optional[Union[int, str]] = None) -> None

Convenience function that uses a global HelloNexus instance.

Error Handling

HelloNexus handles errors gracefully:

# Invalid repeat values raise ValueError
hn.say("invalid")  # ValueError: Invalid repeat value: 'invalid'. Must be a number.
hn.say(0)          # ValueError: Repeat must be positive, got 0
hn.say(-5)         # ValueError: Repeat must be positive, got -5
hn.say([1,2,3])    # TypeError: Repeat must be int, str, or None, got list

Development

Run Tests

python -m pytest tests/

Run Examples

python examples/basic_usage.py

License

MIT License - Copyright (c) 2026 Light Bulb Experiments

Release files for hellonexus 1.0.0

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

Source distribution (sdist)

Source distribution for hellonexus 1.0.0
File Size Uploaded
hellonexus-1.0.0.tar.gz 5.1 kB Details

Built distribution (wheel)

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

Total release size: 9.8 kB

Release files / hellonexus-1.0.0.tar.gz

Download URL hellonexus-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1b4e6c615198585326632e6bd3f14e0ca2436e931f46c95138acab5a37ee9357
BLAKE2b-256 checksum
How to use checksums
e168ab68c247cf0c9530396a46696d70a911b10c961d2dfe64b53d1b826da56e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / hellonexus-1.0.0-py3-none-any.whl

Download URL hellonexus-1.0.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee320f3214123f1241094ee2e854931c95964cc50bbff77dc7a8ec666f08269f
BLAKE2b-256 checksum
How to use checksums
34feeb296e0881b4aaa282b36eb30feeaa49a04c2a4fa19abb6c9fc5e45a9f9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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