wexample-helpers-git 0.0.45__tar.gz → 0.0.48__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.
@@ -1,36 +1,36 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: wexample-helpers-git
3
- Version: 0.0.45
3
+ Version: 0.0.48
4
4
  Summary: Some python basic helpers for git.
5
- Author-email: weeger <contact@wexample.com>
5
+ Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
7
- Project-URL: homepage, https://github.com/wexample/python-helpers-git
8
7
  Classifier: Programming Language :: Python :: 3
9
8
  Classifier: License :: OSI Approved :: MIT License
10
9
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
12
- Description-Content-Type: text/markdown
10
+ Project-URL: homepage, https://github.com/wexample/python-helpers-git
11
+ Requires-Python: >=3.10
13
12
  Requires-Dist: gitpython
14
- Requires-Dist: pip-tools
15
- Requires-Dist: pydantic
16
- Requires-Dist: pytest
13
+ Requires-Dist: pydantic<3,>=2
14
+ Requires-Dist: wexample-helpers==0.0.65
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest; extra == "dev"
17
+ Description-Content-Type: text/markdown
17
18
 
18
- # Helpers Git
19
+ # wexample-helpers-git
19
20
 
20
21
  Some python basic helpers for git.
21
22
 
22
- Version: 0.0.31
23
+ Version: 0.0.46
23
24
 
24
25
  ## Requirements
25
26
 
26
- - Python >=3.6
27
+ - Python >=3.10
27
28
 
28
29
  ## Dependencies
29
30
 
30
31
  - gitpython
31
- - pip-tools
32
- - pydantic
33
- - pytest
32
+ - pydantic>=2,<3
33
+ - wexample-helpers==0.0.65
34
34
 
35
35
  ## Installation
36
36
 
@@ -49,4 +49,4 @@ MIT
49
49
 
50
50
  This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
51
51
 
52
- Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
52
+ Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
@@ -1,19 +1,18 @@
1
- # Helpers Git
1
+ # wexample-helpers-git
2
2
 
3
3
  Some python basic helpers for git.
4
4
 
5
- Version: 0.0.31
5
+ Version: 0.0.46
6
6
 
7
7
  ## Requirements
8
8
 
9
- - Python >=3.6
9
+ - Python >=3.10
10
10
 
11
11
  ## Dependencies
12
12
 
13
13
  - gitpython
14
- - pip-tools
15
- - pydantic
16
- - pytest
14
+ - pydantic>=2,<3
15
+ - wexample-helpers==0.0.65
17
16
 
18
17
  ## Installation
19
18
 
@@ -1,18 +1,17 @@
1
1
  [build-system]
2
2
  requires = [
3
- "setuptools",
4
- "wheel",
3
+ "pdm-backend",
5
4
  ]
6
- build-backend = "setuptools.build_meta"
5
+ build-backend = "pdm.backend"
7
6
 
8
7
  [project]
9
8
  name = "wexample-helpers-git"
10
- version = "0.0.45"
9
+ version = "0.0.48"
11
10
  description = "Some python basic helpers for git."
12
11
  authors = [
13
12
  { name = "weeger", email = "contact@wexample.com" },
14
13
  ]
