article-cli 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.
article_cli/__init__.py CHANGED
@@ -8,7 +8,7 @@ This package provides tools for:
8
8
  - Git hooks setup
9
9
  """
10
10
 
11
- __version__ = "1.3.0"
11
+ __version__ = "1.3.2"
12
12
  __author__ = "Christophe Prud'homme"
13
13
  __email__ = "prudhomm@cemosis.fr"
14
14
 
article_cli/config.py CHANGED
@@ -214,23 +214,12 @@ class Config:
214
214
 
215
215
  def get_fonts_config(self) -> Dict[str, Any]:
216
216
  """Get font installation configuration"""
217
- # Default font sources
218
- default_sources = [
219
- {
220
- "name": "Marianne",
221
- "url": "https://www.systeme-de-design.gouv.fr/uploads/Marianne_fd0ba9c190.zip",
222
- "description": "French government official font",
223
- },
224
- {
225
- "name": "Roboto Mono",
226
- "url": "https://fonts.google.com/download?family=Roboto+Mono",
227
- "description": "Google's monospace font",
228
- },
229
- ]
217
+ # Import default sources from fonts module to keep them in sync
218
+ from .fonts import DEFAULT_FONT_SOURCES
230
219
 
231
220
  return {
232
221
  "directory": self.get("fonts", "directory", "fonts"),
233
- "sources": self.get("fonts", "sources", default_sources),
222
+ "sources": self.get("fonts", "sources", DEFAULT_FONT_SOURCES),
234
223
  }
235
224
 
236
225
  def get_themes_config(self) -> Dict[str, Any]:
article_cli/fonts.py CHANGED
@@ -9,26 +9,38 @@ import zipfile
9
9
  import tempfile
10
10
  from pathlib import Path
11
11
  from typing import List, Dict, Optional, Any
12
- from urllib.request import urlopen, Request
13
- from urllib.error import URLError, HTTPError
12
+
13
+ import requests
14
14
 
15
15
  from .zotero import print_error, print_info, print_success, print_warning
16
16
 
17
17
 
18
18
  # Default font sources for common themes
19
+ # Note: Marianne font from French government requires manual download due to Cloudflare protection.
20
+ # Configure custom URL in pyproject.toml if you have a mirror or local copy.
19
21
  DEFAULT_FONT_SOURCES = [
20
22
  {
21
- "name": "Marianne",
22
- "url": "https://www.systeme-de-design.gouv.fr/uploads/Marianne_fd0ba9c190.zip",
23
- "description": "French government official font (Système de Design de l'État)",
23
+ "name": "Roboto",
24
+ "url": "https://github.com/googlefonts/roboto/releases/download/v2.138/roboto-unhinted.zip",
25
+ "description": "Google's sans-serif font family",
24
26
  },
25
27
  {
26
28
  "name": "Roboto Mono",
27
- "url": "https://fonts.google.com/download?family=Roboto+Mono",
29
+ "url": "https://github.com/googlefonts/RobotoMono/archive/refs/heads/main.zip",
28
30
  "description": "Google's monospace font, good for code",
29
31
  },
30
32
  ]
31
33
 
34
+ # Additional font sources that may require special handling
35
+ OPTIONAL_FONT_SOURCES = {
36
+ "Marianne": {
37
+ "name": "Marianne",
38
+ "url": "https://www.info.gouv.fr/upload/media/content/0001/14/e9dd2398914853b3c21c402245866bc74cd3d3c5.zip",
39
+ "description": "French government official font - TTF version (Système de Design de l'État)",
40
+ "note": "May require manual download due to Cloudflare protection",
41
+ },
42
+ }
43
+
32
44
 
33
45
  class FontInstaller:
34
46
  """Handles downloading and installing fonts for LaTeX projects"""
@@ -163,25 +175,30 @@ class FontInstaller:
163
175
  url: URL to download
164
176
  dest: Destination path
165
177
  """
166
- # Create request with user agent to avoid blocks
167
- headers = {"User-Agent": "Mozilla/5.0 (compatible; article-cli font installer)"}
168
- request = Request(url, headers=headers)
178
+ # Use requests library for better redirect and header handling
179
+ headers = {
180
+ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
181
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
182
+ "Accept-Language": "en-US,en;q=0.5",
183
+ }
169
184
 
170
185
  try:
171
- with urlopen(request, timeout=60) as response:
172
- # Get file size if available
173
- content_length = response.headers.get("Content-Length")
174
- total_size = int(content_length) if content_length else None
175
-
176
- # Download in chunks
177
- chunk_size = 8192
178
- downloaded = 0
179
-
180
- with open(dest, "wb") as f:
181
- while True:
182
- chunk = response.read(chunk_size)
183
- if not chunk:
184
- break
186
+ response = requests.get(
187
+ url, headers=headers, allow_redirects=True, stream=True, timeout=60
188
+ )
189
+ response.raise_for_status()
190
+
191
+ # Get file size if available
192
+ content_length = response.headers.get("Content-Length")
193
+ total_size = int(content_length) if content_length else None
194
+
195
+ # Download in chunks
196
+ chunk_size = 8192
197
+ downloaded = 0
198
+
199
+ with open(dest, "wb") as f:
200
+ for chunk in response.iter_content(chunk_size=chunk_size):
201
+ if chunk:
185
202
  f.write(chunk)
