wexample-filestate-python 0.0.34__tar.gz → 0.0.39__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.
- {wexample_filestate_python-0.0.34 → wexample_filestate_python-0.0.39}/PKG-INFO +32 -21
- {wexample_filestate_python-0.0.34 → wexample_filestate_python-0.0.39}/README.md +13 -9
- wexample_filestate_python-0.0.39/pyproject.toml +65 -0
- wexample_filestate_python-0.0.34/wexample_filestate_python/__init__.py → wexample_filestate_python-0.0.39/src/wexample_filestate_python/py.typed +0 -0
- {wexample_filestate_python-0.0.34/wexample_filestate_python/config_value → wexample_filestate_python-0.0.39/tests/tests}/__init__.py +0 -0
- {wexample_filestate_python-0.0.34/wexample_filestate_python/const → wexample_filestate_python-0.0.39/tests/wexample_tests}/__init__.py +0 -0
- wexample_filestate_python-0.0.34/pyproject.toml +0 -38
- wexample_filestate_python-0.0.34/setup.cfg +0 -4
- wexample_filestate_python-0.0.34/wexample_filestate_python/config_value/python_package_readme_config_value.py +0 -82
- wexample_filestate_python-0.0.34/wexample_filestate_python/const/name_pattern.py +0 -1
- wexample_filestate_python-0.0.34/wexample_filestate_python/helpers/__init__.py +0 -0
- wexample_filestate_python-0.0.34/wexample_filestate_python/helpers/package.py +0 -127
- wexample_filestate_python-0.0.34/wexample_filestate_python/workdir/__init__.py +0 -0
- wexample_filestate_python-0.0.34/wexample_filestate_python/workdir/python_package_workdir.py +0 -117
- wexample_filestate_python-0.0.34/wexample_filestate_python/workdir/python_packages_suite_workdir.py +0 -5
- wexample_filestate_python-0.0.34/wexample_filestate_python/workdir/python_workdir.py +0 -78
- wexample_filestate_python-0.0.34/wexample_filestate_python.egg-info/PKG-INFO +0 -57
- wexample_filestate_python-0.0.34/wexample_filestate_python.egg-info/SOURCES.txt +0 -18
- wexample_filestate_python-0.0.34/wexample_filestate_python.egg-info/dependency_links.txt +0 -1
- wexample_filestate_python-0.0.34/wexample_filestate_python.egg-info/requires.txt +0 -6
- wexample_filestate_python-0.0.34/wexample_filestate_python.egg-info/top_level.txt +0 -1
|
@@ -1,41 +1,52 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: wexample-filestate-python
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.39
|
|
4
4
|
Summary: Helpers for Python.
|
|
5
|
-
Author-
|
|
5
|
+
Author-Email: weeger <contact@wexample.com>
|
|
6
6
|
License: MIT
|
|
7
|
-
Project-URL: homepage, https://github.com/wexample/python-filestate-python
|
|
8
7
|
Classifier: Programming Language :: Python :: 3
|
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
9
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Requires-Dist:
|
|
14
|
-
Requires-Dist:
|
|
15
|
-
Requires-Dist:
|
|
10
|
+
Project-URL: homepage, https://github.com/wexample/python-filestate-python
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Requires-Dist: autoflake
|
|
13
|
+
Requires-Dist: black
|
|
14
|
+
Requires-Dist: flynt
|
|
15
|
+
Requires-Dist: isort
|
|
16
|
+
Requires-Dist: networkx
|
|
17
|
+
Requires-Dist: packaging
|
|
18
|
+
Requires-Dist: pydantic<3,>=2
|
|
16
19
|
Requires-Dist: python-dotenv
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
20
|
+
Requires-Dist: pyupgrade
|
|
21
|
+
Requires-Dist: tomlkit
|
|
22
|
+
Requires-Dist: wexample-filestate-git==0.0.37
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest; extra == "dev"
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
19
26
|
|
|
20
|
-
#
|
|
27
|
+
# wexample-filestate-python
|
|
21
28
|
|
|
22
29
|
Helpers for Python.
|
|
23
30
|
|
|
24
|
-
Version: 0.0.
|
|
31
|
+
Version: 0.0.37
|
|
25
32
|
|
|
26
33
|
## Requirements
|
|
27
34
|
|
|
28
|
-
- Python >=3.
|
|
35
|
+
- Python >=3.10
|
|
29
36
|
|
|
30
37
|
## Dependencies
|
|
31
38
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
39
|
+
- autoflake
|
|
40
|
+
- black
|
|
41
|
+
- flynt
|
|
42
|
+
- isort
|
|
43
|
+
- networkx
|
|
44
|
+
- packaging
|
|
45
|
+
- pydantic>=2,<3
|
|
35
46
|
- python-dotenv
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
- wexample-filestate==0.0.
|
|
47
|
+
- pyupgrade
|
|
48
|
+
- tomlkit
|
|
49
|
+
- wexample-filestate-git==0.0.36
|
|
39
50
|
|
|
40
51
|
## Installation
|
|
41
52
|
|
|
@@ -54,4 +65,4 @@ MIT
|
|
|
54
65
|
|
|
55
66
|
This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
|
|
56
67
|
|
|
57
|
-
Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
|
|
68
|
+
Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# wexample-filestate-python
|
|
2
2
|
|
|
3
3
|
Helpers for Python.
|
|
4
4
|
|
|
5
|
-
Version: 0.0.
|
|
5
|
+
Version: 0.0.37
|
|
6
6
|
|
|
7
7
|
## Requirements
|
|
8
8
|
|
|
9
|
-
- Python >=3.
|
|
9
|
+
- Python >=3.10
|
|
10
10
|
|
|
11
11
|
## Dependencies
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
13
|
+
- autoflake
|
|
14
|
+
- black
|
|
15
|
+
- flynt
|
|
16
|
+
- isort
|
|
17
|
+
- networkx
|
|
18
|
+
- packaging
|
|
19
|
+
- pydantic>=2,<3
|
|
16
20
|
- python-dotenv
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- wexample-filestate==0.0.
|
|
21
|
+
- pyupgrade
|
|
22
|
+
- tomlkit
|
|
23
|
+
- wexample-filestate-git==0.0.36
|
|
20
24
|
|
|
21
25
|
## Installation
|
|
22
26
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"pdm-backend",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "pdm.backend"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "wexample-filestate-python"
|
|
9
|
+
version = "0.0.39"
|
|
10
|
+
description = "Helpers for Python."
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "weeger", email = "contact@wexample.com" },
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"autoflake",
|
|
22
|
+
"black",
|
|
23
|
+
"flynt",
|
|
24
|
+
"isort",
|
|
25
|
+
"networkx",
|
|
26
|
+
"packaging",
|
|
27
|
+
"pydantic>=2,<3",
|
|
28
|
+
"python-dotenv",
|
|
29
|
+
"pyupgrade",
|
|
30
|
+
"tomlkit",
|
|
31
|
+
"wexample-filestate-git==0.0.37",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.readme]
|
|
35
|
+
file = "README.md"
|
|
36
|
+
content-type = "text/markdown"
|
|
37
|
+
|
|
38
|
+
[project.license]
|
|
39
|
+
text = "MIT"
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
homepage = "https://github.com/wexample/python-filestate-python"
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.pdm]
|
|
50
|
+
distribution = true
|
|
51
|
+
|
|
52
|
+
[tool.pdm.build]
|
|
53
|
+
includes = [
|
|
54
|
+
"src/wexample_filestate_python/py.typed",
|
|
55
|
+
]
|
|
56
|
+
package-dir = "src"
|
|
57
|
+
packages = [
|
|
58
|
+
{ include = "wexample_filestate_python", from = "src" },
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[tool.filestate]
|
|
62
|
+
keep = [
|
|
63
|
+
"black",
|
|
64
|
+
"isort",
|
|
65
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = [
|
|
3
|
-
"setuptools",
|
|
4
|
-
"wheel",
|
|
5
|
-
]
|
|
6
|
-
build-backend = "setuptools.build_meta"
|
|
7
|
-
|
|
8
|
-
[project]
|
|
9
|
-
name = "wexample-filestate-python"
|
|
10
|
-
version = "0.0.34"
|
|
11
|
-
description = "Helpers for Python."
|
|
12
|
-
authors = [
|
|
13
|
-
{ name = "weeger", email = "contact@wexample.com" },
|
|
14
|
-
]
|
|
15
|
-
requires-python = ">=3.6"
|
|
16
|
-
classifiers = [
|
|
17
|
-
"Programming Language :: Python :: 3",
|
|
18
|
-
"License :: OSI Approved :: MIT License",
|
|
19
|
-
"Operating System :: OS Independent",
|
|
20
|
-
]
|
|
21
|
-
dependencies = [
|
|
22
|
-
"pip-tools",
|
|
23
|
-
"pydantic",
|
|
24
|
-
"pytest",
|
|
25
|
-
"python-dotenv",
|
|
26
|
-
"wexample-filestate-dev==0.0.28",
|
|
27
|
-
"wexample-filestate-git==0.0.29",
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
[project.readme]
|
|
31
|
-
file = "README.md"
|
|
32
|
-
content-type = "text/markdown"
|
|
33
|
-
|
|
34
|
-
[project.license]
|
|
35
|
-
text = "MIT"
|
|
36
|
-
|
|
37
|
-
[project.urls]
|
|
38
|
-
homepage = "https://github.com/wexample/python-filestate-python"
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
from typing import Optional, List
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
from wexample_filestate.config_value.readme_content_config_value import ReadmeContentConfigValue
|
|
5
|
-
from wexample_filestate_python.workdir.python_package_workdir import PythonPackageWorkdir
|
|
6
|
-
from wexample_helpers.helpers.string import string_remove_prefix
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class PythonPackageReadmeContentConfigValue(ReadmeContentConfigValue):
|
|
10
|
-
workdir: PythonPackageWorkdir
|
|
11
|
-
vendor: Optional[str]
|
|
12
|
-
|
|
13
|
-
def _get_doc_path(self, section: str) -> str:
|
|
14
|
-
"""
|
|
15
|
-
Returns the path to a documentation section file
|
|
16
|
-
"""
|
|
17
|
-
return os.path.join(self.workdir.get_path(), '.wex', 'doc', 'readme', f'{section}.md')
|
|
18
|
-
|
|
19
|
-
def _add_section_if_exists(self, section: str) -> str:
|
|
20
|
-
"""
|
|
21
|
-
Returns section content if the documentation file exists
|
|
22
|
-
"""
|
|
23
|
-
doc_path = self._get_doc_path(section)
|
|
24
|
-
|
|
25
|
-
if os.path.exists(doc_path):
|
|
26
|
-
with open(doc_path, 'r') as file:
|
|
27
|
-
content = file.read()
|
|
28
|
-
return f'## {section.title()}\n\n{content}\n\n'
|
|
29
|
-
|
|
30
|
-
return ''
|
|
31
|
-
|
|
32
|
-
def get_templates(self) -> Optional[List[str]]:
|
|
33
|
-
project_info = self.workdir.get_project_info()
|
|
34
|
-
project = project_info.get('project', {})
|
|
35
|
-
|
|
36
|
-
# Extract information
|
|
37
|
-
description = project.get('description', '')
|
|
38
|
-
python_version = project.get('requires-python', '')
|
|
39
|
-
dependencies = project.get('dependencies', [])
|
|
40
|
-
homepage = project.get('urls', {}).get('homepage', '')
|
|
41
|
-
license_info = project.get('license', {}).get('text', '')
|
|
42
|
-
version = project.get('version', '')
|
|
43
|
-
|
|
44
|
-
# Format dependencies list
|
|
45
|
-
deps_list = '\n'.join([f'- {dep}' for dep in dependencies])
|
|
46
|
-
|
|
47
|
-
return [
|
|
48
|
-
f'# {self.build_package_name()}\n\n'
|
|
49
|
-
f'{description}\n\n'
|
|
50
|
-
f'Version: {version}\n\n'
|
|
51
|
-
f'{self._add_section_if_exists("features")}'
|
|
52
|
-
'## Requirements\n\n'
|
|
53
|
-
f'- Python {python_version}\n\n'
|
|
54
|
-
'## Dependencies\n\n'
|
|
55
|
-
f'{deps_list}\n\n'
|
|
56
|
-
'## Installation\n\n'
|
|
57
|
-
'```bash\n'
|
|
58
|
-
f'pip install {project.get("name", "")}\n'
|
|
59
|
-
'```\n\n'
|
|
60
|
-
f'{self._add_section_if_exists("usage")}'
|
|
61
|
-
'## Links\n\n'
|
|
62
|
-
f'- Homepage: {homepage}\n\n'
|
|
63
|
-
'## License\n\n'
|
|
64
|
-
f'{license_info}'
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
def build_package_name(self) -> str:
|
|
68
|
-
project_info = self.workdir.get_project_info()
|
|
69
|
-
|
|
70
|
-
# Get project name from pyproject.toml
|
|
71
|
-
project_name = project_info.get('project', {}).get('name', '')
|
|
72
|
-
|
|
73
|
-
# Remove vendor prefix if vendor is provided
|
|
74
|
-
if self.vendor:
|
|
75
|
-
vendor_prefix = f"{self.vendor.lower()}-"
|
|
76
|
-
project_name = string_remove_prefix(project_name, vendor_prefix)
|
|
77
|
-
|
|
78
|
-
# Convert remaining kebab-case to Title Case
|
|
79
|
-
# e.g. "vendor-package-name" -> "Package Name"
|
|
80
|
-
package_name = ' '.join(word.title() for word in project_name.split('-'))
|
|
81
|
-
|
|
82
|
-
return package_name
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
NAME_PATTERN_PYTHON_NOT_PYCACHE = "^(?!__pycache__$).+$"
|
|
File without changes
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import ast
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Dict, List, Set, Optional, Tuple
|
|
4
|
-
|
|
5
|
-
import tomli
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def package_parse_setup(path: Path) -> Dict:
|
|
9
|
-
"""
|
|
10
|
-
Parse a setup.py file to extract metadata.
|
|
11
|
-
"""
|
|
12
|
-
with open(path) as f:
|
|
13
|
-
content = f.read()
|
|
14
|
-
|
|
15
|
-
tree = ast.parse(content)
|
|
16
|
-
for node in ast.walk(tree):
|
|
17
|
-
if isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id == 'setup':
|
|
18
|
-
result = {}
|
|
19
|
-
for kw in node.keywords:
|
|
20
|
-
if isinstance(kw.value, ast.Str):
|
|
21
|
-
result[kw.arg] = kw.value.s
|
|
22
|
-
elif isinstance(kw.value, ast.List):
|
|
23
|
-
result[kw.arg] = [
|
|
24
|
-
elt.s for elt in kw.value.elts
|
|
25
|
-
if isinstance(elt, ast.Str)
|
|
26
|
-
]
|
|
27
|
-
return result
|
|
28
|
-
return {}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def package_parse_toml(path: Path) -> Dict:
|
|
32
|
-
"""
|
|
33
|
-
Parse a pyproject.toml file to extract metadata.
|
|
34
|
-
"""
|
|
35
|
-
try:
|
|
36
|
-
with open(path, "rb") as f:
|
|
37
|
-
data = tomli.load(f)
|
|
38
|
-
if "project" in data:
|
|
39
|
-
project_data = data["project"]
|
|
40
|
-
return {
|
|
41
|
-
"name": project_data.get("name"),
|
|
42
|
-
"install_requires": project_data.get("dependencies", [])
|
|
43
|
-
}
|
|
44
|
-
except Exception as e:
|
|
45
|
-
print(f"Error parsing {path}: {e}")
|
|
46
|
-
return {}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def package_get_info(package_dir: Path) -> Optional[Tuple[str, Set[str]]]:
|
|
50
|
-
"""
|
|
51
|
-
Get package name and its dependencies from setup.py or pyproject.toml.
|
|
52
|
-
"""
|
|
53
|
-
# Try pyproject.toml first
|
|
54
|
-
toml_path = package_dir / "pyproject.toml"
|
|
55
|
-
if toml_path.exists():
|
|
56
|
-
metadata = package_parse_toml(toml_path)
|
|
57
|
-
else:
|
|
58
|
-
# Fallback to setup.py
|
|
59
|
-
setup_py_path = package_dir / "setup.py"
|
|
60
|
-
if setup_py_path.exists():
|
|
61
|
-
metadata = package_parse_setup(setup_py_path)
|
|
62
|
-
else:
|
|
63
|
-
return None
|
|
64
|
-
|
|
65
|
-
name = metadata.get("name")
|
|
66
|
-
if not name:
|
|
67
|
-
return None
|
|
68
|
-
|
|
69
|
-
deps = metadata.get("install_requires", [])
|
|
70
|
-
return name, set(deps)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def package_get_dependencies(root_dir: str | Path) -> Dict[str, Set[str]]:
|
|
74
|
-
"""
|
|
75
|
-
Get dependencies between packages in a directory.
|
|
76
|
-
"""
|
|
77
|
-
packages_root = Path(root_dir)
|
|
78
|
-
if not packages_root.exists() or not packages_root.is_dir():
|
|
79
|
-
raise ValueError(f"Error: {packages_root} does not exist or is not a directory")
|
|
80
|
-
|
|
81
|
-
dependencies = {}
|
|
82
|
-
|
|
83
|
-
# First pass: collect all local packages
|
|
84
|
-
for package_dir in packages_root.iterdir():
|
|
85
|
-
if not package_dir.is_dir():
|
|
86
|
-
continue
|
|
87
|
-
|
|
88
|
-
package_info = package_get_info(package_dir)
|
|
89
|
-
if package_info:
|
|
90
|
-
name, _ = package_info
|
|
91
|
-
dependencies[name] = set()
|
|
92
|
-
|
|
93
|
-
# Second pass: analyze dependencies
|
|
94
|
-
for package_dir in packages_root.iterdir():
|
|
95
|
-
if not package_dir.is_dir():
|
|
96
|
-
continue
|
|
97
|
-
|
|
98
|
-
package_info = package_get_info(package_dir)
|
|
99
|
-
if package_info:
|
|
100
|
-
name, deps = package_info
|
|
101
|
-
if name in dependencies:
|
|
102
|
-
# Only keep dependencies that are local packages
|
|
103
|
-
dependencies[name] = {
|
|
104
|
-
dep for dep in deps
|
|
105
|
-
if dep in dependencies
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return dependencies
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def package_list_sorted(root_dir: str | Path) -> List[str]:
|
|
112
|
-
"""
|
|
113
|
-
Get a list of package names sorted by dependency order.
|
|
114
|
-
"""
|
|
115
|
-
from wexample_filestate_dev.helpers.dependencies import dependencies_sort
|
|
116
|
-
|
|
117
|
-
dependencies = package_get_dependencies(root_dir)
|
|
118
|
-
if not dependencies:
|
|
119
|
-
return []
|
|
120
|
-
|
|
121
|
-
# Convert dependencies dict to list for sorting
|
|
122
|
-
packages = list(dependencies.keys())
|
|
123
|
-
|
|
124
|
-
def get_deps(pkg: str) -> Set[str]:
|
|
125
|
-
return dependencies[pkg]
|
|
126
|
-
|
|
127
|
-
return dependencies_sort(packages, get_deps)
|
|
File without changes
|
wexample_filestate_python-0.0.34/wexample_filestate_python/workdir/python_package_workdir.py
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
|
-
from wexample_config.const.types import DictConfig
|
|
4
|
-
from wexample_filestate_python.workdir.python_workdir import PythonWorkdir
|
|
5
|
-
from wexample_helpers.helpers.array import array_dict_get_by
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class PythonPackageWorkdir(PythonWorkdir):
|
|
9
|
-
_project_info_cache = None
|
|
10
|
-
|
|
11
|
-
def get_project_info(self, force: bool = False, default: dict = {}) -> dict:
|
|
12
|
-
"""
|
|
13
|
-
Fetch the data from the pyproject.toml file.
|
|
14
|
-
"""
|
|
15
|
-
# Return cached data if available and force is False
|
|
16
|
-
if not force and self._project_info_cache is not None:
|
|
17
|
-
return self._project_info_cache
|
|
18
|
-
|
|
19
|
-
from wexample_helpers.helpers.file import file_read
|
|
20
|
-
import tomli
|
|
21
|
-
|
|
22
|
-
project_path = self.get_resolved()
|
|
23
|
-
pyproject_file = f"{project_path}pyproject.toml"
|
|
24
|
-
|
|
25
|
-
# Read the pyproject.toml file
|
|
26
|
-
try:
|
|
27
|
-
pyproject_content = file_read(pyproject_file)
|
|
28
|
-
pyproject_data = tomli.loads(pyproject_content)
|
|
29
|
-
# Store in cache
|
|
30
|
-
self._project_info_cache = pyproject_data
|
|
31
|
-
except FileNotFoundError:
|
|
32
|
-
return default
|
|
33
|
-
|
|
34
|
-
return pyproject_data
|
|
35
|
-
|
|
36
|
-
def prepare_value(self, config: Optional[DictConfig] = None) -> DictConfig:
|
|
37
|
-
from wexample_filestate.const.disk import DiskItemType
|
|
38
|
-
from wexample_filestate_python.const.name_pattern import NAME_PATTERN_PYTHON_NOT_PYCACHE
|
|
39
|
-
from wexample_filestate.config_option.children_file_factory_config_option import ChildrenFileFactoryConfigOption
|
|
40
|
-
from wexample_filestate.const.globals import NAME_PATTERN_NO_LEADING_DOT
|
|
41
|
-
from wexample_config.config_value.callback_render_config_value import CallbackRenderConfigValue
|
|
42
|
-
|
|
43
|
-
config = super().prepare_value(config)
|
|
44
|
-
|
|
45
|
-
# Retrieve the '.gitignore' configuration or create it if it doesn't exist
|
|
46
|
-
config_gitignore = array_dict_get_by('name', '.gitignore', config["children"])
|
|
47
|
-
if config_gitignore is not None:
|
|
48
|
-
generic_gitignore_rules = {
|
|
49
|
-
"Python artifacts": [
|
|
50
|
-
"*.egg-info",
|
|
51
|
-
"__pycache__/",
|
|
52
|
-
"*.py[cod]",
|
|
53
|
-
"*.pyo",
|
|
54
|
-
],
|
|
55
|
-
"Build directories": [
|
|
56
|
-
"/build/",
|
|
57
|
-
"/dist/",
|
|
58
|
-
"/pip-wheel-metadata/",
|
|
59
|
-
],
|
|
60
|
-
"Virtual environments": [
|
|
61
|
-
".env",
|
|
62
|
-
".venv",
|
|
63
|
-
"venv/",
|
|
64
|
-
],
|
|
65
|
-
"Test and coverage artifacts": [
|
|
66
|
-
".tox/",
|
|
67
|
-
".mypy_cache/",
|
|
68
|
-
"pytest_cache/",
|
|
69
|
-
".coverage",
|
|
70
|
-
"htmlcov/",
|
|
71
|
-
],
|
|
72
|
-
"Editor and IDE settings": [
|
|
73
|
-
".vscode/",
|
|
74
|
-
".idea/",
|
|
75
|
-
"*.swp",
|
|
76
|
-
"*~",
|
|
77
|
-
],
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
should_contain_lines = config_gitignore.setdefault("should_contain_lines", [])
|
|
81
|
-
if not isinstance(should_contain_lines, list):
|
|
82
|
-
raise ValueError("'should_contain_lines' must be a list")
|
|
83
|
-
|
|
84
|
-
for category, rules in generic_gitignore_rules.items():
|
|
85
|
-
category_header = f"# {category}"
|
|
86
|
-
if category_header not in should_contain_lines:
|
|
87
|
-
should_contain_lines.append(category_header)
|
|
88
|
-
|
|
89
|
-
for rule in rules:
|
|
90
|
-
if rule not in should_contain_lines:
|
|
91
|
-
should_contain_lines.append(rule)
|
|
92
|
-
|
|
93
|
-
config["children"].append(
|
|
94
|
-
{
|
|
95
|
-
'name': 'pyproject.toml',
|
|
96
|
-
'type': DiskItemType.FILE,
|
|
97
|
-
'should_exist': True,
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
config["children"].append(
|
|
102
|
-
{
|
|
103
|
-
'name': CallbackRenderConfigValue(raw=self._create_package_name_snake),
|
|
104
|
-
'type': DiskItemType.DIRECTORY,
|
|
105
|
-
'should_exist': True,
|
|
106
|
-
"children": [
|
|
107
|
-
ChildrenFileFactoryConfigOption(pattern={
|
|
108
|
-
"name": "__init__.py",
|
|
109
|
-
"type": DiskItemType.FILE,
|
|
110
|
-
"recursive": True,
|
|
111
|
-
"name_pattern": [NAME_PATTERN_PYTHON_NOT_PYCACHE, NAME_PATTERN_NO_LEADING_DOT],
|
|
112
|
-
})
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
return config
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
from typing import Optional, List, Type, TYPE_CHECKING
|
|
2
|
-
|
|
3
|
-
from wexample_config.const.types import DictConfig
|
|
4
|
-
from wexample_config.options_provider.abstract_options_provider import AbstractOptionsProvider
|
|
5
|
-
from wexample_filestate_dev.workdir.framework_package_workdir import FrameworkPackageWorkdir
|
|
6
|
-
from wexample_helpers.helpers.string import string_to_snake_case
|
|
7
|
-
|
|
8
|
-
if TYPE_CHECKING:
|
|
9
|
-
from wexample_filestate.operations_provider.abstract_operations_provider import AbstractOperationsProvider
|
|
10
|
-
from wexample_filestate.config_option.mixin.item_config_option_mixin import ItemTreeConfigOptionMixin
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class PythonWorkdir(FrameworkPackageWorkdir):
|
|
14
|
-
def get_options_providers(self) -> List[Type["AbstractOptionsProvider"]]:
|
|
15
|
-
from wexample_filestate.options_provider.default_options_provider import DefaultOptionsProvider
|
|
16
|
-
from wexample_filestate_git.options_provider.git_options_provider import GitOptionsProvider
|
|
17
|
-
|
|
18
|
-
return [
|
|
19
|
-
DefaultOptionsProvider,
|
|
20
|
-
GitOptionsProvider
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
def get_operations_providers(self) -> List[Type["AbstractOperationsProvider"]]:
|
|
24
|
-
from wexample_filestate.operations_provider.default_operations_provider import DefaultOperationsProvider
|
|
25
|
-
from wexample_filestate_git.operations_provider.git_operations_provider import GitOperationsProvider
|
|
26
|
-
|
|
27
|
-
return [
|
|
28
|
-
DefaultOperationsProvider,
|
|
29
|
-
GitOperationsProvider
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
@staticmethod
|
|
33
|
-
def _create_package_name_snake(option: "ItemTreeConfigOptionMixin") -> str:
|
|
34
|
-
import os
|
|
35
|
-
return "wexample_" + string_to_snake_case(
|
|
36
|
-
os.path.basename(os.path.realpath(option.get_parent_item().get_path())))
|
|
37
|
-
|
|
38
|
-
def prepare_value(self, config: Optional[DictConfig] = None) -> DictConfig:
|
|
39
|
-
from wexample_filestate.const.disk import DiskItemType
|
|
40
|
-
|
|
41
|
-
config = super().prepare_value(config)
|
|
42
|
-
|
|
43
|
-
config['children'] += [
|
|
44
|
-
{
|
|
45
|
-
'name': '.gitignore',
|
|
46
|
-
'type': DiskItemType.FILE,
|
|
47
|
-
'should_exist': True,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
'name': 'requirements.in',
|
|
51
|
-
'type': DiskItemType.FILE,
|
|
52
|
-
'should_exist': True,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
'name': 'requirements.txt',
|
|
56
|
-
'type': DiskItemType.FILE,
|
|
57
|
-
'should_exist': True,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
'name': 'tests',
|
|
61
|
-
'type': DiskItemType.DIRECTORY,
|
|
62
|
-
'should_exist': True,
|
|
63
|
-
},
|
|
64
|
-
# Remove unwanted files
|
|
65
|
-
# Should only be created during deployment
|
|
66
|
-
{
|
|
67
|
-
'name': 'build',
|
|
68
|
-
'type': DiskItemType.DIRECTORY,
|
|
69
|
-
'should_exist': False,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
'name': 'dist',
|
|
73
|
-
'type': DiskItemType.DIRECTORY,
|
|
74
|
-
'should_exist': False,
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
|
|
78
|
-
return config
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: wexample-filestate-python
|
|
3
|
-
Version: 0.0.34
|
|
4
|
-
Summary: Helpers for Python.
|
|
5
|
-
Author-email: weeger <contact@wexample.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: homepage, https://github.com/wexample/python-filestate-python
|
|
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: pip-tools
|
|
14
|
-
Requires-Dist: pydantic
|
|
15
|
-
Requires-Dist: pytest
|
|
16
|
-
Requires-Dist: python-dotenv
|
|
17
|
-
Requires-Dist: wexample-filestate-dev==0.0.28
|
|
18
|
-
Requires-Dist: wexample-filestate-git==0.0.29
|
|
19
|
-
|
|
20
|
-
# Filestate Python
|
|
21
|
-
|
|
22
|
-
Helpers for Python.
|
|
23
|
-
|
|
24
|
-
Version: 0.0.23
|
|
25
|
-
|
|
26
|
-
## Requirements
|
|
27
|
-
|
|
28
|
-
- Python >=3.6
|
|
29
|
-
|
|
30
|
-
## Dependencies
|
|
31
|
-
|
|
32
|
-
- pip-tools
|
|
33
|
-
- pydantic
|
|
34
|
-
- pytest
|
|
35
|
-
- python-dotenv
|
|
36
|
-
- wexample-app==0.0.28
|
|
37
|
-
- wexample-filestate-git==0.0.23
|
|
38
|
-
- wexample-filestate==0.0.31
|
|
39
|
-
|
|
40
|
-
## Installation
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
pip install wexample-filestate-python
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Links
|
|
47
|
-
|
|
48
|
-
- Homepage: https://github.com/wexample/python-filestate-python
|
|
49
|
-
|
|
50
|
-
## License
|
|
51
|
-
|
|
52
|
-
MIT
|
|
53
|
-
## Credits
|
|
54
|
-
|
|
55
|
-
This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
|
|
56
|
-
|
|
57
|
-
Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
README.md
|
|
2
|
-
pyproject.toml
|
|
3
|
-
wexample_filestate_python/__init__.py
|
|
4
|
-
wexample_filestate_python.egg-info/PKG-INFO
|
|
5
|
-
wexample_filestate_python.egg-info/SOURCES.txt
|
|
6
|
-
wexample_filestate_python.egg-info/dependency_links.txt
|
|
7
|
-
wexample_filestate_python.egg-info/requires.txt
|
|
8
|
-
wexample_filestate_python.egg-info/top_level.txt
|
|
9
|
-
wexample_filestate_python/config_value/__init__.py
|
|
10
|
-
wexample_filestate_python/config_value/python_package_readme_config_value.py
|
|
11
|
-
wexample_filestate_python/const/__init__.py
|
|
12
|
-
wexample_filestate_python/const/name_pattern.py
|
|
13
|
-
wexample_filestate_python/helpers/__init__.py
|
|
14
|
-
wexample_filestate_python/helpers/package.py
|
|
15
|
-
wexample_filestate_python/workdir/__init__.py
|
|
16
|
-
wexample_filestate_python/workdir/python_package_workdir.py
|
|
17
|
-
wexample_filestate_python/workdir/python_packages_suite_workdir.py
|
|
18
|
-
wexample_filestate_python/workdir/python_workdir.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
wexample_filestate_python
|