Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- name: Run syntax check
run: python -m compileall src/hangmanultimate
- name: Run tests
run: python -m pytest
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

## [Unreleased]
### Added
- Continuous integration workflow to verify the package builds.
- Contributing guidelines for new contributors.
- Expanded README with usage instructions.
- Basic test suite and project-level `.gitignore`.

### Changed
- Adopted a modern `src`-based layout with `pyproject.toml` packaging.
- Updated runner script and contribution guide for the new structure.

## [1.0.2] - 2019-10-24
- Initial release on PyPI with multiple word lists (Animals, Pokemons, Fruits, Countries, Bollywood Movies).
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing

Thank you for considering contributing to HangMan!

## Setting up the project

1. Fork the repository and clone your fork.
2. Create a virtual environment and activate it.
3. Install dependencies:
```
pip install -r requirements.txt
```
4. *(Optional)* Install the project in editable mode:
```
pip install -e .
```
5. Run a quick syntax check:
```
python -m compileall src/hangmanultimate
```
6. Execute the test suite:
```
python -m pytest
```

## Pull requests

- Use a feature branch for your work.
- Ensure the syntax check passes before submitting.
- Update documentation and add tests when applicable.
- Describe your changes in the pull request.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include README.md
include hangmanultimate/data/*.txt
include src/hangmanultimate/data/*.txt
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,36 @@
[![Downloads](https://pepy.tech/badge/hangman-ultimate/month)](https://pepy.tech/project/hangman-ultimate/month)
[![Downloads](https://pepy.tech/badge/hangman-ultimate/week)](https://pepy.tech/project/hangman-ultimate/week)

A character user interface of the popular game hangman
A character user interface of the popular game hangman.

![HANGMAN OPENING](https://github.com/devarshi16/HangMan/blob/master/hangman_ultimate.gif)

```
## Features
- Play directly in the terminal with colourful ASCII graphics.
- Choose from multiple word lists: Animals, Pokemons, Fruits, Countries and Bollywood Movies.
- Available as a command line tool after installation.

## Installation
```bash
pip install hangman-ultimate
```
OR run directly using the runner file.

## Usage
Start the game from anywhere using the console script:
```bash
hangman-ultimate
```
Or run the runner file directly:
```bash
python hangman-runner.py
```
Find the tutorial for the above repo on my [blog](https://attackonalgorithms.wordpress.com/2019/10/24/slightly-non-trivial-implementation-of-cli-hangman-a-hands-on-python-tutorial/)

![Terminal screenshot](hangman_terminal.png)

## Contributing
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and guidelines.

## Changelog
Detailed release notes are available in [CHANGELOG.md](CHANGELOG.md).

Find the tutorial for the project on my [blog](https://attackonalgorithms.wordpress.com/2019/10/24/slightly-non-trivial-implementation-of-cli-hangman-a-hands-on-python-tutorial/).
12 changes: 11 additions & 1 deletion hangman-runner.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
"""Run the hangman game without installing the package."""

from pathlib import Path
import sys

# Allow running from the project root when using the src layout
sys.path.append(str(Path(__file__).resolve().parent / "src"))

from hangmanultimate.hangman import main
if __name__ == '__main__':


if __name__ == "__main__":
main()
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "hangman-ultimate"
version = "1.0.2"
description = "A Game of Hangman"
readme = "README.md"
requires-python = ">=3.5"
license = {file = "LICENSE"}
authors = [{name = "devarshi16", email = "devershigpt6@gmail.com"}]
keywords = [
"hangman",
"hangman-game",
"python-tutorial",
"hangman-python",
"terminal-game",
"game",
"pokemon",
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.5",
"License :: OSI Approved :: MIT License",
"Operating System :: Unix",
]
dependencies = [
"readchar>=2.0.1",
"termcolor>=1.1.0",
]

[project.urls]
Homepage = "https://github.com/devarshi16/HangMan"

[project.scripts]
"hangman-ultimate" = "hangmanultimate.hangman:main"

[tool.setuptools]
package-dir = {"" = "src"}

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
hangmanultimate = ["data/*.txt"]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
readchar==2.0.1
termcolor==1.1.0
pytest
60 changes: 0 additions & 60 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions tests/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Basic tests for the HangMan package."""

from pathlib import Path
import importlib
import sys


# Allow importing without installing the package
sys.path.append(str(Path(__file__).resolve().parents[1] / "src"))


def test_import():
"""Ensure the package can be imported."""
importlib.import_module("hangmanultimate")