15
- requires-python = ">=3.6"
14
+ requires-python = ">=3.10"
16
15
  classifiers = [
17
16
  "Programming Language :: Python :: 3",
18
17
  "License :: OSI Approved :: MIT License",
@@ -20,9 +19,8 @@ classifiers = [
20
19
  ]
21
20
  dependencies = [
22
21
  "gitpython",
23
- "pip-tools",
24
- "pydantic",
25
- "pytest",
22
+ "pydantic>=2,<3",
23
+ "wexample-helpers==0.0.65",
26
24
  ]
27
25
 
28
26
  [project.readme]
@@ -34,3 +32,20 @@ text = "MIT"
34
32
 
35
33
  [project.urls]
36
34
  homepage = "https://github.com/wexample/python-helpers-git"
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "pytest",
39
+ ]
40
+
41
+ [tool.pdm]
42
+ distribution = true
43
+
44
+ [tool.pdm.build]
45
+ includes = [
46
+ "src/wexample_helpers_git/py.typed",
47
+ ]
48
+ package-dir = "src"
49
+ packages = [
50
+ { include = "wexample_helpers_git", from = "src" },
51
+ ]
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Generator
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+ from git import Repo
8
+ from wexample_helpers_git.helpers.git import git_is_init, git_remote_create_once
9
+
10
+
11
+ @pytest.fixture
12
+ def temp_dir(tmp_path: Path) -> Generator[Path]:
13
+ """Fixture providing a temporary directory."""
14
+ yield tmp_path
15
+
16
+
17
+ @pytest.fixture
18
+ def git_repo(temp_dir: Path) -> Generator[Repo]:
19
+ """Fixture providing an initialized git repository."""
20
+ repo = Repo.init(temp_dir)
21
+ yield repo
22
+
23
+
24
+ def test_git_is_init(temp_dir: Path, git_repo: Repo) -> None:
25
+ # Test with initialized repository
26
+ assert git_is_init(temp_dir) is True
27
+
28
+ # Test with non-git directory
29
+ empty_dir = temp_dir / "empty"
30
+ empty_dir.mkdir()
31
+ assert git_is_init(empty_dir) is False
32
+
33
+ # Test with non-existent directory
34
+ non_existent = temp_dir / "non_existent"
35
+ assert git_is_init(non_existent) is False
36
+
37
+
38
+ def test_git_remote_create_once(git_repo: Repo) -> None:
39
+ remote_name = "origin"
40
+ remote_url = "https://github.com/test/repo.git"
41
+
42
+ # Test creating new remote
43
+ remote = git_remote_create_once(git_repo, remote_name, remote_url)
44
+ assert remote is not None
45
+ assert remote.name == remote_name
46
+ assert remote.url == remote_url
47
+
48
+ # Test attempting to create same remote again
49
+ remote = git_remote_create_once(git_repo, remote_name, remote_url)
50
+ assert remote is None # Should return None for existing remote
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
@@ -1,2 +0,0 @@
1
- GIT_PROVIDER_GITLAB = "gitlab"
2
- GIT_PROVIDER_GITHUB = "github"
@@ -1,26 +0,0 @@
1
- from typing import Optional
2
-
3
- from git import InvalidGitRepositoryError, Remote, Repo
4
- from wexample_helpers.const.types import FileStringOrPath
5
- from wexample_helpers.helpers.file import file_resolve_path
6
-
7
-
8
- def git_is_init(path: FileStringOrPath) -> bool:
9
- path = file_resolve_path(path)
10
-
11
- if not path.exists():
12
- return False
13
-
14
- try:
15
- Repo(path)
16
- return True
17
- except InvalidGitRepositoryError:
18
- return False
19
-
20
-
21
- def git_remote_create_once(repo: Repo, name: str, url: str) -> Optional[Remote]:
22
- try:
23
- repo.remote(name=name)
24
- return None
25
- except ValueError:
26
- return repo.create_remote(name, url)
@@ -1,52 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: wexample-helpers-git
3
- Version: 0.0.45
4
- Summary: Some python basic helpers for git.
5
- Author-email: weeger <contact@wexample.com>
6
- License: MIT
7
- Project-URL: homepage, https://github.com/wexample/python-helpers-git
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: gitpython
14
- Requires-Dist: pip-tools
15
- Requires-Dist: pydantic
16
- Requires-Dist: pytest
17
-
18
- # Helpers Git
19
-
20
- Some python basic helpers for git.
21
-
22
- Version: 0.0.31
23
-
24
- ## Requirements
25
-
26
- - Python >=3.6
27
-
28
- ## Dependencies
29
-
30
- - gitpython
31
- - pip-tools
32
- - pydantic
33
- - pytest
34
-
35
- ## Installation
36
-
37
- ```bash
38
- pip install wexample-helpers-git
39
- ```
40
-
41
- ## Links
42
-
43
- - Homepage: https://github.com/wexample/python-helpers-git
44
-
45
- ## License
46
-
47
- MIT
48
- ## Credits
49
-
50
- This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
51
-
52
- Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
@@ -1,12 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- wexample_helpers_git/py.typed
4
- wexample_helpers_git.egg-info/PKG-INFO
5
- wexample_helpers_git.egg-info/SOURCES.txt
6
- wexample_helpers_git.egg-info/dependency_links.txt
7
- wexample_helpers_git.egg-info/requires.txt
8
- wexample_helpers_git.egg-info/top_level.txt
9
- wexample_helpers_git/const/__init__.py
10
- wexample_helpers_git/const/common.py
11
- wexample_helpers_git/helpers/__init__.py
12
- wexample_helpers_git/helpers/git.py
@@ -1,4 +0,0 @@
1
- gitpython
2
- pip-tools
3
- pydantic
4
- pytest
@@ -1 +0,0 @@
1
- wexample_helpers_git