diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 66cfa7c..41b2c04 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,7 @@ on: - published env: - PACKAGE_NAME: pyfall + PACKAGE_NAME: scryfall jobs: build-and-publish: diff --git a/README.md b/README.md index 3627ad6..20c9bc0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Pyfall +# Scryfall-py An async Scryfall API wrapper written in Python diff --git a/pyfall/__init__.py b/pyfall/__init__.py deleted file mode 100644 index 3622018..0000000 --- a/pyfall/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from pyfall.client import Pyfall - -__all__ = ["Pyfall"] diff --git a/pyproject.toml b/pyproject.toml index c548c38..6403e39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "pyfall" +name = "scryfall-py" version = "0.1.0" description = "An async Scryfall API wrapper" license = { text = "MIT License" } @@ -38,6 +38,9 @@ dev = [ requires = ["hatchling"] build-backend = "hatchling.build" +[tool.hatch.build.targets.wheel] +packages = ["scryfall"] + [tool.pytest.ini_options] minversion = "8.0" testpaths = ["tests"] diff --git a/scryfall/__init__.py b/scryfall/__init__.py new file mode 100644 index 0000000..3c96f26 --- /dev/null +++ b/scryfall/__init__.py @@ -0,0 +1,3 @@ +from scryfall.client import Scryfall + +__all__ = ["Scryfall"] diff --git a/pyfall/client/__init__.py b/scryfall/client/__init__.py similarity index 89% rename from pyfall/client/__init__.py rename to scryfall/client/__init__.py index ef42092..39cb764 100644 --- a/pyfall/client/__init__.py +++ b/scryfall/client/__init__.py @@ -1,6 +1,6 @@ from typing import Any -from pyfall.const import __version__ +from scryfall.const import __version__ import asyncio import logging @@ -8,11 +8,11 @@ import time from httpx import AsyncClient -from pyfall.const import get_logger -from pyfall.client.error import LibraryException, HTTPException, ScryfallError, Forbidden, NotFound -from pyfall.client.http.http_requests.card import CardRequests -from pyfall.client.http.http_requests.set import SetRequests -from pyfall.client.route import Route +from scryfall.const import get_logger +from scryfall.client.error import LibraryException, HTTPException, ScryfallError, Forbidden, NotFound +from scryfall.client.http.http_requests.card import CardRequests +from scryfall.client.http.http_requests.set import SetRequests +from scryfall.client.route import Route class GlobalLock: @@ -51,11 +51,11 @@ class GlobalLock: self._calls -= 1 -class Pyfall(CardRequests, SetRequests): +class Scryfall(CardRequests, SetRequests): def __init__(self, logger: logging.Logger | None = None): self.__headers = { "Content-Type": "application/json", - "UserAgent": f"pyfall/{__version__}", + "UserAgent": f"scryfall/{__version__}", "Accept": "application/json", } self.__client: AsyncClient = None # type: ignore diff --git a/pyfall/client/error.py b/scryfall/client/error.py similarity index 94% rename from pyfall/client/error.py rename to scryfall/client/error.py index 4adc5f1..8dc6174 100644 --- a/pyfall/client/error.py +++ b/scryfall/client/error.py @@ -3,11 +3,11 @@ from typing import TYPE_CHECKING import httpx if TYPE_CHECKING: - from pyfall.client.route import Route + from scryfall.client.route import Route class LibraryException(Exception): - """Base Exception of pyfall.""" + """Base Exception of scryfall-py.""" class HTTPException(LibraryException): diff --git a/pyfall/client/http/http_requests/card.py b/scryfall/client/http/http_requests/card.py similarity index 96% rename from pyfall/client/http/http_requests/card.py rename to scryfall/client/http/http_requests/card.py index b9e1f15..b8b6570 100644 --- a/pyfall/client/http/http_requests/card.py +++ b/scryfall/client/http/http_requests/card.py @@ -1,12 +1,12 @@ from typing import Any, Literal from uuid import UUID -from pyfall.models.catalogs import Catalog -from pyfall.client.route import Route -from pyfall.models.cards import Card -from pyfall.models.api import APIList -from pyfall.models.rulings import Ruling -from pyfall.models.internal.protocols import CanRequest +from scryfall.models.catalogs import Catalog +from scryfall.client.route import Route +from scryfall.models.cards import Card +from scryfall.models.api import APIList +from scryfall.models.rulings import Ruling +from scryfall.models.internal.protocols import CanRequest class CardRequests(CanRequest): diff --git a/pyfall/client/http/http_requests/set.py b/scryfall/client/http/http_requests/set.py similarity index 86% rename from pyfall/client/http/http_requests/set.py rename to scryfall/client/http/http_requests/set.py index 4ad1764..a42fa34 100644 --- a/pyfall/client/http/http_requests/set.py +++ b/scryfall/client/http/http_requests/set.py @@ -1,9 +1,9 @@ from uuid import UUID -from pyfall.client.route import Route -from pyfall.models.api import APIList -from pyfall.models.sets import Set -from pyfall.models.internal.protocols import CanRequest +from scryfall.client.route import Route +from scryfall.models.api import APIList +from scryfall.models.sets import Set +from scryfall.models.internal.protocols import CanRequest class SetRequests(CanRequest): diff --git a/pyfall/client/route.py b/scryfall/client/route.py similarity index 100% rename from pyfall/client/route.py rename to scryfall/client/route.py diff --git a/pyfall/const.py b/scryfall/const.py similarity index 86% rename from pyfall/const.py rename to scryfall/const.py index fdbc914..2e86cb8 100644 --- a/pyfall/const.py +++ b/scryfall/const.py @@ -2,7 +2,7 @@ import logging __version__ = "0.1.0" -logger_name = "pyfall" +logger_name = "scryfall" _logger = logging.getLogger(logger_name) diff --git a/pyfall/models/__init__.py b/scryfall/models/__init__.py similarity index 100% rename from pyfall/models/__init__.py rename to scryfall/models/__init__.py diff --git a/pyfall/models/api.py b/scryfall/models/api.py similarity index 86% rename from pyfall/models/api.py rename to scryfall/models/api.py index 0b0a01c..5f5393b 100644 --- a/pyfall/models/api.py +++ b/scryfall/models/api.py @@ -2,11 +2,11 @@ from typing import Any, Literal from pydantic import BaseModel, HttpUrl, ValidationError, model_validator -from pyfall.models.base import BaseAPIModel -from pyfall.models.cards import Card -from pyfall.models.rulings import Ruling -from pyfall.models.sets import Set -from pyfall.models.symbols import CardSymbol +from scryfall.models.base import BaseAPIModel +from scryfall.models.cards import Card +from scryfall.models.rulings import Ruling +from scryfall.models.sets import Set +from scryfall.models.symbols import CardSymbol CLASS_LOOKUP = {"card": Card, "card_symbol": CardSymbol, "ruling": Ruling, "set": Set} diff --git a/pyfall/models/base.py b/scryfall/models/base.py similarity index 70% rename from pyfall/models/base.py rename to scryfall/models/base.py index d606e76..d4b0b7b 100644 --- a/pyfall/models/base.py +++ b/scryfall/models/base.py @@ -3,15 +3,15 @@ from typing import TYPE_CHECKING from pydantic import BaseModel if TYPE_CHECKING: - from pyfall.client import Pyfall + from scryfall.client import Scryfall class BaseAPIModel(BaseModel): """Base API model for base API calls.""" - _client: "Pyfall" + _client: "Scryfall" def __init__(self, **data): - client: "Pyfall" = data["_client"] + client: "Scryfall" = data["_client"] super().__init__(**data) self._client = client diff --git a/pyfall/models/bulk.py b/scryfall/models/bulk.py similarity index 100% rename from pyfall/models/bulk.py rename to scryfall/models/bulk.py diff --git a/pyfall/models/cards.py b/scryfall/models/cards.py similarity index 96% rename from pyfall/models/cards.py rename to scryfall/models/cards.py index fd112bf..1a8575f 100644 --- a/pyfall/models/cards.py +++ b/scryfall/models/cards.py @@ -4,12 +4,12 @@ from uuid import UUID from pydantic import BaseModel, HttpUrl, field_validator -from pyfall.models.base import BaseAPIModel -from pyfall.models.enums import Color +from scryfall.models.base import BaseAPIModel +from scryfall.models.enums import Color if TYPE_CHECKING: - from pyfall.models.rulings import Ruling - from pyfall.models.sets import Set + from scryfall.models.rulings import Ruling + from scryfall.models.sets import Set class RelatedCard(BaseModel): diff --git a/pyfall/models/catalogs.py b/scryfall/models/catalogs.py similarity index 100% rename from pyfall/models/catalogs.py rename to scryfall/models/catalogs.py diff --git a/pyfall/models/enums.py b/scryfall/models/enums.py similarity index 100% rename from pyfall/models/enums.py rename to scryfall/models/enums.py diff --git a/pyfall/models/internal/protocols.py b/scryfall/models/internal/protocols.py similarity index 90% rename from pyfall/models/internal/protocols.py rename to scryfall/models/internal/protocols.py index f752277..769558c 100644 --- a/pyfall/models/internal/protocols.py +++ b/scryfall/models/internal/protocols.py @@ -1,7 +1,7 @@ import typing from typing import Protocol, Any, TypeVar -from pyfall.client.route import Route +from scryfall.client.route import Route T_co = TypeVar("T", covariant=True) # type: ignore diff --git a/pyfall/models/rulings.py b/scryfall/models/rulings.py similarity index 100% rename from pyfall/models/rulings.py rename to scryfall/models/rulings.py diff --git a/pyfall/models/sets.py b/scryfall/models/sets.py similarity index 91% rename from pyfall/models/sets.py rename to scryfall/models/sets.py index 28853bd..3819af5 100644 --- a/pyfall/models/sets.py +++ b/scryfall/models/sets.py @@ -4,10 +4,10 @@ from uuid import UUID from pydantic import HttpUrl -from pyfall.models.base import BaseAPIModel +from scryfall.models.base import BaseAPIModel if TYPE_CHECKING: - from pyfall.models.api import APIList + from scryfall.models.api import APIList class Set(BaseAPIModel): diff --git a/pyfall/models/symbols.py b/scryfall/models/symbols.py similarity index 92% rename from pyfall/models/symbols.py rename to scryfall/models/symbols.py index 6130527..a0fa56c 100644 --- a/pyfall/models/symbols.py +++ b/scryfall/models/symbols.py @@ -2,7 +2,7 @@ from typing import Literal from pydantic import BaseModel, HttpUrl -from pyfall.models.enums import Color +from scryfall.models.enums import Color class CardSymbol(BaseModel): diff --git a/pyfall/utils.py b/scryfall/utils.py similarity index 100% rename from pyfall/utils.py rename to scryfall/utils.py diff --git a/tests/test_card_endpoints.py b/tests/test_card_endpoints.py index 8def969..d775a42 100644 --- a/tests/test_card_endpoints.py +++ b/tests/test_card_endpoints.py @@ -1,6 +1,6 @@ import pytest -from pyfall import Pyfall +from scryfall import Scryfall test_card_uuid = "1e90c638-d4b2-4243-bbc4-1cc10516c40f" test_card_name = "Arcades, the Strategist" @@ -8,7 +8,7 @@ test_card_name = "Arcades, the Strategist" @pytest.mark.asyncio async def test_get_card_by_all_ids(): - client = Pyfall() + client = Scryfall() card = await client.get_card_by_id(test_card_uuid) assert card.name == test_card_name @@ -29,7 +29,7 @@ async def test_get_card_by_all_ids(): @pytest.mark.asyncio async def test_get_card_rulings(): - client = Pyfall() + client = Scryfall() card = await client.get_card_by_id(test_card_uuid) rulings = await card.get_rulings() @@ -38,7 +38,7 @@ async def test_get_card_rulings(): @pytest.mark.asyncio async def test_search_card_all(): - client = Pyfall() + client = Scryfall() with pytest.raises(ValueError): _ = await client.search_cards(q="_" * 1001) @@ -63,7 +63,7 @@ async def test_search_card_all(): @pytest.mark.asyncio async def test_cards_autocomplete(): - client = Pyfall() + client = Scryfall() catalog = await client.cards_autocomplete(q="avacyn") @@ -72,7 +72,7 @@ async def test_cards_autocomplete(): @pytest.mark.asyncio async def test_get_random_card(): - client = Pyfall() + client = Scryfall() card = await client.get_random_card() assert card is not None @@ -80,7 +80,7 @@ async def test_get_random_card(): @pytest.mark.asyncio async def test_card_set(): - client = Pyfall() + client = Scryfall() card = await client.get_card_by_id(test_card_uuid) card_set = await card.get_set() diff --git a/tests/test_set_endpoints.py b/tests/test_set_endpoints.py index 1480789..d83a6e9 100644 --- a/tests/test_set_endpoints.py +++ b/tests/test_set_endpoints.py @@ -1,6 +1,6 @@ import pytest -from pyfall import Pyfall +from scryfall import Scryfall test_set_uuid = "2f5f2509-56db-414d-9a7e-6e312ec3760c" test_set_name = "Core Set 2019" @@ -9,13 +9,13 @@ test_set_code = "m19" @pytest.mark.asyncio async def test_get_all_sets(): - client = Pyfall() + client = Scryfall() _ = await client.get_all_sets() @pytest.mark.asyncio async def test_get_set(): - client = Pyfall() + client = Scryfall() set_ = await client.get_set_by_id(test_set_uuid) assert set_.name == test_set_name diff --git a/uv.lock b/uv.lock index 88f4482..feed700 100644 --- a/uv.lock +++ b/uv.lock @@ -717,7 +717,7 @@ wheels = [ ] [[package]] -name = "pyfall" +name = "scryfall" version = "0.1.0" source = { editable = "." } dependencies = [