{"id":25824226,"url":"https://github.com/aaa1928/cardpy","last_synced_at":"2026-02-21T22:03:07.036Z","repository":{"id":276724982,"uuid":"929271387","full_name":"aAa1928/cardpy","owner":"aAa1928","description":"A Python module for playing cards","archived":false,"fork":false,"pushed_at":"2025-02-17T02:27:41.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T12:07:34.788Z","etag":null,"topics":["card","module","open-source","python","python-module"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aAa1928.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-08T06:35:27.000Z","updated_at":"2025-02-19T02:14:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"d8ac5052-8b12-433f-ab20-b0b063c01bc5","html_url":"https://github.com/aAa1928/cardpy","commit_stats":null,"previous_names":["aaa1928/cardpy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aAa1928/cardpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aAa1928%2Fcardpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aAa1928%2Fcardpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aAa1928%2Fcardpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aAa1928%2Fcardpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aAa1928","download_url":"https://codeload.github.com/aAa1928/cardpy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aAa1928%2Fcardpy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280979443,"owners_count":26423964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["card","module","open-source","python","python-module"],"created_at":"2025-02-28T12:37:29.231Z","updated_at":"2026-02-21T22:03:07.030Z","avatar_url":"https://github.com/aAa1928.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cardpy\n\nA comprehensive Python module for playing cards, providing flexible card and deck management with type hints and modern Python features.\n\n## Features\n\n- Standard 52-card deck management\n- Support for multiple decks (e.g., for Blackjack)\n- Card comparison and sorting\n- Unicode suit symbols (♠, ♥, ♦, ♣)\n- Rich deck operations (shuffle, cut, deal, etc.)\n- Type hints and thorough error checking\n- Chainable methods for fluid syntax\n- Hand management for card games\n- Custom sorting options\n- Face-up/face-down card tracking\n\n## Installation\n\n```bash\npip install cardpy\n```\n\n## Quick Start\n\n```python\nfrom cardpy import Card, Deck, Hand, Rank, Suit\n\n# Create and shuffle a deck\ndeck = Deck(init=True)  # Creates standard 52-card deck\ndeck.shuffle()\n\n# Create a hand and deal cards\nhand = Hand()\nhand.extend(deck.draw_multiple(5))\nprint(f\"Your hand: {hand}\")\n\n# Create specific cards\nace_spades = Card(Rank.ACE, Suit.SPADES)\nking_hearts = Card('K', '♥')  # String representations work too\n\n# Compare cards\nif ace_spades \u003e king_hearts:\n    print(\"Ace beats King!\")\n```\n\n## Core Classes\n\n### Card\n\nRepresents a playing card with rank, suit, color and face-up status:\n\n```python\n# Multiple ways to create cards\nace = Card(Rank.ACE, Suit.SPADES)\nking = Card('K', 'H')  # Using string shortcuts\nten = Card('10', '♦')  # Using Unicode symbols\n\n# Card properties\nprint(f\"{ace}\")        # \"ACE of SPADES ♠\"\nprint(f\"{ace:rank}\")   # \"A\"\nprint(f\"{ace:suit}\")   # \"♠\"\nprint(f\"{ace:color}\")  # \"black\"\n\n# Face-up/down handling\nace.face_up = True\nace.flip()  # Flips the card over\n```\n\n### Deck\n\nManages collections of cards with rich operations:\n\n```python\n# Different deck types\nstandard = Deck(init=True)           # 52-card deck\nempty = Deck()                       # Empty deck\nblackjack = Deck(init=True, deck_count=6)  # 6 decks combined\n\n# Chain operations\ndeck.shuffle().cut().reverse()\n\n# Card operations\ncard = deck.draw()\nhand = deck.draw_multiple(5)\ntop_three = deck.peek_multiple(3)\n\n# Combine decks\nbig_deck = deck1 + deck2\ndeck1 *= 2  # Double the deck\n```\n\n### Hand\n\nManages player hands with similar operations to Deck:\n\n```python\n# Create and manage hands\nhand = Hand()\nhand.extend(deck.draw_multiple(5))\nhand.sort()  # Sort by rank and suit\n\n# Play cards\nplayed_card = hand.play()\nplayed_multiple = hand.play_multiple(2)\n\n# Combine hands\nmerged_hand = hand1 + hand2\n```\n\n## Advanced Features\n\n### Custom Sorting\n\nSort cards using custom rank and suit orders:\n\n```python\n# Define custom ordering\nace_low = [Rank.ACE] + Card.RANKS[:-1]  # Ace-low ordering\nhearts_high = [Suit.DIAMONDS, Suit.CLUBS, Suit.SPADES, Suit.HEARTS]\n\n# Sort using custom order\ndeck.sort(ranks=ace_low, suits=hearts_high)\nhand.sort(ranks=ace_low, suits=hearts_high)\n```\n\n### Multiple Deck Games\n\n```python\n# Create a 6-deck shoe for Blackjack\nshoe = Deck(init=True, deck_count=6)\nshoe.shuffle()\n\n# Deal cards to multiple players\nhands = shoe.deal(4, 2)  # 2 cards each to 4 players\n\n# Track remaining cards\nremaining = len(shoe)\nprint(f\"Cards remaining: {remaining}\")\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n- [GitHub Repository](https://github.com/aAa1928/cardpy)\n- [PyPI Package](https://pypi.org/project/cardpy/)\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Author\n\nRisheet Lenka - [GitHub Profile](https://github.com/aAa1928)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaa1928%2Fcardpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaa1928%2Fcardpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaa1928%2Fcardpy/lists"}