decksmith 0.1.11__tar.gz → 0.1.14__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,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: decksmith
3
+ Version: 0.1.14
4
+ Summary: A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.
5
+ License-Expression: GPL-2.0-only
6
+ Author: Julio Cabria
7
+ Author-email: juliocabria@tutanota.com
8
+ Requires-Python: >=3.11
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Provides-Extra: dev
15
+ Requires-Dist: click
16
+ Requires-Dist: jval (==1.0.6)
17
+ Requires-Dist: pandas
18
+ Requires-Dist: pillow (>=11.3.0)
19
+ Requires-Dist: poetry ; extra == "dev"
20
+ Requires-Dist: pytest ; extra == "dev"
21
+ Requires-Dist: reportlab (>=4.4.3)
22
+ Project-URL: Homepage, https://github.com/Julynx/decksmith
23
+ Description-Content-Type: text/markdown
24
+
25
+ # DeckSmith
26
+
27
+ *A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.*
28
+
29
+ <br>
30
+ <p align="center">
31
+ <img width="600" src="https://raw.githubusercontent.com/Julynx/decksmith/refs/heads/main/docs/assets/decksmith.png">
32
+ </p>
33
+
34
+ <br>
35
+ <p align="center">
36
+ <img width="600" src="https://raw.githubusercontent.com/Julynx/decksmith/refs/heads/main/docs/assets/banner.png">
37
+ </p>
38
+
39
+ <br>
40
+
41
+ DeckSmith is ideal for automating the creation of all kinds of decks, including TCG decks, tarot decks, business cards, and even slides.
42
+
43
+ ## Why DeckSmith?
44
+
45
+ - ✨ Consistent layout and formatting across all cards. Define once, edit anytime, generate as many cards as you need.
46
+ - 🍳 Pure python, with easy installation via pip.
47
+ - ⚡ Highly performant card generation using parallel processing.
48
+ - 📖 Intuitive syntax and extensive [documentation](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md) with examples to help you get started quickly.
49
+ - 🧰 Tons of powerful features such as:
50
+ - [Start from a sample project and edit it instead of starting from scratch](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#creating-a-project)
51
+ - [Extensive support for images](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images), [text](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#text), [and all kinds of different shapes](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#shapes)
52
+ - [Link any field to a column in the CSV file](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#basic-example-with-deckcsv)
53
+ - [Position elements absolutely or relative to other elements, using anchors to simplify placement](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#positioning)
54
+ - [Powerful image transformations using filters like crop, resize, rotate, or flip](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images)
55
+ - [Export your deck as images or as a PDF for printing](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#building-the-deck)
56
+
57
+ ## Getting started
58
+
59
+ - First, install DeckSmith by running `pip install decksmith`.
60
+
61
+ - Then, run `decksmith init` to start from sample `deck.json` and `deck.csv` files.
62
+
63
+ - The `deck.json` file defines the layout for the cards in the deck, while the `deck.csv` file holds the data for each card.
64
+
65
+ - You can find a complete list of all the available elements you can use in the [documentation](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md).
66
+
67
+ - Any column from the CSV can be referenced anywhere in the JSON as `%column_name%`.
68
+
69
+ - Finally, run `decksmith build` when you are ready to generate the deck images, and export them to PDF using the `decksmith export` command.
70
+
71
+ ## Documentation
72
+
73
+ Check out the [full documentation](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md) for more detailed information on how to use DeckSmith.
74
+
@@ -321,8 +321,12 @@ class CardBuilder:
321
321
  # The center of the circle is the top-left position + radius
322
322
  center_pos = (absolute_pos[0] + radius, absolute_pos[1] + radius)
323
323
 
324
- # Draw the circle
325
- self.draw.circle(
324
+ # Create a temporary layer for proper alpha compositing
325
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
326
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
327
+
328
+ # Draw the circle on the temporary layer
329
+ layer_draw.circle(
326
330
  center_pos,
327
331
  radius,
328
332
  fill=element.get("fill", None),
@@ -330,6 +334,10 @@ class CardBuilder:
330
334
  width=element.get("outline_width", 1),
331
335
  )
332
336
 
337
+ # Composite the layer onto the card
338
+ self.card = Image.alpha_composite(self.card, layer)
339
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
340
+
333
341
  # Store position if id is provided
334
342
  if "id" in element:
335
343
  # The stored bbox is based on the top-left position
@@ -377,14 +385,22 @@ class CardBuilder:
377
385
  position[1] + size[1],
378
386
  )
379
387
 
380
- # Draw the ellipse
381
- self.draw.ellipse(
388
+ # Create a temporary layer for proper alpha compositing
389
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
390
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
391
+
392
+ # Draw the ellipse on the temporary layer
393
+ layer_draw.ellipse(
382
394
  bounding_box,
383
395
  fill=element.get("fill", None),
384
396
  outline=element.get("outline_color", None),
385
397
  width=element.get("outline_width", 1),
386
398
  )
387
399
 
400
+ # Composite the layer onto the card
401
+ self.card = Image.alpha_composite(self.card, layer)
402
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
403
+
388
404
  # Store position if id is provided
389
405
  if "id" in element:
390
406
  self.element_positions[element["id"]] = bounding_box
@@ -432,14 +448,22 @@ class CardBuilder:
432
448
  # Translate points by the final offset
433
449
  final_points = [(p[0] + offset[0], p[1] + offset[1]) for p in points]
434
450
 
435
- # Draw the polygon
436
- self.draw.polygon(
451
+ # Create a temporary layer for proper alpha compositing
452
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
453
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
454
+
455
+ # Draw the polygon on the temporary layer
456
+ layer_draw.polygon(
437
457
  final_points,
438
458
  fill=element.get("fill", None),
439
459
  outline=element.get("outline_color", None),
440
460
  width=element.get("outline_width", 1),
441
461
  )
442
462
 
463
+ # Composite the layer onto the card
464
+ self.card = Image.alpha_composite(self.card, layer)
465
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
466
+
443
467
  # Store position if id is provided
444
468
  if "id" in element:
445
469
  # The stored bbox is the relative bbox translated by the offset
@@ -482,8 +506,12 @@ class CardBuilder:
482
506
  # The center of the polygon is the top-left position + radius
483
507
  center_pos = (absolute_pos[0] + radius, absolute_pos[1] + radius)
484
508
 
485
- # Draw the regular polygon
486
- self.draw.regular_polygon(
509
+ # Create a temporary layer for proper alpha compositing
510
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
511
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
512
+
513
+ # Draw the regular polygon on the temporary layer
514
+ layer_draw.regular_polygon(
487
515
  (center_pos[0], center_pos[1], radius),
488
516
  n_sides=element["sides"],
489
517
  rotation=element.get("rotation", 0),
@@ -492,6 +520,10 @@ class CardBuilder:
492
520
  width=element.get("outline_width", 1),
493
521
  )
494
522
 
523
+ # Composite the layer onto the card
524
+ self.card = Image.alpha_composite(self.card, layer)
525
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
526
+
495
527
  # Store position if id is provided
496
528
  if "id" in element:
497
529
  # The stored bbox is based on the top-left position
@@ -545,8 +577,12 @@ class CardBuilder:
545
577
 
546
578
  # print(f"DEBUG: Transformed {element=}")
547
579
 
548
- # Draw the rectangle
549
- self.draw.rounded_rectangle(
580
+ # Create a temporary layer for proper alpha compositing
581
+ layer = Image.new("RGBA", self.card.size, (0, 0, 0, 0))
582
+ layer_draw = ImageDraw.Draw(layer, "RGBA")
583
+
584
+ # Draw the rectangle on the temporary layer
585
+ layer_draw.rounded_rectangle(
550
586
  bounding_box,
551
587
  radius=element.get("corner_radius", 0),
552
588
  fill=element.get("fill", None),
@@ -555,6 +591,10 @@ class CardBuilder:
555
591
  corners=element.get("corners", None),
556
592
  )
557
593
 
594
+ # Composite the layer onto the card
595
+ self.card = Image.alpha_composite(self.card, layer)
596
+ self.draw = ImageDraw.Draw(self.card, "RGBA")
597
+
558
598
  # Store position if id is provided
559
599
  if "id" in element:
560
600
  self.element_positions[element["id"]] = bounding_box
@@ -0,0 +1,49 @@
1
+ # DeckSmith
2
+
3
+ *A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.*
4
+
5
+ <br>
6
+ <p align="center">
7
+ <img width="600" src="https://raw.githubusercontent.com/Julynx/decksmith/refs/heads/main/docs/assets/decksmith.png">
8
+ </p>
9
+
10
+ <br>
11
+ <p align="center">
12
+ <img width="600" src="https://raw.githubusercontent.com/Julynx/decksmith/refs/heads/main/docs/assets/banner.png">
13
+ </p>
14
+
15
+ <br>
16
+
17
+ DeckSmith is ideal for automating the creation of all kinds of decks, including TCG decks, tarot decks, business cards, and even slides.
18
+
19
+ ## Why DeckSmith?
20
+
21
+ - ✨ Consistent layout and formatting across all cards. Define once, edit anytime, generate as many cards as you need.
22
+ - 🍳 Pure python, with easy installation via pip.
23
+ - ⚡ Highly performant card generation using parallel processing.
24
+ - 📖 Intuitive syntax and extensive [documentation](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md) with examples to help you get started quickly.
25
+ - 🧰 Tons of powerful features such as:
26
+ - [Start from a sample project and edit it instead of starting from scratch](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#creating-a-project)
27
+ - [Extensive support for images](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images), [text](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#text), [and all kinds of different shapes](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#shapes)
28
+ - [Link any field to a column in the CSV file](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#basic-example-with-deckcsv)
29
+ - [Position elements absolutely or relative to other elements, using anchors to simplify placement](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#positioning)
30
+ - [Powerful image transformations using filters like crop, resize, rotate, or flip](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images)
31
+ - [Export your deck as images or as a PDF for printing](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#building-the-deck)
32
+
33
+ ## Getting started
34
+
35
+ - First, install DeckSmith by running `pip install decksmith`.
36
+
37
+ - Then, run `decksmith init` to start from sample `deck.json` and `deck.csv` files.
38
+
39
+ - The `deck.json` file defines the layout for the cards in the deck, while the `deck.csv` file holds the data for each card.
40
+
41
+ - You can find a complete list of all the available elements you can use in the [documentation](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md).
42
+
43
+ - Any column from the CSV can be referenced anywhere in the JSON as `%column_name%`.
44
+
45
+ - Finally, run `decksmith build` when you are ready to generate the deck images, and export them to PDF using the `decksmith export` command.
46
+
47
+ ## Documentation
48
+
49
+ Check out the [full documentation](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md) for more detailed information on how to use DeckSmith.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "decksmith"
3
- version = "0.1.11"
3
+ version = "0.1.14"
4
4
  description = "A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck."
5
5
  authors = [
6
6
  {name = "Julio Cabria", email = "juliocabria@tutanota.com"},
@@ -24,7 +24,7 @@ dev = [
24
24
 
25
25
  [tool.poetry]
26
26
  name = "decksmith"
27
- version = "0.1.11"
27
+ version = "0.1.12"
28
28
  description = "A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck."
29
29
  authors = ["Julio Cabria <juliocabria@tutanota.com>"]
30
30
  license = "GPL-2.0-only"
decksmith-0.1.11/PKG-INFO DELETED
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: decksmith
3
- Version: 0.1.11
4
- Summary: A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.
5
- License: GPL-2.0-only
6
- Author: Julio Cabria
7
- Author-email: juliocabria@tutanota.com
8
- Requires-Python: >=3.11
9
- Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
- Provides-Extra: dev
15
- Requires-Dist: click
16
- Requires-Dist: jval (==1.0.6)
17
- Requires-Dist: pandas
18
- Requires-Dist: pillow (>=11.3.0)
19
- Requires-Dist: poetry ; extra == "dev"
20
- Requires-Dist: pytest ; extra == "dev"
21
- Requires-Dist: reportlab (>=4.4.3)
22
- Project-URL: Homepage, https://github.com/Julynx/decksmith
23
- Description-Content-Type: text/markdown
24
-
25
- # DeckSmith
26
-
27
- *A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.*
28
-
29
- <br>
30
- <p align="center">
31
- <img width="600" src="https://raw.githubusercontent.com/Julynx/decksmith/refs/heads/main/docs/assets/decksmith.png">
32
- </p>
33
- <br>
34
-
35
- DeckSmith is ideal for automating the creation of all kinds of decks, including TCG decks, tarot decks, business cards, and even slides.
36
-
37
- ## Features
38
-
39
- - [Initialize a sample project and edit it instead of starting from scratch](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#creating-a-project)
40
-
41
- - [Include images](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images), [text](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#text), [and different kinds of shapes](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#shapes)
42
-
43
- - [Link any field to a column in the CSV file](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#basic-example-with-deckcsv)
44
-
45
- - [Position elements absolutely or relative to other elements, using anchors to simplify placement](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#positioning)
46
-
47
- - [Transform images using filters like crop, resize, rotate, or flip](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images)
48
-
49
- - [Build card images and export to PDF for printing](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#building-the-deck)
50
-
51
- ## Getting started
52
-
53
- To start creating decks, check out [Getting Started](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md/#getting-started).
54
-
@@ -1,29 +0,0 @@
1
- # DeckSmith
2
-
3
- *A command-line application to dynamically generate decks of cards from a JSON specification and a CSV data file, inspired by nandeck.*
4
-
5
- <br>
6
- <p align="center">
7
- <img width="600" src="https://raw.githubusercontent.com/Julynx/decksmith/refs/heads/main/docs/assets/decksmith.png">
8
- </p>
9
- <br>
10
-
11
- DeckSmith is ideal for automating the creation of all kinds of decks, including TCG decks, tarot decks, business cards, and even slides.
12
-
13
- ## Features
14
-
15
- - [Initialize a sample project and edit it instead of starting from scratch](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#creating-a-project)
16
-
17
- - [Include images](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images), [text](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#text), [and different kinds of shapes](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#shapes)
18
-
19
- - [Link any field to a column in the CSV file](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#basic-example-with-deckcsv)
20
-
21
- - [Position elements absolutely or relative to other elements, using anchors to simplify placement](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#positioning)
22
-
23
- - [Transform images using filters like crop, resize, rotate, or flip](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#images)
24
-
25
- - [Build card images and export to PDF for printing](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md#building-the-deck)
26
-
27
- ## Getting started
28
-
29
- To start creating decks, check out [Getting Started](https://github.com/Julynx/decksmith/blob/main/docs/DOCS.md/#getting-started).
File without changes