gnarly 0.0.0.dev5__tar.gz → 0.0.0.dev7__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.
Potentially problematic release.
This version of gnarly might be problematic. Click here for more details.
- gnarly-0.0.0.dev7/PKG-INFO +8 -0
- gnarly-0.0.0.dev7/docs/api/gnarly.rst +45 -0
- gnarly-0.0.0.dev7/docs/api/gnarly.utils.code.rst +21 -0
- gnarly-0.0.0.dev7/docs/api/gnarly.utils.llm.rst +45 -0
- gnarly-0.0.0.dev7/docs/api/gnarly.utils.rst +30 -0
- gnarly-0.0.0.dev7/docs/api/modules.rst +7 -0
- gnarly-0.0.0.dev7/docs/source/api/gnarly.rst +45 -0
- gnarly-0.0.0.dev7/docs/source/api/gnarly.utils.code.rst +21 -0
- gnarly-0.0.0.dev7/docs/source/api/gnarly.utils.llm.rst +45 -0
- gnarly-0.0.0.dev7/docs/source/api/gnarly.utils.rst +30 -0
- gnarly-0.0.0.dev7/docs/source/api/modules.rst +7 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/docs/source/conf.py +4 -1
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/pyproject.toml +1 -8
- gnarly-0.0.0.dev7/src/gnarly/types.py +102 -0
- gnarly-0.0.0.dev7/src/gnarly/utils/code/projects.py +204 -0
- gnarly-0.0.0.dev7/src/gnarly/utils/io.py +176 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/llm/chatgpt.py +0 -1
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/llm/claude.py +0 -1
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/llm/interfaces.py +126 -70
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/llm/models.py +21 -14
- gnarly-0.0.0.dev7/uv.lock +80 -0
- gnarly-0.0.0.dev5/PKG-INFO +0 -15
- gnarly-0.0.0.dev5/src/gnarly/utils/code/projects.py +0 -205
- gnarly-0.0.0.dev5/src/gnarly/utils/io.py +0 -125
- gnarly-0.0.0.dev5/uv.lock +0 -1135
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/.gitignore +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/.python-version +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/README.md +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/docs/Makefile +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/docs/make.bat +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/docs/source/api.md +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/docs/source/index.md +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/docs/source/usage.md +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/__init__.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/constants.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/errors.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/__init__.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/code/__init__.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/src/gnarly/utils/llm/__init__.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/tests/__init__.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/tests/test_constants.py +0 -0
- {gnarly-0.0.0.dev5 → gnarly-0.0.0.dev7}/tests/test_io_utilities.py +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
gnarly package
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
Subpackages
|
|
5
|
+
-----------
|
|
6
|
+
|
|
7
|
+
.. toctree::
|
|
8
|
+
:maxdepth: 4
|
|
9
|
+
|
|
10
|
+
gnarly.utils
|
|
11
|
+
|
|
12
|
+
Submodules
|
|
13
|
+
----------
|
|
14
|
+
|
|
15
|
+
gnarly.constants module
|
|
16
|
+
-----------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: gnarly.constants
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
|
|
23
|
+
gnarly.errors module
|
|
24
|
+
--------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: gnarly.errors
|
|
27
|
+
:members:
|
|
28
|
+
:undoc-members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
|
|
31
|
+
gnarly.types module
|
|
32
|
+
-------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: gnarly.types
|
|
35
|
+
:members:
|
|
36
|
+
:undoc-members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
|
|
39
|
+
Module contents
|
|
40
|
+
---------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: gnarly
|
|
43
|
+
:members:
|
|
44
|
+
:undoc-members:
|
|
45
|
+
:show-inheritance:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
gnarly.utils.code package
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
gnarly.utils.code.projects module
|
|
8
|
+
---------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: gnarly.utils.code.projects
|
|
11
|
+
:members:
|
|
12
|
+
:undoc-members:
|
|
13
|
+
:show-inheritance:
|
|
14
|
+
|
|
15
|
+
Module contents
|
|
16
|
+
---------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: gnarly.utils.code
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
gnarly.utils.llm package
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
gnarly.utils.llm.chatgpt module
|
|
8
|
+
-------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: gnarly.utils.llm.chatgpt
|
|
11
|
+
:members:
|
|
12
|
+
:undoc-members:
|
|
13
|
+
:show-inheritance:
|
|
14
|
+
|
|
15
|
+
gnarly.utils.llm.claude module
|
|
16
|
+
------------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: gnarly.utils.llm.claude
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
|
|
23
|
+
gnarly.utils.llm.interfaces module
|
|
24
|
+
----------------------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: gnarly.utils.llm.interfaces
|
|
27
|
+
:members:
|
|
28
|
+
:undoc-members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
|
|
31
|
+
gnarly.utils.llm.models module
|
|
32
|
+
------------------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: gnarly.utils.llm.models
|
|
35
|
+
:members:
|
|
36
|
+
:undoc-members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
|
|
39
|
+
Module contents
|
|
40
|
+
---------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: gnarly.utils.llm
|
|
43
|
+
:members:
|
|
44
|
+
:undoc-members:
|
|
45
|
+
:show-inheritance:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
gnarly.utils package
|
|
2
|
+
====================
|
|
3
|
+
|
|
4
|
+
Subpackages
|
|
5
|
+
-----------
|
|
6
|
+
|
|
7
|
+
.. toctree::
|
|
8
|
+
:maxdepth: 4
|
|
9
|
+
|
|
10
|
+
gnarly.utils.code
|
|
11
|
+
gnarly.utils.llm
|
|
12
|
+
|
|
13
|
+
Submodules
|
|
14
|
+
----------
|
|
15
|
+
|
|
16
|
+
gnarly.utils.io module
|
|
17
|
+
----------------------
|
|
18
|
+
|
|
19
|
+
.. automodule:: gnarly.utils.io
|
|
20
|
+
:members:
|
|
21
|
+
:undoc-members:
|
|
22
|
+
:show-inheritance:
|
|
23
|
+
|
|
24
|
+
Module contents
|
|
25
|
+
---------------
|
|
26
|
+
|
|
27
|
+
.. automodule:: gnarly.utils
|
|
28
|
+
:members:
|
|
29
|
+
:undoc-members:
|
|
30
|
+
:show-inheritance:
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
gnarly package
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
Subpackages
|
|
5
|
+
-----------
|
|
6
|
+
|
|
7
|
+
.. toctree::
|
|
8
|
+
:maxdepth: 4
|
|
9
|
+
|
|
10
|
+
gnarly.utils
|
|
11
|
+
|
|
12
|
+
Submodules
|
|
13
|
+
----------
|
|
14
|
+
|
|
15
|
+
gnarly.constants module
|
|
16
|
+
-----------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: gnarly.constants
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
|
|
23
|
+
gnarly.errors module
|
|
24
|
+
--------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: gnarly.errors
|
|
27
|
+
:members:
|
|
28
|
+
:undoc-members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
|
|
31
|
+
gnarly.types module
|
|
32
|
+
-------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: gnarly.types
|
|
35
|
+
:members:
|
|
36
|
+
:undoc-members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
|
|
39
|
+
Module contents
|
|
40
|
+
---------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: gnarly
|
|
43
|
+
:members:
|
|
44
|
+
:undoc-members:
|
|
45
|
+
:show-inheritance:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
gnarly.utils.code package
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
gnarly.utils.code.projects module
|
|
8
|
+
---------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: gnarly.utils.code.projects
|
|
11
|
+
:members:
|
|
12
|
+
:undoc-members:
|
|
13
|
+
:show-inheritance:
|
|
14
|
+
|
|
15
|
+
Module contents
|
|
16
|
+
---------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: gnarly.utils.code
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
gnarly.utils.llm package
|
|
2
|
+
========================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
gnarly.utils.llm.chatgpt module
|
|
8
|
+
-------------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: gnarly.utils.llm.chatgpt
|
|
11
|
+
:members:
|
|
12
|
+
:undoc-members:
|
|
13
|
+
:show-inheritance:
|
|
14
|
+
|
|
15
|
+
gnarly.utils.llm.claude module
|
|
16
|
+
------------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: gnarly.utils.llm.claude
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
|
|
23
|
+
gnarly.utils.llm.interfaces module
|
|
24
|
+
----------------------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: gnarly.utils.llm.interfaces
|
|
27
|
+
:members:
|
|
28
|
+
:undoc-members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
|
|
31
|
+
gnarly.utils.llm.models module
|
|
32
|
+
------------------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: gnarly.utils.llm.models
|
|
35
|
+
:members:
|
|
36
|
+
:undoc-members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
|
|
39
|
+
Module contents
|
|
40
|
+
---------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: gnarly.utils.llm
|
|
43
|
+
:members:
|
|
44
|
+
:undoc-members:
|
|
45
|
+
:show-inheritance:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
gnarly.utils package
|
|
2
|
+
====================
|
|
3
|
+
|
|
4
|
+
Subpackages
|
|
5
|
+
-----------
|
|
6
|
+
|
|
7
|
+
.. toctree::
|
|
8
|
+
:maxdepth: 4
|
|
9
|
+
|
|
10
|
+
gnarly.utils.code
|
|
11
|
+
gnarly.utils.llm
|
|
12
|
+
|
|
13
|
+
Submodules
|
|
14
|
+
----------
|
|
15
|
+
|
|
16
|
+
gnarly.utils.io module
|
|
17
|
+
----------------------
|
|
18
|
+
|
|
19
|
+
.. automodule:: gnarly.utils.io
|
|
20
|
+
:members:
|
|
21
|
+
:undoc-members:
|
|
22
|
+
:show-inheritance:
|
|
23
|
+
|
|
24
|
+
Module contents
|
|
25
|
+
---------------
|
|
26
|
+
|
|
27
|
+
.. automodule:: gnarly.utils
|
|
28
|
+
:members:
|
|
29
|
+
:undoc-members:
|
|
30
|
+
:show-inheritance:
|
|
@@ -26,6 +26,7 @@ extensions = [
|
|
|
26
26
|
'sphinx.ext.napoleon', # Support for Google and NumPy style docstrings
|
|
27
27
|
'sphinx.ext.intersphinx', # Link to other project's documentation
|
|
28
28
|
'myst_parser', # MyST Markdown parser
|
|
29
|
+
'sphinx_design'
|
|
29
30
|
]
|
|
30
31
|
|
|
31
32
|
# MyST parser configuration
|
|
@@ -48,14 +49,16 @@ exclude_patterns = []
|
|
|
48
49
|
|
|
49
50
|
# Source file suffixes and their parsers
|
|
50
51
|
source_suffix = {
|
|
52
|
+
'.txt': 'restructuredtext',
|
|
51
53
|
'.rst': 'restructuredtext',
|
|
52
54
|
'.md': 'markdown',
|
|
55
|
+
'.mdx': 'markdown'
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
# -- Options for HTML output -------------------------------------------------
|
|
56
59
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
57
60
|
|
|
58
|
-
html_theme = '
|
|
61
|
+
html_theme = 'sphinx_book_theme'
|
|
59
62
|
html_static_path = ['_static']
|
|
60
63
|
|
|
61
64
|
# -- Extension configuration -------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gnarly"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.0dev7"
|
|
4
4
|
description = "Add your description here"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -8,14 +8,7 @@ authors = [
|
|
|
8
8
|
]
|
|
9
9
|
requires-python = ">=3.10"
|
|
10
10
|
dependencies = [
|
|
11
|
-
"anthropic>=0.54.0",
|
|
12
|
-
"linkify>=1.4",
|
|
13
|
-
"myst-parser>=4.0.1",
|
|
14
|
-
"openai>=1.86.0",
|
|
15
|
-
"pytest>=8.4.0",
|
|
16
11
|
"python-dotenv>=1.1.0",
|
|
17
|
-
"sphinx>=8.1.3",
|
|
18
|
-
"sphinx-autobuild>=2024.10.3",
|
|
19
12
|
"starch",
|
|
20
13
|
]
|
|
21
14
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Types
|
|
3
|
+
=====
|
|
4
|
+
|
|
5
|
+
Gnarly's custom typing framework. This is an implementation detail.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import logging
|
|
10
|
+
from abc import ABC
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from enum import Flag, auto
|
|
13
|
+
from os import PathLike
|
|
14
|
+
|
|
15
|
+
from gnarly.errors import NamespaceError
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
logger: logging.Logger = logging.getLogger()
|
|
19
|
+
logger.setLevel(logging.INFO)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class GnarlyProjectType(Flag):
|
|
23
|
+
"""
|
|
24
|
+
An enumeration of the languages that Gnarly currenetly supports
|
|
25
|
+
|
|
26
|
+
Reference members of this class directly whenever you want to specify
|
|
27
|
+
a language constraint. Avoid hard-coding comparisons to their `values`,
|
|
28
|
+
since their integer data types are semantically insignificant.
|
|
29
|
+
"""
|
|
30
|
+
CPP: int = auto()
|
|
31
|
+
HASKELL: int = auto()
|
|
32
|
+
JAVASCRIPT: int = auto()
|
|
33
|
+
PYTHON: int = auto()
|
|
34
|
+
R: int = auto()
|
|
35
|
+
RUST: int = auto()
|
|
36
|
+
SWIFT: int = auto()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# ─── Interfaces ────────────────────────────────────────────────────────── ✦ ─
|
|
40
|
+
@dataclass
|
|
41
|
+
class GnarlyProject:
|
|
42
|
+
name: str
|
|
43
|
+
project_type: GnarlyProjectType
|
|
44
|
+
is_persistent: bool
|
|
45
|
+
root_path: PathLike
|
|
46
|
+
dependencies: dict[str, list]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass
|
|
50
|
+
class GnarlyPythonProject(GnarlyProject):
|
|
51
|
+
project_type = GnarlyProjectType.PYTHON
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass
|
|
55
|
+
class GnarlyCppProject(GnarlyProject):
|
|
56
|
+
project_Type = GnarlyProjectType.CPP
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@dataclass
|
|
60
|
+
class GnarlyHaskellProject(GnarlyProject):
|
|
61
|
+
project_type = GnarlyProjectType.HASKELL
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class GnarlyJavaScriptProject(GnarlyProject):
|
|
66
|
+
project_type = GnarlyProjectType.JAVASCRIPT
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class GnarlyRProject(GnarlyProject):
|
|
71
|
+
project_type = GnarlyProjectType.R
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass
|
|
75
|
+
class GnarlyRustProject(GnarlyProject):
|
|
76
|
+
project_type = GnarlyProjectType.RUST
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class GnarlySwiftProject(GnarlyProject):
|
|
81
|
+
project_type = GnarlyProjectType.SWIFT
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class GnarlyNamespace(ABC):
|
|
85
|
+
"""
|
|
86
|
+
Base class for non-instantiable types that serve to encapsulate.
|
|
87
|
+
|
|
88
|
+
Subclasses of this ABC provide no constructors. Instead, attempts
|
|
89
|
+
to instantiate raise `NamespaceError`.
|
|
90
|
+
"""
|
|
91
|
+
context_key: str
|
|
92
|
+
|
|
93
|
+
def __new__(cls) -> NamespaceError:
|
|
94
|
+
logger.error("`Project` is not intended for direct instantiation.")
|
|
95
|
+
raise NamespaceError(
|
|
96
|
+
f"`{cls.__name__}` is a namespace, which means that it "
|
|
97
|
+
"has no constructors. Instead, you should call one of the "
|
|
98
|
+
"static factory methods provided in one of its inner classes, "
|
|
99
|
+
"all of which return instances of the `GnarlyProject` base "
|
|
100
|
+
"class's concrete implementations."
|
|
101
|
+
)
|
|
102
|
+
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Projects
|
|
3
|
+
========
|
|
4
|
+
|
|
5
|
+
This module defines and implements various facilities useful for
|
|
6
|
+
project management.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
import logging
|
|
10
|
+
from os import PathLike
|
|
11
|
+
|
|
12
|
+
from ...constants import GNARLY_PROJECT_ROOT_PATH
|
|
13
|
+
# from ...errors import NamespaceError
|
|
14
|
+
from ...types import (
|
|
15
|
+
GnarlyCppProject,
|
|
16
|
+
GnarlyHaskellProject,
|
|
17
|
+
GnarlyJavaScriptProject,
|
|
18
|
+
GnarlyNamespace,
|
|
19
|
+
GnarlyProject,
|
|
20
|
+
GnarlyProjectType,
|
|
21
|
+
GnarlyPythonProject,
|
|
22
|
+
GnarlyRProject,
|
|
23
|
+
GnarlyRustProject,
|
|
24
|
+
GnarlySwiftProject
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
logger: logging.Logger = logging.getLogger()
|
|
28
|
+
logging.basicConfig(level=logging.DEBUG, format=logging.BASIC_FORMAT)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Project(GnarlyNamespace):
|
|
32
|
+
"""
|
|
33
|
+
A namespace for Gnarly Code's project management utility suite.
|
|
34
|
+
|
|
35
|
+
This is a Gnarly implementation detail. It is not intended for direct
|
|
36
|
+
instantiation. Attempts to instantiate this class will raise a
|
|
37
|
+
``NamespaceError``.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Python:
|
|
42
|
+
"""
|
|
43
|
+
A namespace for Gnarly's Python project management utilities.
|
|
44
|
+
|
|
45
|
+
Use the static functions defined in the ``Project.Python`` namespace
|
|
46
|
+
to manage your Python project's code base.
|
|
47
|
+
|
|
48
|
+
Examples
|
|
49
|
+
--------
|
|
50
|
+
Basic usage:
|
|
51
|
+
|
|
52
|
+
>>> from pprint import pprint
|
|
53
|
+
>>> from gnarly import Project
|
|
54
|
+
>>>
|
|
55
|
+
>>> mgr = Project.Python()
|
|
56
|
+
>>>
|
|
57
|
+
>>> pr: GnarlyPythonProject = mgr.create("my_python_project")
|
|
58
|
+
>>> pprint(pr)
|
|
59
|
+
GnarlyPythonProject(name='my_python_project',
|
|
60
|
+
project_type=<GnarlyProjectType.PYTHON: 8>,
|
|
61
|
+
logger=<RootLogger root (INFO)>,
|
|
62
|
+
is_persistent=True,
|
|
63
|
+
root_path=PosixPath('/Users/u/gnarly/gnarly_project'),
|
|
64
|
+
dependencies={'dev': [], 'optional': [], 'required': []})
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
def __init__(
|
|
68
|
+
self,
|
|
69
|
+
context_key: str = "python_project_namespace"
|
|
70
|
+
) -> None:
|
|
71
|
+
self._context_key = context_key
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def context_key(self) -> str:
|
|
76
|
+
return self._context_key
|
|
77
|
+
|
|
78
|
+
@context_key.setter
|
|
79
|
+
def context_key(self, value: str) -> None:
|
|
80
|
+
self._context_key = value
|
|
81
|
+
|
|
82
|
+
@context_key.deleter
|
|
83
|
+
def context_key(self) -> None:
|
|
84
|
+
del self._context_key
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@staticmethod
|
|
88
|
+
def create(
|
|
89
|
+
name: str = "gnarly_python_project",
|
|
90
|
+
project_type = GnarlyProjectType.PYTHON,
|
|
91
|
+
is_persistent: bool = True,
|
|
92
|
+
root_path: PathLike = GNARLY_PROJECT_ROOT_PATH / "gnarly_project",
|
|
93
|
+
dependencies: dict[str, list[str]] = {
|
|
94
|
+
"dev": [],
|
|
95
|
+
"optional": [],
|
|
96
|
+
"required": []
|
|
97
|
+
}
|
|
98
|
+
) -> "GnarlyPythonProject":
|
|
99
|
+
"""
|
|
100
|
+
Create a Python project.
|
|
101
|
+
|
|
102
|
+
Rather than instantiating ``GnarlyPythonProject`` directly, you
|
|
103
|
+
call this static method on your ``Project.Python`` manager.
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
name : str
|
|
108
|
+
The Python project's name.
|
|
109
|
+
project_type : GnarlyProjectType
|
|
110
|
+
The project's type, as characterized by its target
|
|
111
|
+
language configuration.
|
|
112
|
+
is_persistent : bool
|
|
113
|
+
The project's persistence state. Defaults to ``True``.
|
|
114
|
+
root_path : PathLike
|
|
115
|
+
The project's root path.
|
|
116
|
+
dependencies : dict[str, list[str]]
|
|
117
|
+
A dictionary that represents the project's dependencies.
|
|
118
|
+
|
|
119
|
+
Returns
|
|
120
|
+
-------
|
|
121
|
+
A new instance of ``GnarlyPythonProject``.
|
|
122
|
+
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
return Project.create(
|
|
126
|
+
name=name,
|
|
127
|
+
project_type=project_type,
|
|
128
|
+
is_persistent=is_persistent,
|
|
129
|
+
root_path=root_path,
|
|
130
|
+
dependencies=dependencies
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@staticmethod
|
|
135
|
+
def create(
|
|
136
|
+
name: str,
|
|
137
|
+
project_type: GnarlyProjectType,
|
|
138
|
+
is_persistent: bool = True,
|
|
139
|
+
root_path: PathLike = GNARLY_PROJECT_ROOT_PATH,
|
|
140
|
+
dependencies: dict[str, list] = {
|
|
141
|
+
"dev": [],
|
|
142
|
+
"optional": [],
|
|
143
|
+
"required": []
|
|
144
|
+
}
|
|
145
|
+
) -> "GnarlyProject":
|
|
146
|
+
match project_type:
|
|
147
|
+
case project_type.CPP:
|
|
148
|
+
return GnarlyCppProject(
|
|
149
|
+
name=name,
|
|
150
|
+
project_type=project_type,
|
|
151
|
+
is_persistent=is_persistent,
|
|
152
|
+
root_path=root_path,
|
|
153
|
+
dependencies=dependencies
|
|
154
|
+
)
|
|
155
|
+
case project_type.HASKELL:
|
|
156
|
+
return GnarlyHaskellProject(
|
|
157
|
+
name=name,
|
|
158
|
+
project_type=project_type,
|
|
159
|
+
is_persistent=is_persistent,
|
|
160
|
+
root_path=root_path,
|
|
161
|
+
dependencies=dependencies
|
|
162
|
+
)
|
|
163
|
+
case project_type.JAVASCRIPT:
|
|
164
|
+
return GnarlyJavaScriptProject(
|
|
165
|
+
name=name,
|
|
166
|
+
project_type=project_type,
|
|
167
|
+
is_persistent=is_persistent,
|
|
168
|
+
root_path=root_path,
|
|
169
|
+
dependencies=dependencies
|
|
170
|
+
)
|
|
171
|
+
case project_type.PYTHON:
|
|
172
|
+
return GnarlyPythonProject(
|
|
173
|
+
name=name,
|
|
174
|
+
project_type=project_type,
|
|
175
|
+
is_persistent=is_persistent,
|
|
176
|
+
root_path=root_path,
|
|
177
|
+
dependencies=dependencies
|
|
178
|
+
)
|
|
179
|
+
case project_type.R:
|
|
180
|
+
return GnarlyRProject(
|
|
181
|
+
name=name,
|
|
182
|
+
project_type=project_type,
|
|
183
|
+
is_persistent=is_persistent,
|
|
184
|
+
root_path=root_path,
|
|
185
|
+
dependencies=dependencies
|
|
186
|
+
)
|
|
187
|
+
case project_type.RUST:
|
|
188
|
+
return GnarlyRustProject(
|
|
189
|
+
name=name,
|
|
190
|
+
project_type=project_type,
|
|
191
|
+
is_persistent=is_persistent,
|
|
192
|
+
root_path=root_path,
|
|
193
|
+
dependencies=dependencies
|
|
194
|
+
)
|
|
195
|
+
case project_type.SWIFT:
|
|
196
|
+
return GnarlySwiftProject(
|
|
197
|
+
name=name,
|
|
198
|
+
project_type=project_type,
|
|
199
|
+
is_persistent=is_persistent,
|
|
200
|
+
root_path=root_path,
|
|
201
|
+
dependencies=dependencies
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|