186
203
  downloaded += len(chunk)
187
204
 
@@ -200,14 +217,16 @@ class FontInstaller:
200
217
  flush=True,
201
218
  )
202
219
 
203
- print() # New line after progress
220
+ print() # New line after progress
204
221
 
205
- except HTTPError as e:
206
- raise RuntimeError(f"HTTP error {e.code}: {e.reason}")
207
- except URLError as e:
208
- raise RuntimeError(f"URL error: {e.reason}")
209
- except TimeoutError:
222
+ except requests.exceptions.HTTPError as e:
223
+ raise RuntimeError(f"HTTP error: {e}")
224
+ except requests.exceptions.ConnectionError as e:
225
+ raise RuntimeError(f"Connection error: {e}")
226
+ except requests.exceptions.Timeout:
210
227
  raise RuntimeError("Download timed out")
228
+ except requests.exceptions.RequestException as e:
229
+ raise RuntimeError(f"Download failed: {e}")
211
230
 
212
231
  def _extract_zip(self, zip_path: Path, target_dir: Path) -> None:
213
232
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: article-cli
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: CLI tool for managing LaTeX articles with git integration and Zotero bibliography
5
5
  Project-URL: Homepage, https://github.com/feelpp/article.cli
6
6
  Project-URL: Documentation, https://github.com/feelpp/article.cli#readme
@@ -1,15 +1,15 @@
1
- article_cli/__init__.py,sha256=5xXonniDwNo5x54WjlEBZvKw6ZQYizyNFF0PF2QXFFs,676
1
+ article_cli/__init__.py,sha256=wuVc1FR0SPoWe5SYca910BhVIO-D0HW3ycuUq79AV9M,676
2
2
  article_cli/__main__.py,sha256=qfYSLURgV55pFVeTarTsACCTBchmkx37LY3GaB4L9RI,135
3
3
  article_cli/cli.py,sha256=6UhGicCZs1KMoPiwjPPh8kHayHxNuXqrlPoIVojHlTM,22052
4
- article_cli/config.py,sha256=u6HfJXAbPVAlo0bWf7JUOgdAfCPXhMOeBh0yQyJbIB4,15157
5
- article_cli/fonts.py,sha256=6DCmerMyys5vg0XdYyecqcJhHH0qCx_F8m-tvVSMWAc,10379
4
+ article_cli/config.py,sha256=Rgx2SQN3xfEV072CLQfx2c23YRJWP2AeROoiEKTt8yA,14781
5
+ article_cli/fonts.py,sha256=-0-RuZxX6HzV4eNOMe3uD6fMLOlwRkf1EfzsNy1MCpA,11310
6
6
  article_cli/git_manager.py,sha256=uJtzgjRmPpcXDuCBMdbf0BWpsvAtoCQtSxDSFB0836E,12017
7
7
  article_cli/latex_compiler.py,sha256=C2AxZA-nrCgP9xnZaL2p-tAP2MKuCW8xJ9DcFX40w4E,18575
8
8
  article_cli/repository_setup.py,sha256=gtq6C5OkqJjjWLbfNzjgniylteFMSjDek6crdOcPBig,59482
9
9
  article_cli/themes.py,sha256=x5dVGUzp1fnHOqspWrVi5IlK1Yf4YSM3M_jlttY_XEk,13853
10
10
  article_cli/zotero.py,sha256=IoqdZ0dgnTeSlmF6Kb2eNyZoVwA7_C5wKASlvj93cDc,12845
11
- article_cli-1.3.0.dist-info/METADATA,sha256=7VuPghtyfmBP5--Yp64sG5m7FrD6VBXL6MRIUZtToyE,12704
12
- article_cli-1.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
13
- article_cli-1.3.0.dist-info/entry_points.txt,sha256=TTD3ZO2r7w6Om13VFoFu_rW1LTmYzknhNsIep-uAvBg,53
14
- article_cli-1.3.0.dist-info/licenses/LICENSE,sha256=SjACEUOvqClPlozgN4K7uHFc39TDDikcH0YEot056l0,1077
15
- article_cli-1.3.0.dist-info/RECORD,,
11
+ article_cli-1.3.2.dist-info/METADATA,sha256=95dVXIoHYsGG0Pw5uX58bo_-wcxcXV3DQWQKr_dYh1I,12704
12
+ article_cli-1.3.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
13
+ article_cli-1.3.2.dist-info/entry_points.txt,sha256=TTD3ZO2r7w6Om13VFoFu_rW1LTmYzknhNsIep-uAvBg,53
14
+ article_cli-1.3.2.dist-info/licenses/LICENSE,sha256=SjACEUOvqClPlozgN4K7uHFc39TDDikcH0YEot056l0,1077
15
+ article_cli-1.3.2.dist-info/RECORD,,