galaxy-update 0.0.1__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.
- galaxy_update-0.0.1/LICENSE +21 -0
- galaxy_update-0.0.1/PKG-INFO +42 -0
- galaxy_update-0.0.1/README.md +18 -0
- galaxy_update-0.0.1/pyproject.toml +119 -0
- galaxy_update-0.0.1/src/galaxy_update/__init__.py +1 -0
- galaxy_update-0.0.1/src/galaxy_update/__main__.py +6 -0
- galaxy_update-0.0.1/src/galaxy_update/cli.py +42 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 DeadNews
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: galaxy-update
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Update dependencies in requirements.yml
|
|
5
|
+
Home-page: https://github.com/deadnews/galaxy-update
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: ansible,galaxy,ansible-galaxy ,requirements
|
|
8
|
+
Author: DeadNews
|
|
9
|
+
Author-email: deadnewsgit@gmail.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
18
|
+
Requires-Dist: httpx (>=0.27.0,<0.28.0)
|
|
19
|
+
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
20
|
+
Project-URL: Documentation, https://deadnews.github.io/galaxy-update
|
|
21
|
+
Project-URL: Repository, https://github.com/deadnews/galaxy-update
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# galaxy-update
|
|
25
|
+
|
|
26
|
+
> Update dependencies in `requirements.yml`
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/galaxy-update)
|
|
29
|
+
[](https://github.com/deadnews/galaxy-update/releases/latest)
|
|
30
|
+
[](https://deadnews.github.io/galaxy-update)
|
|
31
|
+
[](https://results.pre-commit.ci/latest/github/deadnews/galaxy-update/main)
|
|
32
|
+
[](https://github.com/deadnews/galaxy-update/actions/workflows/main.yml)
|
|
33
|
+
[](https://app.codecov.io/gh/deadnews/galaxy-update)
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
pip install galaxy-update
|
|
39
|
+
# or
|
|
40
|
+
pipx install galaxy-update
|
|
41
|
+
```
|
|
42
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# galaxy-update
|
|
2
|
+
|
|
3
|
+
> Update dependencies in `requirements.yml`
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/galaxy-update)
|
|
6
|
+
[](https://github.com/deadnews/galaxy-update/releases/latest)
|
|
7
|
+
[](https://deadnews.github.io/galaxy-update)
|
|
8
|
+
[](https://results.pre-commit.ci/latest/github/deadnews/galaxy-update/main)
|
|
9
|
+
[](https://github.com/deadnews/galaxy-update/actions/workflows/main.yml)
|
|
10
|
+
[](https://app.codecov.io/gh/deadnews/galaxy-update)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pip install galaxy-update
|
|
16
|
+
# or
|
|
17
|
+
pipx install galaxy-update
|
|
18
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
|
|
3
|
+
build-backend = "poetry_dynamic_versioning.backend"
|
|
4
|
+
|
|
5
|
+
[tool.poetry]
|
|
6
|
+
name = "galaxy-update"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Update dependencies in requirements.yml"
|
|
9
|
+
authors = ["DeadNews <deadnewsgit@gmail.com>"]
|
|
10
|
+
license = "MIT"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
homepage = "https://github.com/deadnews/galaxy-update"
|
|
13
|
+
repository = "https://github.com/deadnews/galaxy-update"
|
|
14
|
+
documentation = "https://deadnews.github.io/galaxy-update"
|
|
15
|
+
keywords = ["ansible", "galaxy", "ansible-galaxy ", "requirements"]
|
|
16
|
+
classifiers = ["Operating System :: OS Independent"]
|
|
17
|
+
|
|
18
|
+
[tool.poetry.scripts]
|
|
19
|
+
galaxy-update = "galaxy_update.__main__:cli"
|
|
20
|
+
|
|
21
|
+
[tool.poetry.dependencies]
|
|
22
|
+
python = "^3.10"
|
|
23
|
+
click = "^8.1.7"
|
|
24
|
+
httpx = "^0.27.0"
|
|
25
|
+
pyyaml = "^6.0.2"
|
|
26
|
+
|
|
27
|
+
[tool.poetry.group.lint.dependencies]
|
|
28
|
+
mypy = "^1.11.2"
|
|
29
|
+
poethepoet = "^0.26.1"
|
|
30
|
+
pyright = "^1.1.378"
|
|
31
|
+
ruff = "^0.6.2"
|
|
32
|
+
types-pyyaml = "^6.0.12.20240808"
|
|
33
|
+
|
|
34
|
+
[tool.poetry.group.test.dependencies]
|
|
35
|
+
pytest = "^8.3.2"
|
|
36
|
+
pytest-cov = "^5.0.0"
|
|
37
|
+
|
|
38
|
+
[tool.poetry.group.docs.dependencies]
|
|
39
|
+
mkdocs = "^1.6.1"
|
|
40
|
+
mkdocs-click = "^0.8.1"
|
|
41
|
+
mkdocs-gen-files = "^0.5.0"
|
|
42
|
+
mkdocs-literate-nav = "^0.6.1"
|
|
43
|
+
mkdocs-material = "^9.5.33"
|
|
44
|
+
mkdocstrings = "^0.25.1"
|
|
45
|
+
mkdocstrings-python = "^1.10.9"
|
|
46
|
+
|
|
47
|
+
[tool.poetry-dynamic-versioning]
|
|
48
|
+
enable = false
|
|
49
|
+
vcs = "git"
|
|
50
|
+
style = "semver"
|
|
51
|
+
|
|
52
|
+
[tool.poe.tasks]
|
|
53
|
+
mypy = "mypy ."
|
|
54
|
+
pyright = "pyright ."
|
|
55
|
+
ruff = "ruff check ."
|
|
56
|
+
ruff-fmt = "ruff format ."
|
|
57
|
+
lint.sequence = ["ruff", "ruff-fmt", "mypy", "pyright"]
|
|
58
|
+
|
|
59
|
+
[tool.poe.tasks.test]
|
|
60
|
+
cmd = "pytest --cov-report=xml"
|
|
61
|
+
|
|
62
|
+
[tool.pytest.ini_options]
|
|
63
|
+
addopts = "--verbose --cov=./src --cov-report=term"
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
|
|
66
|
+
[tool.coverage.report]
|
|
67
|
+
exclude_lines = [
|
|
68
|
+
"# pragma: no cover",
|
|
69
|
+
"if __name__ == .__main__.:",
|
|
70
|
+
"if TYPE_CHECKING:",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.mypy]
|
|
74
|
+
disallow_untyped_defs = true
|
|
75
|
+
follow_imports = "normal"
|
|
76
|
+
ignore_missing_imports = true
|
|
77
|
+
show_column_numbers = true
|
|
78
|
+
show_error_codes = true
|
|
79
|
+
warn_unused_ignores = true
|
|
80
|
+
|
|
81
|
+
[[tool.mypy.overrides]]
|
|
82
|
+
module = ["tests.*"]
|
|
83
|
+
disallow_untyped_defs = false
|
|
84
|
+
|
|
85
|
+
[tool.pyright]
|
|
86
|
+
include = ["src"]
|
|
87
|
+
ignore = ["tests"]
|
|
88
|
+
typeCheckingMode = "standard"
|
|
89
|
+
|
|
90
|
+
[tool.ruff]
|
|
91
|
+
line-length = 99
|
|
92
|
+
target-version = "py310" # Until Poetry v2
|
|
93
|
+
|
|
94
|
+
[tool.ruff.format]
|
|
95
|
+
line-ending = "lf"
|
|
96
|
+
|
|
97
|
+
[tool.ruff.lint]
|
|
98
|
+
select = ["ALL"]
|
|
99
|
+
ignore = [
|
|
100
|
+
"COM812", # Trailing comma missing
|
|
101
|
+
"FBT001", # Boolean positional arg in function definition
|
|
102
|
+
"FBT002", # Boolean default value in function definition
|
|
103
|
+
"ISC001", # Checks for implicitly concatenated strings on a single line
|
|
104
|
+
"PLR0913", # Too many arguments to function call
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[tool.ruff.lint.per-file-ignores]
|
|
108
|
+
"__init__.py" = ["F401"]
|
|
109
|
+
"tests/*" = ["ANN", "D", "E501", "PLC1901", "PLR2004", "S"]
|
|
110
|
+
|
|
111
|
+
[tool.ruff.lint.flake8-tidy-imports]
|
|
112
|
+
ban-relative-imports = "all"
|
|
113
|
+
|
|
114
|
+
[tool.ruff.lint.pycodestyle]
|
|
115
|
+
max-doc-length = 129
|
|
116
|
+
max-line-length = 129
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.pydocstyle]
|
|
119
|
+
convention = "google"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Public accessible objects of that module."""
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Update dependencies in requirements.yml."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import click
|
|
7
|
+
import httpx
|
|
8
|
+
import yaml
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command()
|
|
12
|
+
@click.argument(
|
|
13
|
+
"requirements",
|
|
14
|
+
nargs=-1,
|
|
15
|
+
required=True,
|
|
16
|
+
type=click.Path(exists=True, dir_okay=False, path_type=Path),
|
|
17
|
+
)
|
|
18
|
+
def cli(requirements: tuple[Path]) -> None:
|
|
19
|
+
"""Update dependencies in requirements.yml."""
|
|
20
|
+
asyncio.run(update_requirements(requirements))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def update_requirements(requirements: tuple[Path]) -> None:
|
|
24
|
+
"""Update dependencies in requirements.yml."""
|
|
25
|
+
# Create a HTTP client
|
|
26
|
+
async with httpx.AsyncClient() as client:
|
|
27
|
+
base_url = "https://galaxy.ansible.com/api"
|
|
28
|
+
collections_index = "v3/plugin/ansible/content/published/collections/index"
|
|
29
|
+
|
|
30
|
+
for requirements_file in requirements:
|
|
31
|
+
# Load the requirements file
|
|
32
|
+
reqs = yaml.safe_load(requirements_file.read_text())
|
|
33
|
+
|
|
34
|
+
# Update the versions
|
|
35
|
+
for collection in reqs["collections"]:
|
|
36
|
+
name = collection["name"].replace(".", "/")
|
|
37
|
+
response = await client.get(f"{base_url}/{collections_index}/{name}/versions/")
|
|
38
|
+
response.raise_for_status()
|
|
39
|
+
collection["version"] = response.json()["data"][0]["version"]
|
|
40
|
+
|
|
41
|
+
# Write the updated requirements back to the file
|
|
42
|
+
requirements_file.write_text(yaml.safe_dump(reqs, explicit_start=True))
|