Skip to content

Commit a0c2931

Browse files
rebuild
1 parent d0dadc0 commit a0c2931

File tree

13 files changed

+1331
-1124
lines changed

13 files changed

+1331
-1124
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ clean: clean-pyc clean-test
3131
# tests are often slow and linting is fast, so run tests on linted code.
3232
test: clean poetry.lock
3333
@echo "Running unit tests"
34-
$(VENV) pytest --doctest-modules git_mirror
34+
$(VENV) pytest --doctest-modules git_mirror -n 2
3535
# $(VENV) python -m unittest discover
3636
$(VENV) py.test tests -vv -n 2 --cov=git_mirror --cov-report=html --cov-fail-under 50
3737
$(VENV) bash basic_help.sh
@@ -78,7 +78,7 @@ bandit: .build_history/bandit
7878
.PHONY: pylint
7979
.build_history/pylint: .build_history .build_history/isort .build_history/black $(FILES)
8080
@echo "Linting with pylint"
81-
$(VENV) ruff --fix
81+
$(VENV) ruff check --fix
8282
$(VENV) pylint git_mirror --fail-under 9.8
8383
@touch .build_history/pylint
8484

docs/TODO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Top Top Priority
2+
- Rename to gittyup
3+
- Change selfhosted to self-hosted-gitlab
4+
- Maybe shows some minimal output before running a command (config)
5+
- Support flat directory structure for gitlab
6+
- Support repo to folder map?
7+
18
## Top priority
29
- PAT token init help
310
- platform dirs for config files

git_mirror.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ include_private = true
1515
include_forks = false
1616

1717
[tool.git-mirror.selfhosted]
18-
type = "gitlab"
18+
type = "gitlab" # host_type?
1919
user_name = "mmartin"
2020
url = "http://git.example.com"
2121
pypi_owner_name = "Matthew Martin"

git_mirror/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,4 +496,5 @@ def host_specific_args(parser: argparse.ArgumentParser, use_github: bool, use_gi
496496

497497

498498
if __name__ == "__main__":
499+
# sys.exit(main(["list-repos","--host=selfhosted","--verbose"], use_selfhosted=True))
499500
sys.exit(main(sys.argv[1:]))

git_mirror/manage_github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def version_info(self) -> dict[str, Any]:
619619
Return API version information.
620620
"""
621621
# pygithub doesn't support this endpoint?
622-
response = httpx.get(f"{self.host_domain}/versions")
622+
response = httpx.get(f"{self.host_domain}/versions", timeout=10)
623623
response.raise_for_status() # Raises an exception for 4XX/5XX responses
624624
data = response.json()
625625
versions_supported = data["info"]["version"]

git_mirror/manage_pypi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class PyPiManager:
7171

7272
def __init__(self, pypi_owner_name: Optional[str] = None):
7373
self.pypi_owner_name = pypi_owner_name
74-
self.client = httpx.AsyncClient()
74+
self.client = httpx.AsyncClient() # nosec
7575

7676
async def get_info(self, package_name: str) -> tuple[dict[str, Any], int]:
7777
"""

git_mirror/pat_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def check_pat_validity(token: str) -> bool:
2626
"""
2727
headers = {"Authorization": f"token {token}"}
2828
try:
29-
response = httpx.get("https://api.github.com/user", headers=headers)
29+
response = httpx.get("https://api.github.com/user", headers=headers, timeout=10)
3030
return response.status_code == 200
3131
except httpx.RequestError as e:
3232
console.print(f"An error occurred while checking PAT validity: {e}", style="danger")

git_mirror/pat_init_gitlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def check_pat_validity(token: str) -> bool:
2626
"""
2727
headers = {"Authorization": f"Bearer {token}"}
2828
try:
29-
response = httpx.get("https://gitlab.com/api/v4/user", headers=headers)
29+
response = httpx.get("https://gitlab.com/api/v4/user", headers=headers, timeout=10)
3030
return response.status_code == 200
3131
except httpx.RequestError as e:
3232
console.print(f"An error occurred while checking PAT validity: {e}", style="danger")

git_mirror/version_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def call_pypi_with_version_check(package_name: str, current_version: str) -> tup
2121
bool: True if the latest version on PyPI is greater than the current version, False otherwise.
2222
"""
2323
pypi_url = f"https://pypi.org/pypi/{package_name}/json"
24-
response = httpx.get(pypi_url)
24+
response = httpx.get(pypi_url, timeout=10)
2525
response.raise_for_status() # Raises an exception for 4XX/5XX responses
2626
data = response.json()
2727
latest_version = data["info"]["version"]

poetry.lock

Lines changed: 1309 additions & 1111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ classifiers = [
1515
"Programming Language :: Python :: 3.10",
1616
"Programming Language :: Python :: 3.11",
1717
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python :: 3.13",
1819
]
1920
include = [
2021
"git_mirror/**/*.py",

tests/tests_bot/test_run_git_mirror_gpt35/test_version_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_call_pypi_with_version_check_available_newer_version():
2323

2424
assert result is True
2525
assert new_version == expected_version
26-
httpx_get_mock.assert_called_once_with("https://pypi.org/pypi/git_mirror/json")
26+
httpx_get_mock.assert_called_once_with("https://pypi.org/pypi/git_mirror/json", timeout=10)
2727

2828

2929
def test_call_pypi_with_version_check_no_newer_version():
@@ -36,7 +36,7 @@ def test_call_pypi_with_version_check_no_newer_version():
3636

3737
assert result is False
3838
assert new_version == version.parse("1.0.0")
39-
httpx_get_mock.assert_called_once_with("https://pypi.org/pypi/git_mirror/json")
39+
httpx_get_mock.assert_called_once_with("https://pypi.org/pypi/git_mirror/json", timeout=10)
4040

4141

4242
def test_call_pypi_with_version_check_http_error():

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# content of: tox.ini , put in same dir as setup.py
22
[tox]
33
envlist =
4-
; py38-opensearch{1,2,3,4,5,6}
54
py39
65
py310
76
py311
87
py312
8+
py313
99

1010
[testenv]
1111
deps =
1212
# parameterized
13-
pytest==7.4.4
14-
pytest-cov==4.1.0
13+
pytest>7.4.4
14+
pytest-cov>4.1.0
1515
pytest-mock
1616
hypothesis>=6.96.0
1717
commands =

0 commit comments

Comments
 (0)