spells-mtg 0.2.1__tar.gz → 0.2.3__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.
Potentially problematic release.
This version of spells-mtg might be problematic. Click here for more details.
- spells_mtg-0.2.1/README.md → spells_mtg-0.2.3/PKG-INFO +17 -3
- spells_mtg-0.2.1/PKG-INFO → spells_mtg-0.2.3/README.md +6 -14
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/pyproject.toml +1 -1
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/columns.py +1 -1
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/draft_data.py +10 -9
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/manifest.py +1 -3
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/LICENSE +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/__init__.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/cache.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/cards.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/enums.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/external.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/filter.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/spells/schema.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/tests/__init__.py +0 -0
- {spells_mtg-0.2.1 → spells_mtg-0.2.3}/tests/filter_test.py +0 -0
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: spells-mtg
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: analaysis of 17Lands.com public datasets
|
|
5
|
+
Author-Email: Joel Barnes <oelarnes@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: polars>=1.14.0
|
|
9
|
+
Requires-Dist: wget>=3.2
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
1
12
|
# 🪄 spells ✨
|
|
2
13
|
|
|
3
14
|
**spells** is a python package that tutors up blazing-fast and extensible analysis of the public data sets provided by [17Lands](https://www.17lands.com/) and exiles the annoying and slow parts of your workflow. Spells exposes one first-class function, `summon`, which summons a Polars DataFrame to the battlefield.
|
|
@@ -53,7 +64,7 @@ Wall time: 80.8 ms
|
|
|
53
64
|
```
|
|
54
65
|
Coverting to pandas DataFrame is as simple as invoking the chained call `summon(...).to_pandas()`.
|
|
55
66
|
|
|
56
|
-
Spells is not affiliated with 17Lands. Please review the Usage Guidelines for 17lands data before using Spells, and consider supporting their patreon. Spells is free and open-source; please consider contributing and feel free to make use of the source code under the terms of the MIT license.
|
|
67
|
+
Spells is not affiliated with 17Lands. Please review the [Usage Guidelines](https://www.17lands.com/usage_guidelines) for 17lands data before using Spells, and consider supporting their patreon. Spells is free and open-source; please consider contributing and feel free to make use of the source code under the terms of the MIT license.
|
|
57
68
|
|
|
58
69
|
## spells
|
|
59
70
|
|
|
@@ -72,6 +83,7 @@ Spells is not affiliated with 17Lands. Please review the Usage Guidelines for 17
|
|
|
72
83
|
- Provides optional enums for all base columns and built-in extensions, as well as for custom extension parameters
|
|
73
84
|
- Uses Polars expressions to support second-stage aggregations and beyond like game-weighted z-scores with one call to summon
|
|
74
85
|
- Works on MacOS, Linux, and Windows
|
|
86
|
+
- Provides example notebooks to kickstart your exploration
|
|
75
87
|
|
|
76
88
|
## summon
|
|
77
89
|
|
|
@@ -182,6 +194,8 @@ Spells is still in development and could benefit from many new features and impr
|
|
|
182
194
|
|
|
183
195
|
If you are new to Python, I recommend using a package manager like poetry, pdm or uv to create a virtual environment and manage your project.
|
|
184
196
|
|
|
197
|
+
Once Spells is installed, check out the notebooks under [examples](https://github.com/oelarnes/spells/tree/main/examples) for ideas on getting started.
|
|
198
|
+
|
|
185
199
|
## Why did you make this? Who is it for?
|
|
186
200
|
|
|
187
201
|
Earlier this year I developed a card quality metric called [DEq](https://docs.google.com/spreadsheets/d/1n1pfrb5q_2ICYk-vfF3Uwo8t61DJU-5T_DFe0dwk8DY/edit), short for "Estimated Draft Equity", which is designed to estimate the average value of selecting a card in draft relative to a comparable baseline, in order to improve on commonly-used metrics like GIH WR, which has a number of major and minor problems when interpreted as a card quality metric. DEq depends on the daily drops from 17Lands.com and won't be replaced by this static kind of analysis.
|
|
@@ -238,8 +252,8 @@ So that's it, that's what Spells does from a high level. `summon` will hand off
|
|
|
238
252
|
## CLI
|
|
239
253
|
|
|
240
254
|
Spells includes a command-line interface `spells` to manage your external data files and local cache. Spells will download files to an appropriate file location on your system,
|
|
241
|
-
typically `~/.local/share/spells` on Unix-like platforms and `C:\Users\{Username}\AppData\Local\Spells` on Windows
|
|
242
|
-
To use `spells`, make sure Spells
|
|
255
|
+
typically `~/.local/share/spells` on Unix-like platforms and `C:\Users\{Username}\AppData\Local\Spells` on Windows, or to a location specified by the environment variable `SPELLS_DATA_HOME`.
|
|
256
|
+
To use `spells`, make sure Spells is installed in your environment using pip or a package manager, and type `spells help` into your shell, or dive in with `spells add DSK` or your favorite set. If Spells is installed globally using pipx, any local version of Spells will be able to read the managed files.
|
|
243
257
|
|
|
244
258
|
## API
|
|
245
259
|
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: spells-mtg
|
|
3
|
-
Version: 0.2.1
|
|
4
|
-
Summary: analaysis of 17Lands.com public datasets
|
|
5
|
-
Author-Email: Joel Barnes <oelarnes@gmail.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Requires-Python: >=3.11
|
|
8
|
-
Requires-Dist: polars>=1.14.0
|
|
9
|
-
Requires-Dist: wget>=3.2
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
|
|
12
1
|
# 🪄 spells ✨
|
|
13
2
|
|
|
14
3
|
**spells** is a python package that tutors up blazing-fast and extensible analysis of the public data sets provided by [17Lands](https://www.17lands.com/) and exiles the annoying and slow parts of your workflow. Spells exposes one first-class function, `summon`, which summons a Polars DataFrame to the battlefield.
|
|
@@ -64,7 +53,7 @@ Wall time: 80.8 ms
|
|
|
64
53
|
```
|
|
65
54
|
Coverting to pandas DataFrame is as simple as invoking the chained call `summon(...).to_pandas()`.
|
|
66
55
|
|
|
67
|
-
Spells is not affiliated with 17Lands. Please review the Usage Guidelines for 17lands data before using Spells, and consider supporting their patreon. Spells is free and open-source; please consider contributing and feel free to make use of the source code under the terms of the MIT license.
|
|
56
|
+
Spells is not affiliated with 17Lands. Please review the [Usage Guidelines](https://www.17lands.com/usage_guidelines) for 17lands data before using Spells, and consider supporting their patreon. Spells is free and open-source; please consider contributing and feel free to make use of the source code under the terms of the MIT license.
|
|
68
57
|
|
|
69
58
|
## spells
|
|
70
59
|
|
|
@@ -83,6 +72,7 @@ Spells is not affiliated with 17Lands. Please review the Usage Guidelines for 17
|
|
|
83
72
|
- Provides optional enums for all base columns and built-in extensions, as well as for custom extension parameters
|
|
84
73
|
- Uses Polars expressions to support second-stage aggregations and beyond like game-weighted z-scores with one call to summon
|
|
85
74
|
- Works on MacOS, Linux, and Windows
|
|
75
|
+
- Provides example notebooks to kickstart your exploration
|
|
86
76
|
|
|
87
77
|
## summon
|
|
88
78
|
|
|
@@ -193,6 +183,8 @@ Spells is still in development and could benefit from many new features and impr
|
|
|
193
183
|
|
|
194
184
|
If you are new to Python, I recommend using a package manager like poetry, pdm or uv to create a virtual environment and manage your project.
|
|
195
185
|
|
|
186
|
+
Once Spells is installed, check out the notebooks under [examples](https://github.com/oelarnes/spells/tree/main/examples) for ideas on getting started.
|
|
187
|
+
|
|
196
188
|
## Why did you make this? Who is it for?
|
|
197
189
|
|
|
198
190
|
Earlier this year I developed a card quality metric called [DEq](https://docs.google.com/spreadsheets/d/1n1pfrb5q_2ICYk-vfF3Uwo8t61DJU-5T_DFe0dwk8DY/edit), short for "Estimated Draft Equity", which is designed to estimate the average value of selecting a card in draft relative to a comparable baseline, in order to improve on commonly-used metrics like GIH WR, which has a number of major and minor problems when interpreted as a card quality metric. DEq depends on the daily drops from 17Lands.com and won't be replaced by this static kind of analysis.
|
|
@@ -249,8 +241,8 @@ So that's it, that's what Spells does from a high level. `summon` will hand off
|
|
|
249
241
|
## CLI
|
|
250
242
|
|
|
251
243
|
Spells includes a command-line interface `spells` to manage your external data files and local cache. Spells will download files to an appropriate file location on your system,
|
|
252
|
-
typically `~/.local/share/spells` on Unix-like platforms and `C:\Users\{Username}\AppData\Local\Spells` on Windows
|
|
253
|
-
To use `spells`, make sure Spells
|
|
244
|
+
typically `~/.local/share/spells` on Unix-like platforms and `C:\Users\{Username}\AppData\Local\Spells` on Windows, or to a location specified by the environment variable `SPELLS_DATA_HOME`.
|
|
245
|
+
To use `spells`, make sure Spells is installed in your environment using pip or a package manager, and type `spells help` into your shell, or dive in with `spells add DSK` or your favorite set. If Spells is installed globally using pipx, any local version of Spells will be able to read the managed files.
|
|
254
246
|
|
|
255
247
|
## API
|
|
256
248
|
|
|
@@ -53,22 +53,23 @@ def _get_names(set_code: str) -> tuple[str, ...]:
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def _hydrate_col_defs(set_code: str, col_spec_map: dict[str, ColumnSpec]):
|
|
56
|
-
def get_views(spec: ColumnSpec) ->
|
|
56
|
+
def get_views(spec: ColumnSpec) -> set[View]:
|
|
57
57
|
if spec.name == ColName.NAME or spec.col_type == ColType.AGG:
|
|
58
|
-
return
|
|
58
|
+
return set()
|
|
59
59
|
if spec.col_type == ColType.CARD_ATTR:
|
|
60
|
-
return
|
|
60
|
+
return {View.CARD}
|
|
61
61
|
if spec.views is not None:
|
|
62
|
-
return spec.views
|
|
62
|
+
return set(spec.views)
|
|
63
63
|
assert (
|
|
64
64
|
spec.dependencies is not None
|
|
65
65
|
), f"Col {spec.name} should have dependencies"
|
|
66
66
|
|
|
67
|
-
views =
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
views = functools.reduce(
|
|
68
|
+
lambda prev, curr: prev.intersection(curr),
|
|
69
|
+
[get_views(col_spec_map[dep]) for dep in spec.dependencies],
|
|
70
|
+
)
|
|
70
71
|
|
|
71
|
-
return
|
|
72
|
+
return views
|
|
72
73
|
|
|
73
74
|
names = _get_names(set_code)
|
|
74
75
|
assert len(names) > 0, "there should be names"
|
|
@@ -118,7 +119,7 @@ def _hydrate_col_defs(set_code: str, col_spec_map: dict[str, ColumnSpec]):
|
|
|
118
119
|
cdef = ColumnDefinition(
|
|
119
120
|
name=spec.name,
|
|
120
121
|
col_type=spec.col_type,
|
|
121
|
-
views=
|
|
122
|
+
views=views,
|
|
122
123
|
expr=expr,
|
|
123
124
|
dependencies=dependencies,
|
|
124
125
|
signature=signature,
|
|
@@ -99,8 +99,6 @@ def _resolve_view_cols(
|
|
|
99
99
|
For each view ('game', 'draft', and 'card'), return the columns
|
|
100
100
|
that must be present at the aggregation step. 'name' need not be
|
|
101
101
|
included, and 'pick' will be added if needed.
|
|
102
|
-
|
|
103
|
-
Dependencies within base views will be resolved by `col_df`.
|
|
104
102
|
"""
|
|
105
103
|
unresolved_cols = col_set
|
|
106
104
|
view_resolution = {}
|
|
@@ -169,7 +167,7 @@ def create(
|
|
|
169
167
|
needed_views = frozenset()
|
|
170
168
|
for view, cols_for_view in view_cols.items():
|
|
171
169
|
for col in cols_for_view:
|
|
172
|
-
if col_def_map[col].views ==
|
|
170
|
+
if col_def_map[col].views == {view}: # only found in this view
|
|
173
171
|
needed_views = needed_views.union({view})
|
|
174
172
|
|
|
175
173
|
view_cols = {v: view_cols[v] for v in needed_views}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|