galactic 0.4.0.0.post1.dev142__tar.gz → 0.4.0.0.post1.dev151__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.
Files changed (37) hide show
  1. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/PKG-INFO +1 -3
  2. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/conf.py +8 -1
  3. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/index.rst +5 -5
  4. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/package.store/README.md +2 -3
  5. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/pyproject.toml +3 -6
  6. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/src/galactic/apps/cli/main/__init__.pyi +9 -9
  7. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/src/galactic/apps/cli/main/_app.py +105 -89
  8. galactic-0.4.0.0.post1.dev151/store.md +4 -0
  9. galactic-0.4.0.0.post1.dev142/store.md +0 -1
  10. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/.gitignore +0 -0
  11. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/LICENSE +0 -0
  12. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/README.rst +0 -0
  13. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/_templates/autosummary/module.rst +0 -0
  14. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/_templates/components/prev-next.html +0 -0
  15. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/api/apps/cli/main/index.rst +0 -0
  16. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/api/apps/cli/main/modules/galactic.apps.cli.main.rst +0 -0
  17. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/icon-dark.svg +0 -0
  18. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/icon-light.svg +0 -0
  19. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/install/index.rst +0 -0
  20. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/release-notes.md +0 -0
  21. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/release-notes.txt +0 -0
  22. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/thegalactic.ico +0 -0
  23. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/thegalactic.svg +0 -0
  24. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/docs/usage.rst +0 -0
  25. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/hatch/.git +0 -0
  26. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/hatch/.gitignore +0 -0
  27. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/hatch/README.md +0 -0
  28. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/hatch/build.py +0 -0
  29. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/hatch/icon.svg +0 -0
  30. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/package.store/.git +0 -0
  31. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/package.store/.gitignore +0 -0
  32. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/package.store/hatch_build.py +0 -0
  33. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/package.store/icon.svg +0 -0
  34. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/package.store/pyproject.toml +0 -0
  35. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/src/galactic/apps/cli/main/__init__.py +0 -0
  36. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/src/galactic/apps/cli/main/py.typed +0 -0
  37. {galactic-0.4.0.0.post1.dev142 → galactic-0.4.0.0.post1.dev151}/tests/dummy/src/galactic/apps/cli/dummy/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: galactic
3
- Version: 0.4.0.0.post1.dev142
3
+ Version: 0.4.0.0.post1.dev151
4
4
  Summary: GALACTIC main application
5
5
  Project-URL: Homepage, https://www.thegalactic.org/
6
6
  Project-URL: Documentation, https://www.thegalactic.org/docs/apps/cli/main/latest/
@@ -8,7 +8,6 @@ Project-URL: Repository, https://gitlab.univ-lr.fr/galactic/public/src/apps/cli/
8
8
  Project-URL: Issues, https://gitlab.univ-lr.fr/galactic/public/src/apps/cli/galactic-app-cli-main/-/issues/
9
9
  Project-URL: Icon-light, https://www.thegalactic.org/docs/apps/cli/main/latest/_static/icon-light.svg
10
10
  Project-URL: Icon-dark, https://www.thegalactic.org/docs/apps/cli/main/latest/_static/icon-dark.svg
11
- Project-URL: Index-public, https://www.thegalactic.org/pypi/public/simple/
12
11
  Author-email: The Galactic Organization <contact@thegalactic.org>
13
12
  Maintainer-email: The Galactic Organization <contact@thegalactic.org>
14
13
  License-Expression: BSD-3-Clause
@@ -25,7 +24,6 @@ Classifier: Programming Language :: Python :: 3.12
25
24
  Classifier: Programming Language :: Python :: 3.13
26
25
  Classifier: Programming Language :: Python :: 3.14
27
26
  Requires-Python: <3.15,>=3.11
28
- Requires-Dist: click~=8.3
29
27
  Requires-Dist: galactic-helper-core>=0.4.0.0.post1.dev
30
28
  Requires-Dist: platformdirs~=4.9
31
29
  Requires-Dist: rich-click~=1.9
