crieur 1.3.0__py3-none-any.whl → 1.3.2__py3-none-any.whl

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 crieur might be problematic. Click here for more details.

crieur/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from pathlib import Path
2
2
 
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.2"
4
4
  ROOT_DIR = Path(__file__).parent
crieur/cli.py CHANGED
@@ -101,14 +101,27 @@ def stylo(
101
101
  with httpx.stream("GET", url, timeout=None) as r:
102
102
  for data in r.iter_bytes():
103
103
  fd.write(data)
104
+ else:
105
+ print(
106
+ f"Source already exists: `{zip_path}` (no download). "
107
+ "Use the `--force` option to download it again"
108
+ )
104
109
 
105
110
  target_path = sources_path / f"{i + 1}-{stylo_id}"
106
111
  try:
107
112
  with zipfile.ZipFile(zip_path, "r") as zip_ref:
108
113
  zip_ref.extractall(target_path)
109
- print(f"Data downloaded and extracted to {target_path}")
114
+ print(f"Data extracted to {target_path}")
110
115
  except zipfile.BadZipFile:
116
+ zip_problematic_path = Path() / f"problematic-export-{i + 1}-{stylo_id}.zip"
117
+ zip_path.rename(zip_problematic_path)
111
118
  print(f"Unable to find corpus with id {stylo_id}!")
119
+ print(
120
+ f"Check out the content of {zip_problematic_path} to try to understand."
121
+ )
122
+ print(
123
+ "Either you use a wrong corpus id or there is an issue with the export."
124
+ )
112
125
  return
113
126
 
114
127
 
crieur/models.py CHANGED
@@ -2,6 +2,7 @@ from dataclasses import dataclass
2
2
  from typing import Optional
3
3
 
4
4
  from dataclass_wizard import DatePattern, DumpMeta, YAMLWizard
5
+ from dataclass_wizard import errors as dw_errors
5
6
  from slugify import slugify
6
7
  from yaml.composer import ComposerError
7
8
 
@@ -29,11 +30,16 @@ class Numero(YAMLWizard):
29
30
  )
30
31
  article_yaml_path = article_folder / f"{article_slug}.yaml"
31
32
  try:
32
- loaded_article = Article.from_yaml_file(article_yaml_path)
33
- except ComposerError:
34
- loaded_article = Article.from_yaml(
35
- article_yaml_path.read_text().split("---")[1]
36
- )
33
+ try:
34
+ loaded_article = Article.from_yaml_file(article_yaml_path)
35
+ except ComposerError:
36
+ loaded_article = Article.from_yaml(
37
+ article_yaml_path.read_text().split("---")[1]
38
+ )
39
+ except dw_errors.ParseError as e:
40
+ print(f"Metadata error in `{article['article']['title']}`:")
41
+ print(e)
42
+ exit(1)
37
43
  if not loaded_article.id:
38
44
  loaded_article.id = article_slug
39
45
  loaded_article.content_md = (
@@ -46,7 +52,7 @@ class Numero(YAMLWizard):
46
52
  )
47
53
  loaded_article.numero = self
48
54
  loaded_articles.append(loaded_article)
49
- self.articles = loaded_articles
55
+ self.articles = sorted(loaded_articles, reverse=True)
50
56
 
51
57
 
52
58
  @dataclass
@@ -65,6 +71,14 @@ class Article(YAMLWizard):
65
71
  def __post_init__(self):
66
72
  self.slug = slugify(self.title)
67
73
 
74
+ def __eq__(self, other):
75
+ return self.id == other.id
76
+
77
+ def __lt__(self, other: "Article"):
78
+ if not isinstance(other, Article):
79
+ return NotImplemented
80
+ return self.date < other.date
81
+
68
82
 
69
83
  def configure_numero(yaml_path):
70
84
  # Preserves abstract_fr key (vs. abstract-fr) when converting to_yaml()
@@ -148,6 +162,8 @@ def collect_authors(numeros):
148
162
  for numero in numeros:
149
163
  for article in numero.articles:
150
164
  article_authors = []
165
+ if not article.authors:
166
+ continue
151
167
  for athr in article.authors:
152
168
  author_forname = athr["forname"]
153
169
  author_surname = athr["surname"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crieur
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: A Static Revue Generator.
5
5
  Project-URL: Homepage, https://gitlab.huma-num.fr/ecrinum/crieur
6
6
  Project-URL: Issues, https://gitlab.huma-num.fr/ecrinum/crieur/-/issues
@@ -1,8 +1,8 @@
1
- crieur/__init__.py,sha256=k3pwf7CyPSGfTC8iNxoikfjNPrh0YJcneTa62HujOKI,77
1
+ crieur/__init__.py,sha256=DJCsh5YCCUnPqMvARcxvMvW9_H2ofVnJ1R5mclHnE5g,77
2
2
  crieur/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
3
- crieur/cli.py,sha256=172Rac-Tjm6idS7Uh3OKdpAJNVieN0ntm9-KdzQA6ao,4984
3
+ crieur/cli.py,sha256=YPzrXMG0DzXBWpCVK1SEG5v6A32gezR54D8Kj2DDNYA,5534
4
4
  crieur/generator.py,sha256=Vc0oOLsQMcKWQLkzHLrJf5f1W_qmoxwYsc_ktHFZjtg,3046
5
- crieur/models.py,sha256=hQanZoV_I4UKTe6f2qOH7adMTo66_CU4tmG3TXYVOL4,5476
5
+ crieur/models.py,sha256=512IUzmQ000z-m9sBojPR9WVfQDpNne6Nq2LaLPS9Z0,6042
6
6
  crieur/utils.py,sha256=kIdxpd5LgVv13Lx2aEXzjQttBDtcppRlwNsH0vwX8f0,1566
7
7
  crieur/statics/pico.css,sha256=VdrimW9PLcEIzqJ__s062OrwBj_Jb6jZIwbtdqOtM-w,93407
8
8
  crieur/templates/article.html,sha256=4Y1sjBR1nM_ff4yVGgiVlZU1tmnfBMXAjTTSAhqoiA4,1288
@@ -11,8 +11,8 @@ crieur/templates/base.html,sha256=6ih6RryTPXZxR6tqlbRHPpOFUNRu90SPvdfKNLHcRRM,15
11
11
  crieur/templates/homepage.html,sha256=IgYc3cyw-52U3HN1oada0drkzT0fPNyFcdiG6Pwcr9o,3027
12
12
  crieur/templates/keyword.html,sha256=Hv3Ep3R6oN5pBw14gfQT-aeqEiuFiatmVZLWn5hR1e4,428
13
13
  crieur/templates/numero.html,sha256=b9J6aW_h9ao7XlWA0Xc390ahOH5lHDI8A4iDq6tEZTo,1882
14
- crieur-1.3.0.dist-info/METADATA,sha256=iU-bv4g_lcMheW3CYDSGx91YmVDuYHfNSBBaNgPOL9A,44848
15
- crieur-1.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- crieur-1.3.0.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
17
- crieur-1.3.0.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
18
- crieur-1.3.0.dist-info/RECORD,,
14
+ crieur-1.3.2.dist-info/METADATA,sha256=Fpzpq1CXeGyJ1QVw-6jqNjMGbkRvMJMvCBasDOLLL_Y,44848
15
+ crieur-1.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ crieur-1.3.2.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
17
+ crieur-1.3.2.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
18
+ crieur-1.3.2.dist-info/RECORD,,
File without changes