tarrotsimplified 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vikkas Pareek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.5
2
+ Name: tarrotsimplified
3
+ Version: 0.1.0
4
+ Summary: Offline tarot card interpretations as a Python library.
5
+ Project-URL: Homepage, https://github.com/yourname/tarrotsimplified
6
+ Author: Vikkas Pareek
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: cards,divination,tarot
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+
15
+ # tarrotsimplified
16
+
17
+ Offline tarot card interpretations as a Python library. No server, no API — the card data ships inside the package.
18
+
19
+ **Status:** early release. Only a handful of sample cards are included so far (The Fool, The Magician, Ace of Cups, Two of Wands) — the full 78-card deck is coming in a follow-up release.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install tarrotsimplified
25
+ ```
26
+
27
+ ## Use
28
+
29
+ ```python
30
+ import tarrotsimplified as tw
31
+
32
+ # look up a card
33
+ card = tw.get_card("The Fool")
34
+ print(card.upright)
35
+ print(card.keywords)
36
+
37
+ # draw random cards (some may be reversed)
38
+ for item in tw.draw(3):
39
+ c = item["card"]
40
+ print(c.name, "(reversed)" if item["reversed"] else "", "-", c.meaning(item["reversed"]))
41
+
42
+ # do a named spread
43
+ for item in tw.spread("three_card"):
44
+ print(item["position"], "->", item["card"].name)
45
+
46
+ # search meanings
47
+ print([c.name for c in tw.search("new beginnings")])
48
+ ```
49
+
50
+ Spreads available: `single`, `three_card`, `celtic_cross`.
51
+
52
+ ## Publish to PyPI (one time)
53
+
54
+ ```bash
55
+ pip install build twine
56
+ python -m build # creates dist/*.whl and *.tar.gz
57
+ twine upload dist/* # asks for your PyPI token
58
+ ```
59
+
60
+ After that, anyone can `pip install tarrotsimplified`. Bump `version` in `pyproject.toml` and `__init__.py` for each new release.
@@ -0,0 +1,46 @@
1
+ # tarrotsimplified
2
+
3
+ Offline tarot card interpretations as a Python library. No server, no API — the card data ships inside the package.
4
+
5
+ **Status:** early release. Only a handful of sample cards are included so far (The Fool, The Magician, Ace of Cups, Two of Wands) — the full 78-card deck is coming in a follow-up release.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install tarrotsimplified
11
+ ```
12
+
13
+ ## Use
14
+
15
+ ```python
16
+ import tarrotsimplified as tw
17
+
18
+ # look up a card
19
+ card = tw.get_card("The Fool")
20
+ print(card.upright)
21
+ print(card.keywords)
22
+
23
+ # draw random cards (some may be reversed)
24
+ for item in tw.draw(3):
25
+ c = item["card"]
26
+ print(c.name, "(reversed)" if item["reversed"] else "", "-", c.meaning(item["reversed"]))
27
+
28
+ # do a named spread
29
+ for item in tw.spread("three_card"):
30
+ print(item["position"], "->", item["card"].name)
31
+
32
+ # search meanings
33
+ print([c.name for c in tw.search("new beginnings")])
34
+ ```
35
+
36
+ Spreads available: `single`, `three_card`, `celtic_cross`.
37
+
38
+ ## Publish to PyPI (one time)
39
+
40
+ ```bash
41
+ pip install build twine
42
+ python -m build # creates dist/*.whl and *.tar.gz
43
+ twine upload dist/* # asks for your PyPI token
44
+ ```
45
+
46
+ After that, anyone can `pip install tarrotsimplified`. Bump `version` in `pyproject.toml` and `__init__.py` for each new release.
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "tarrotsimplified"
7
+ version = "0.1.0"
8
+ description = "Offline tarot card interpretations as a Python library."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{ name = "Vikkas Pareek" }]
13
+ keywords = ["tarot", "divination", "cards"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ ]
18
+
19
+ [project.urls]
20
+ Homepage = "https://github.com/yourname/tarrotsimplified"
21
+
22
+ [tool.hatch.build.targets.wheel]
23
+ packages = ["src/tarrotsimplified"]
@@ -0,0 +1,91 @@
1
+ """tarrotsimplified — offline tarot card interpretations as a Python library."""
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import random
6
+ from importlib import resources
7
+ from dataclasses import dataclass
8
+
9
+ __version__ = "0.1.0"
10
+
11
+
12
+ @dataclass
13
+ class Card:
14
+ name: str
15
+ number: int
16
+ arcana: str
17
+ suit: str | None
18
+ keywords: list[str]
19
+ upright: str
20
+ reversed: str
21
+ element: str | None = None
22
+ astrology: str | None = None
23
+
24
+ def meaning(self, reversed: bool = False) -> str:
25
+ return self.reversed if reversed else self.upright
26
+
27
+
28
+ def _load() -> list[Card]:
29
+ raw = json.loads(
30
+ resources.files("tarrotsimplified.data").joinpath("cards.json").read_text("utf-8")
31
+ )
32
+ return [Card(**c) for c in raw["cards"]]
33
+
34
+
35
+ _CARDS: list[Card] = _load()
36
+
37
+
38
+ def all_cards() -> list[Card]:
39
+ """Return every card in the deck."""
40
+ return list(_CARDS)
41
+
42
+
43
+ def get_card(name: str) -> Card:
44
+ """Look up one card by name (case-insensitive)."""
45
+ for c in _CARDS:
46
+ if c.name.lower() == name.lower():
47
+ return c
48
+ raise KeyError(f"No card named {name!r}")
49
+
50
+
51
+ def draw(n: int = 1, allow_reversed: bool = True) -> list[dict]:
52
+ """Draw n random cards. Each result is {'card': Card, 'reversed': bool}."""
53
+ if n > len(_CARDS):
54
+ raise ValueError(f"Deck only has {len(_CARDS)} cards")
55
+ picked = random.sample(_CARDS, n)
56
+ return [
57
+ {"card": c, "reversed": allow_reversed and random.random() < 0.5}
58
+ for c in picked
59
+ ]
60
+
61
+
62
+ SPREADS = {
63
+ "single": ["Focus"],
64
+ "three_card": ["Past", "Present", "Future"],
65
+ "celtic_cross": [
66
+ "Present", "Challenge", "Past", "Future", "Above", "Below",
67
+ "Advice", "External", "Hopes/Fears", "Outcome",
68
+ ],
69
+ }
70
+
71
+
72
+ def spread(name: str = "three_card", allow_reversed: bool = True) -> list[dict]:
73
+ """Draw a named spread. Each result adds a 'position' label."""
74
+ if name not in SPREADS:
75
+ raise KeyError(f"Unknown spread {name!r}. Try: {', '.join(SPREADS)}")
76
+ positions = SPREADS[name]
77
+ cards = draw(len(positions), allow_reversed)
78
+ for pos, item in zip(positions, cards):
79
+ item["position"] = pos
80
+ return cards
81
+
82
+
83
+ def search(keyword: str) -> list[Card]:
84
+ """Find cards whose keywords or meanings mention a term."""
85
+ k = keyword.lower()
86
+ return [
87
+ c for c in _CARDS
88
+ if any(k in kw.lower() for kw in c.keywords)
89
+ or k in c.upright.lower()
90
+ or k in c.reversed.lower()
91
+ ]
@@ -0,0 +1,48 @@
1
+ {
2
+ "cards": [
3
+ {
4
+ "name": "The Fool",
5
+ "number": 0,
6
+ "arcana": "major",
7
+ "suit": null,
8
+ "keywords": ["beginnings", "innocence", "spontaneity", "free spirit"],
9
+ "upright": "New beginnings, a leap of faith, and openness to whatever comes. The Fool asks you to trust the journey even without knowing the destination.",
10
+ "reversed": "Recklessness, hesitation, or fear of taking the first step. A warning to look before you leap, or a nudge to stop over-thinking and finally move.",
11
+ "element": "Air",
12
+ "astrology": "Uranus"
13
+ },
14
+ {
15
+ "name": "The Magician",
16
+ "number": 1,
17
+ "arcana": "major",
18
+ "suit": null,
19
+ "keywords": ["manifestation", "willpower", "resourcefulness", "power"],
20
+ "upright": "You have every tool you need. Focus, intention, and skill combine to turn ideas into reality.",
21
+ "reversed": "Manipulation, untapped potential, or scattered energy. Talent going to waste, or power used for the wrong ends.",
22
+ "element": "Air",
23
+ "astrology": "Mercury"
24
+ },
25
+ {
26
+ "name": "Ace of Cups",
27
+ "number": 1,
28
+ "arcana": "minor",
29
+ "suit": "cups",
30
+ "keywords": ["new love", "emotion", "intuition", "compassion"],
31
+ "upright": "An overflowing heart — new love, deep feeling, or spiritual awakening. An emotional fresh start.",
32
+ "reversed": "Blocked emotions, emptiness, or repressed feelings. Love withheld, from others or from yourself.",
33
+ "element": "Water",
34
+ "astrology": null
35
+ },
36
+ {
37
+ "name": "Two of Wands",
38
+ "number": 2,
39
+ "arcana": "minor",
40
+ "suit": "wands",
41
+ "keywords": ["planning", "decisions", "discovery", "future"],
42
+ "upright": "Standing at the edge of what you've built, planning the next bold move. The world is wider than your comfort zone.",
43
+ "reversed": "Fear of the unknown, playing it too safe, or plans that never leave the drawing board.",
44
+ "element": "Fire",
45
+ "astrology": "Mars in Aries"
46
+ }
47
+ ]
48
+ }