@@ -30,7 +30,14 @@ extensions = [
30
30
  "sphinx_click",
31
31
  ]
32
32
 
33
- copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
33
+ copybutton_prompt_text = (
34
+ r">>> "
35
+ r"|\.\.\. "
36
+ r"|(?:\([^)\n]*\)\s*)?\$ "
37
+ r"|In \[\d*\]: "
38
+ r"| {2,5}\.\.\.: "
39
+ r"| {5,8}: "
40
+ )
34
41
  copybutton_prompt_is_regexp = True
35
42
  copybutton_line_continuation_character = "\\"
36
43
 
@@ -40,11 +40,11 @@ main application for **GALACTIC**.
40
40
  :maxdepth: 1
41
41
  :caption: GALACTIC
42
42
 
43
- Main <https://galactic.univ-lr.fr/>
44
- Projects <https://galactic.univ-lr.fr/docs/>
45
- Guides <https://galactic.univ-lr.fr/guides/>
46
- Slides <https://galactic.univ-lr.fr/slides/>
47
- Posters <https://galactic.univ-lr.fr/posters/>
43
+ Main <https://www.thegalactic.org/>
44
+ Projects <https://www.thegalactic.org/docs/>
45
+ Guides <https://www.thegalactic.org/guides/>
46
+ Slides <https://www.thegalactic.org/slides/>
47
+ Posters <https://www.thegalactic.org/posters/>
48
48
 
49
49
  Indices and tables
50
50
  ==================
@@ -1,9 +1,8 @@
1
- **GALACTIC** `package.market` submodule
1
+ **GALACTIC** `package.store` submodule
2
2
  =======================================
3
3
 
4
4
  This submodule can be added to projects that need to build an additional package for
5
- the market. It checks for the existence of a `market.md` file to create the
6
- documentation package.
5
+ the market.
7
6
 
8
7
  Icon constructed using:
9
8
 
@@ -40,15 +40,11 @@ classifiers = [
40
40
  "Natural Language :: English"
41
41
  ]
42
42
  dependencies = [
43
- "click~=8.3",
44
43
  "platformdirs~=4.9",
45
44
  "rich-click~=1.9",
46
45
  "galactic-helper-core>=0.4.0.0.post1.dev"
47
46
  ]
48
47
 
49
- [project.package.store]
50
- readme = "store.md"
51
-
52
48
  [project.urls]
53
49
  Homepage = "https://www.thegalactic.org/"
54
50
  Documentation = "https://www.thegalactic.org/docs/apps/cli/main/latest/"
@@ -57,8 +53,6 @@ Issues = "https://gitlab.univ-lr.fr/galactic/public/src/apps/cli/galactic-app-cl
57
53
  # Icons for the GUI and the documentation
58
54
  Icon-light = "https://www.thegalactic.org/docs/apps/cli/main/latest/_static/icon-light.svg"
59
55
  Icon-dark = "https://www.thegalactic.org/docs/apps/cli/main/latest/_static/icon-dark.svg"
60
- # List of extra-index-url used by pip starting by 'Index'
61
- Index-public = "https://www.thegalactic.org/pypi/public/simple/"
62
56
 
63
57
  [project.scripts]
64
58
  galactic = "galactic.apps.cli.main:application"
@@ -99,6 +93,9 @@ include = [
99
93
  "src/galactic/**/examples/"
100
94
  ]
101
95
 
96
+ [tool.hatch.build.targets."package.store".metadata]
97
+ readme = "store.md"
98
+
102
99
  [tool.hatch.envs.default]
103
100
  installer = "uv"
104
101
 
@@ -9,10 +9,10 @@ class Group(click.Group): # type: ignore[misc]
9
9
 
10
10
  application: Group
11
11
 
12
- def error(text: str, **kwargs: Any) -> None: ...
13
- def info(text: str, **kwargs: Any) -> None: ...
14
- def warning(text: str, **kwargs: Any) -> None: ...
15
- def comment(text: str, **kwargs: Any) -> None: ...
12
+ def error(text: str) -> None: ...
13
+ def info(text: str) -> None: ...
14
+ def warning(text: str) -> None: ...
15
+ def comment(text: str) -> None: ...
16
16
  def prompt(text: str, **kwargs: Any) -> Any: ...
17
17
  def confirm(text: str, **kwargs: Any) -> bool: ...
18
18
  def prompt_password_with_confirmation(
@@ -21,11 +21,11 @@ def prompt_password_with_confirmation(
21
21
  ) -> str: ...
22
22
 
23
23
  class AppStyles:
24
- ERROR: ClassVar[dict[str, Any]]
25
- WARNING: ClassVar[dict[str, Any]]
26
- INFO: ClassVar[dict[str, Any]]
27
- COMMENT: ClassVar[dict[str, Any]]
28
- QUESTION: ClassVar[dict[str, Any]]
24
+ ERROR: ClassVar[str]
25
+ WARNING: ClassVar[str]
26
+ INFO: ClassVar[str]
27
+ COMMENT: ClassVar[str]
28
+ QUESTION: ClassVar[str]
29
29
 
30
30
  def get_global_extra_index_lines(config_parser: ConfigParser) -> list[str]: ...
31
31
  def set_global_extra_index_lines(
@@ -10,6 +10,7 @@ import urllib.parse
10
10
  from configparser import ConfigParser
11
11
  from typing import TYPE_CHECKING, Any, ClassVar
12
12
 
13
+ import rich.console
13
14
  import rich_click as click
14
15
 
15
16
  from galactic.helpers.core import detect_plugins, resolve_pip_config_path
@@ -19,30 +20,6 @@ if TYPE_CHECKING:
19
20
  from pathlib import Path
20
21
 
21
22
 
22
- GALACTIC_INDEX_URL = "https://www.thegalactic.org/pypi/public/simple/"
23
- GALACTIC_EPILOG_PLAIN = (
24
- "GAlois LAttices, Concept Theory, Implicational systems and Closures."
25
- )
26
- GALACTIC_EPILOG_RICH = (
27
- "[yellow][bold]GA[/bold][/yellow]lois "
28
- "[yellow][bold]LA[/bold][/yellow]ttices, "
29
- "[yellow][bold]C[/bold][/yellow]oncept "
30
- "[yellow][bold]T[/bold][/yellow]heory, "
31
- "[yellow][bold]I[/bold][/yellow]mplicational systems and "
32
- "[yellow][bold]C[/bold][/yellow]losures."
33
- )
34
- GALACTIC_HELP_PLAIN = "GALACTIC main application."
35
- GALACTIC_HELP_RICH = "[yellow][bold]GALACTIC[/bold][/yellow] main application."
36
-
37
- if "sphinx" in sys.modules:
38
- GALACTIC_EPILOG = GALACTIC_EPILOG_PLAIN
39
- GALACTIC_HELP = GALACTIC_HELP_PLAIN
40
- else:
41
- click.rich_click.TEXT_MARKUP = "rich"
42
- GALACTIC_EPILOG = GALACTIC_EPILOG_RICH
43
- GALACTIC_HELP = GALACTIC_HELP_RICH
44
-
45
-
46
23
  # pylint: disable=too-few-public-methods
47
24
  class AppStyles:
48
25
  """
@@ -51,25 +28,67 @@ class AppStyles:
51
28
  Attributes
52
29
  ----------
53
30
  ERROR
54
- Style for errors (``{"fg": "red", "bold": True}`` by default).
31
+ Style for errors (``red bold`` by default).
55
32
  WARNING
56
- Style for warnings (``{"fg": "yellow", "bold": True}`` by default).
33
+ Style for warnings (``yellow bold`` by default).
57
34
  INFO
58
- Style for informations (``{"fg": "bright_magenta"}`` by default).
35
+ Style for informations (``bright_magenta`` by default).
59
36
  COMMENT
60
- Style for comments (``{"fg": "green"}`` by default).
37
+ Style for comments (``green`` by default).
61
38
  QUESTION
62
- Style for questions (``{"fg": "cyan"}`` by default).
39
+ Style for questions (``cyan`` by default).
63
40
  """
64
41
 
65
- ERROR: ClassVar[dict[str, Any]] = {"fg": "red", "bold": True}
66
- WARNING: ClassVar[dict[str, Any]] = {"fg": "yellow", "bold": True}
67
- INFO: ClassVar[dict[str, Any]] = {"fg": "bright_magenta"}
68
- COMMENT: ClassVar[dict[str, Any]] = {"fg": "green"}
69
- QUESTION: ClassVar[dict[str, Any]] = {"fg": "cyan"}
42
+ ERROR: ClassVar[str] = "red bold"
43
+ WARNING: ClassVar[str] = "yellow bold"
44
+ INFO: ClassVar[str] = "bright_magenta"
45
+ COMMENT: ClassVar[str] = "green"
46
+ QUESTION: ClassVar[str] = "cyan"
70
47
 
71
48
 
72
- def error(text: str, **kwargs: Any) -> None:
49
+ # pylint: disable=too-few-public-methods
50
+ class AppEnvVars:
51
+ """
52
+ Environment variables.
53
+
54
+ Attributes
55
+ ----------
56
+ NO_COLOR
57
+ Name of environment variable for no-color.
58
+ FORCE_COLOR
59
+ Name of environment variable for force color.
60
+ """
61
+
62
+ # https://no-color.org
63
+ NO_COLOR = "NO_COLOR"
64
+ FORCE_COLOR = "FORCE_COLOR"
65
+
66
+
67
+ GALACTIC_INDEX_URL = "https://www.thegalactic.org/pypi/simple/"
68
+ GALACTIC_EPILOG_PLAIN = (
69
+ "GAlois LAttices, Concept Theory, Implicational systems and Closures."
70
+ )
71
+ GALACTIC_EPILOG_RICH = (
72
+ f"[{AppStyles.WARNING}]GA[/]lois "
73
+ f"[{AppStyles.WARNING}]LA[/]ttices, "
74
+ f"[{AppStyles.WARNING}]C[/]oncept "
75
+ f"[{AppStyles.WARNING}]T[/]heory, "
76
+ f"[{AppStyles.WARNING}]I[/]mplicational systems and "
77
+ f"[{AppStyles.WARNING}]C[/]losures."
78
+ )
79
+ GALACTIC_HELP_PLAIN = "GALACTIC main application."
80
+ GALACTIC_HELP_RICH = f"[{AppStyles.WARNING}]GALACTIC[/] main application."
81
+
82
+ if "sphinx" in sys.modules:
83
+ GALACTIC_EPILOG = GALACTIC_EPILOG_PLAIN
84
+ GALACTIC_HELP = GALACTIC_HELP_PLAIN
85
+ else:
86
+ click.rich_click.TEXT_MARKUP = "rich"
87
+ GALACTIC_EPILOG = GALACTIC_EPILOG_RICH
88
+ GALACTIC_HELP = GALACTIC_HELP_RICH
89
+
90
+
91
+ def error(text: str) -> None:
73
92
  """
74
93
  Display an error message.
75
94
 
@@ -77,14 +96,12 @@ def error(text: str, **kwargs: Any) -> None:
77
96
  ----------
78
97
  text
79
98
  Text to display
80
- **kwargs
81
- Additional parameters passed to click.secho
82
99
 
83
100
  """
84
- click.secho(text, **AppStyles.ERROR, **kwargs)
101
+ rich.console.Console().print(text, style=AppStyles.ERROR)
85
102
 
86
103
 
87
- def info(text: str, **kwargs: Any) -> None:
104
+ def info(text: str) -> None:
88
105
  """
89
106
  Display an info message.
90
107
 
@@ -92,14 +109,12 @@ def info(text: str, **kwargs: Any) -> None:
92
109
  ----------
93
110
  text
94
111
  Text to display
95
- **kwargs
96
- Additional parameters passed to click.secho
97
112
 
98
113
  """
99
- click.secho(text, **AppStyles.INFO, **kwargs)
114
+ rich.console.Console().print(text, style=AppStyles.INFO)
100
115
 
101
116
 
102
- def warning(text: str, **kwargs: Any) -> None:
117
+ def warning(text: str) -> None:
103
118
  """
104
119
  Display a warning.
105
120
 
@@ -107,14 +122,12 @@ def warning(text: str, **kwargs: Any) -> None:
107
122
  ----------
108
123
  text
109
124
  Text to display
110
- **kwargs
111
- Additional parameters passed to click.secho
112
125
 
113
126
  """
114
- click.secho(text, **AppStyles.WARNING, **kwargs)
127
+ rich.console.Console().print(text, style=AppStyles.WARNING)
115
128
 
116
129
 
117
- def comment(text: str, **kwargs: Any) -> None:
130
+ def comment(text: str) -> None:
118
131
  """
119
132
  Display a comment.
120
133
 
@@ -122,11 +135,9 @@ def comment(text: str, **kwargs: Any) -> None:
122
135
  ----------
123
136
  text
124
137
  Text to display
125
- **kwargs
126
- Additional parameters passed to click.secho
127
138
 
128
139
  """
129
- click.secho(text, **AppStyles.COMMENT, **kwargs)
140
+ rich.console.Console().print(text, style=AppStyles.COMMENT)
130
141
 
131
142
 
132
143
  def prompt(text: str, **kwargs: Any) -> Any:
@@ -141,7 +152,10 @@ def prompt(text: str, **kwargs: Any) -> Any:
141
152
  Additional parameters passed to click.prompt
142
153
 
143
154
  """
144
- return click.prompt(click.style(text, **AppStyles.QUESTION), **kwargs)
155
+ return click.prompt(
156
+ str(rich.console.Console().render_str(text, style=AppStyles.QUESTION)),
157
+ **kwargs,
158
+ )
145
159
 
146
160
 
147
161
  def confirm(text: str, **kwargs: Any) -> bool:
@@ -156,7 +170,10 @@ def confirm(text: str, **kwargs: Any) -> bool:
156
170
  Additional parameters passed to click.confirm
157
171
 
158
172
  """
159
- return click.confirm(click.style(text, **AppStyles.QUESTION), **kwargs)
173
+ return click.confirm(
174
+ str(rich.console.Console().render_str(text, style=AppStyles.QUESTION)),
175
+ **kwargs,
176
+ )
160
177
 
161
178
 
162
179
  def prompt_password_with_confirmation(
@@ -199,24 +216,6 @@ def prompt_password_with_confirmation(
199
216
  error("Passwords do not match. Please retry.")
200
217
 
201
218
 
202
- # pylint: disable=too-few-public-methods
203
- class AppEnvVars:
204
- """
205
- Environment variables.
206
-
207
- Attributes
208
- ----------
209
- NO_COLOR
210
- Name of environment variable for no-color.
211
- FORCE_COLOR
212
- Name of environment variable for force color.
213
- """
214
-
215
- # https://no-color.org
216
- NO_COLOR = "NO_COLOR"
217
- FORCE_COLOR = "FORCE_COLOR"
218
-
219
-
220
219
  class Group(click.RichGroup): # type: ignore[misc]
221
220
  """
222
221
  Group class for the GALACTIC app.
@@ -342,39 +341,54 @@ def config_init() -> None:
342
341
  if config_path.exists():
343
342
  backup_path = config_path.with_name(f"{config_path.name}.old")
344
343
  config_parser.read(config_path, encoding="utf-8")
345
- lines = get_global_extra_index_lines(config_parser)
346
- if GALACTIC_INDEX_URL in lines:
344
+ if not config_parser.has_section("global"):
345
+ config_parser.add_section("global")
346
+ index = config_parser.get("global", "index-url", fallback="")
347
+ url = urllib.parse.urlparse(index)
348
+ hostname = url.hostname
349
+ port = url.port
350
+ netloc = f"{hostname}{':' + str(port) if port else ''}"
351
+ index = urllib.parse.urlunparse(
352
+ (url.scheme, netloc, url.path, url.params, url.query, url.fragment),
353
+ )
354
+ if index == GALACTIC_INDEX_URL:
347
355
  warning(
348
356
  f"GALACTIC public index is already configured in {config_path}.",
349
357
  )
350
358
  return
351
359
  warn_backup(config_parser, backup_path)
352
- else:
353
- lines = []
354
- lines.insert(0, GALACTIC_INDEX_URL)
355
- set_global_extra_index_lines(config_parser, lines)
360
+ if not config_parser.has_section("global"):
361
+ config_parser.add_section("global")
362
+ config_parser.set("global", "index-url", GALACTIC_INDEX_URL)
356
363
  info_save(config_parser, config_path)
357
364
 
358
365
 
359
- @config.command("extra-index-url") # type: ignore[untyped-decorator]
360
- def config_extra_index_url() -> None:
366
+ @config.command("credential") # type: ignore[untyped-decorator]
367
+ def config_credential() -> None:
361
368
  """
362
- Update credentials for an extra-index-url entry.
369
+ Update credentials for an index-url entry.
363
370
  """
364
371
  config_parser = ConfigParser(interpolation=None)
365
372
  config_path = resolve_pip_config_path()
366
373
  if config_path.exists():
367
374
  backup_path = config_path.with_name(f"{config_path.name}.old")
368
375
  config_parser.read(config_path, encoding="utf-8")
369
- lines = get_global_extra_index_lines(config_parser)
370
- if GALACTIC_INDEX_URL not in lines:
376
+ if not config_parser.has_section("global"):
377
+ config_parser.add_section("global")
378
+ index_url = config_parser.get("global", "index-url", fallback="")
379
+ url = urllib.parse.urlparse(index_url)
380
+ hostname = url.hostname
381
+ port = url.port
382
+ netloc = f"{hostname}{':' + str(port) if port else ''}"
383
+ index_url = urllib.parse.urlunparse(
384
+ (url.scheme, netloc, url.path, url.params, url.query, url.fragment),
385
+ )
386
+ if index_url != GALACTIC_INDEX_URL:
371
387
  warn_run_init()
372
388
  return
373
- lines = [line for line in lines if line != GALACTIC_INDEX_URL]
374
- if not lines:
375
- warning("No extra-index-url found.")
376
- return
377
- info("Found extra-index-url entries:")
389
+ lines = get_global_extra_index_lines(config_parser)
390
+ lines.insert(0, index_url)
391
+ info("Found index entries:")
378
392
  parsed_urls = [urllib.parse.urlparse(line) for line in lines]
379
393
  for index, url in enumerate(parsed_urls, start=1):
380
394
  hostname = url.hostname
@@ -398,14 +412,16 @@ def config_extra_index_url() -> None:
398
412
  f"{urllib.parse.quote(username)}"
399
413
  f":{urllib.parse.quote(password)}"
400
414
  f"@{hostname}"
401
- f"{':' + port if port else ''}"
415
+ f"{':' + str(port) if port else ''}"
402
416
  )
403
417
  warn_backup(config_parser, backup_path)
404
418
  lines[selected_index - 1] = urllib.parse.urlunparse(
405
419
  (url.scheme, netloc, url.path, url.params, url.query, url.fragment),
406
420
  )
407
- lines.insert(0, GALACTIC_INDEX_URL)
408
- set_global_extra_index_lines(config_parser, lines)
421
+ if selected_index == 1:
422
+ config_parser.set("global", "index-url", lines[0])
423
+ else:
424
+ set_global_extra_index_lines(config_parser, lines[1:])
409
425
  info_save(config_parser, config_path)
410
426
  else:
411
427
  warn_run_init()
@@ -0,0 +1,4 @@
1
+ Main `galactic` **C**ommand **L**ine **I**nterface.
2
+ This is the main entry point for users to interact with the **GALACTIC** ecosystem.
3
+ It has been designed to be modular and extensible, allowing developers
4
+ to easily add new features and functionality as needed.
@@ -1 +0,0 @@
1
- Main `galactic` command line application.