wexample-filestate-python 0.0.12__tar.gz → 0.0.13__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.
Files changed (23) hide show
  1. wexample_filestate_python-0.0.13/PKG-INFO +58 -0
  2. wexample_filestate_python-0.0.13/README.md +38 -0
  3. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/pyproject.toml +4 -4
  4. wexample_filestate_python-0.0.13/wexample_filestate_python/config_value/python_package_readme_config_value.py +82 -0
  5. wexample_filestate_python-0.0.12/README.md → wexample_filestate_python-0.0.13/wexample_filestate_python/workdir/__init__.py +0 -0
  6. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python/workdir/python_package_workdir.py +34 -0
  7. wexample_filestate_python-0.0.13/wexample_filestate_python.egg-info/PKG-INFO +58 -0
  8. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python.egg-info/SOURCES.txt +2 -0
  9. wexample_filestate_python-0.0.13/wexample_filestate_python.egg-info/requires.txt +7 -0
  10. wexample_filestate_python-0.0.12/PKG-INFO +0 -19
  11. wexample_filestate_python-0.0.12/wexample_filestate_python.egg-info/PKG-INFO +0 -19
  12. wexample_filestate_python-0.0.12/wexample_filestate_python.egg-info/requires.txt +0 -7
  13. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/setup.cfg +0 -0
  14. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python/__init__.py +0 -0
  15. {wexample_filestate_python-0.0.12/wexample_filestate_python/const → wexample_filestate_python-0.0.13/wexample_filestate_python/config_value}/__init__.py +0 -0
  16. {wexample_filestate_python-0.0.12/wexample_filestate_python/helpers → wexample_filestate_python-0.0.13/wexample_filestate_python/const}/__init__.py +0 -0
  17. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python/const/name_pattern.py +0 -0
  18. {wexample_filestate_python-0.0.12/wexample_filestate_python/workdir → wexample_filestate_python-0.0.13/wexample_filestate_python/helpers}/__init__.py +0 -0
  19. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python/helpers/package.py +0 -0
  20. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python/workdir/python_packages_suite_workdir.py +0 -0
  21. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python/workdir/python_workdir.py +0 -0
  22. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python.egg-info/dependency_links.txt +0 -0
  23. {wexample_filestate_python-0.0.12 → wexample_filestate_python-0.0.13}/wexample_filestate_python.egg-info/top_level.txt +0 -0
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.2
2
+ Name: wexample-filestate-python
3
+ Version: 0.0.13
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-app==0.0.18
18
+ Requires-Dist: wexample-filestate-git==0.0.13
19
+ Requires-Dist: wexample-filestate==0.0.21
20
+
21
+ # Filestate Python
22
+
23
+ Helpers for Python.
24
+
25
+ Version: 0.0.13
26
+
27
+ ## Requirements
28
+
29
+ - Python >=3.6
30
+
31
+ ## Dependencies
32
+
33
+ - pip-tools
34
+ - pydantic
35
+ - pytest
36
+ - python-dotenv
37
+ - wexample-app==0.0.18
38
+ - wexample-filestate-git==0.0.13
39
+ - wexample-filestate==0.0.21
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install wexample-filestate-python
45
+ ```
46
+
47
+ ## Links
48
+
49
+ - Homepage: https://github.com/wexample/python-filestate-python
50
+
51
+ ## License
52
+
53
+ MIT
54
+ ## Credits
55
+
56
+ This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
57
+
58
+ Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
@@ -0,0 +1,38 @@
1
+ # Filestate Python
2
+
3
+ Helpers for Python.
4
+
5
+ Version: 0.0.13
6
+
7
+ ## Requirements
8
+
9
+ - Python >=3.6
10
+
11
+ ## Dependencies
12
+
13
+ - pip-tools
14
+ - pydantic
15
+ - pytest
16
+ - python-dotenv
17
+ - wexample-app==0.0.18
18
+ - wexample-filestate-git==0.0.13
19
+ - wexample-filestate==0.0.21
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install wexample-filestate-python
25
+ ```
26
+
27
+ ## Links
28
+
29
+ - Homepage: https://github.com/wexample/python-filestate-python
30
+
31
+ ## License
32
+
33
+ MIT
34
+ ## Credits
35
+
36
+ This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
37
+
38
+ Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "wexample-filestate-python"
10
- version = "0.0.12"
10
+ version = "0.0.13"
11
11
  description = "Helpers for Python."
12
12
  authors = [
13
13
  { name = "weeger", email = "contact@wexample.com" },
@@ -23,9 +23,9 @@ dependencies = [
23
23
  "pydantic",
24
24
  "pytest",
25
25
  "python-dotenv",
26
- "wexample-app==0.0.17",
27
- "wexample-filestate-git==0.0.12",
28
- "wexample-filestate==0.0.20",
26
+ "wexample-app==0.0.18",
27
+ "wexample-filestate-git==0.0.13",
28
+ "wexample-filestate==0.0.21",
29
29
  ]
30
30
 
31
31
  [project.readme]
@@ -0,0 +1,82 @@
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,11 +1,45 @@
1
1
  from typing import Optional
2
2
 
3
+
3
4
  from wexample_config.const.types import DictConfig
4
5
  from wexample_filestate_python.workdir.python_workdir import PythonWorkdir
5
6
  from wexample_helpers.helpers.array import array_dict_get_by
6
7
 
7
8
 
9
+
8
10
  class PythonPackageWorkdir(PythonWorkdir):
11
+ _project_info_cache = None
12
+
13
+ def get_project_info(self, force: bool = False) -> dict:
14
+ """
15
+ Fetch the data from the pyproject.toml file.
16
+
17
+ :param force: If True, forces reloading the data even if it was previously cached.
18
+ :return: A dictionary representing the contents of pyproject.toml.
19
+ """
20
+ # Return cached data if available and force is False
21
+ if not force and self._project_info_cache is not None:
22
+ return self._project_info_cache
23
+
24
+ from wexample_helpers.helpers.file import file_read
25
+ import tomli
26
+
27
+
28
+ project_path = self.get_resolved()
29
+ pyproject_file = f"{project_path}pyproject.toml"
30
+
31
+ # Read the pyproject.toml file
32
+ try:
33
+ pyproject_content = file_read(pyproject_file)
34
+ pyproject_data = tomli.loads(pyproject_content)
35
+ # Store in cache
36
+ self._project_info_cache = pyproject_data
37
+ except FileNotFoundError:
38
+ self.io.error(f"pyproject.toml file not found at {pyproject_file}", fatal=True)
39
+ return {}
40
+
41
+ return pyproject_data
42
+
9
43
  def prepare_value(self, config: Optional[DictConfig] = None) -> DictConfig:
10
44
  from wexample_filestate.const.disk import DiskItemType
11
45
  from wexample_filestate_python.const.name_pattern import NAME_PATTERN_PYTHON_NOT_PYCACHE
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.2
2
+ Name: wexample-filestate-python
3
+ Version: 0.0.13
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-app==0.0.18
18
+ Requires-Dist: wexample-filestate-git==0.0.13
19
+ Requires-Dist: wexample-filestate==0.0.21
20
+
21
+ # Filestate Python
22
+
23
+ Helpers for Python.
24
+
25
+ Version: 0.0.13
26
+
27
+ ## Requirements
28
+
29
+ - Python >=3.6
30
+
31
+ ## Dependencies
32
+
33
+ - pip-tools
34
+ - pydantic
35
+ - pytest
36
+ - python-dotenv
37
+ - wexample-app==0.0.18
38
+ - wexample-filestate-git==0.0.13
39
+ - wexample-filestate==0.0.21
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install wexample-filestate-python
45
+ ```
46
+
47
+ ## Links
48
+
49
+ - Homepage: https://github.com/wexample/python-filestate-python
50
+
51
+ ## License
52
+
53
+ MIT
54
+ ## Credits
55
+
56
+ This package has been developed by [Wexample](https://wexample.com), a collection of tools and utilities to streamline development workflows.
57
+
58
+ Visit [wexample.com](https://wexample.com) to discover more tools and resources for efficient development.
@@ -6,6 +6,8 @@ wexample_filestate_python.egg-info/SOURCES.txt
6
6
  wexample_filestate_python.egg-info/dependency_links.txt
7
7
  wexample_filestate_python.egg-info/requires.txt
8
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
9
11
  wexample_filestate_python/const/__init__.py
10
12
  wexample_filestate_python/const/name_pattern.py
11
13
  wexample_filestate_python/helpers/__init__.py
@@ -0,0 +1,7 @@
1
+ pip-tools
2
+ pydantic
3
+ pytest
4
+ python-dotenv
5
+ wexample-app==0.0.18
6
+ wexample-filestate-git==0.0.13
7
+ wexample-filestate==0.0.21
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: wexample-filestate-python
3
- Version: 0.0.12
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-app==0.0.17
18
- Requires-Dist: wexample-filestate-git==0.0.12
19
- Requires-Dist: wexample-filestate==0.0.20
@@ -1,19 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: wexample-filestate-python
3
- Version: 0.0.12
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-app==0.0.17
18
- Requires-Dist: wexample-filestate-git==0.0.12
19
- Requires-Dist: wexample-filestate==0.0.20
@@ -1,7 +0,0 @@
1
- pip-tools
2
- pydantic
3
- pytest
4
- python-dotenv
5
- wexample-app==0.0.17
6
- wexample-filestate-git==0.0.12
7
- wexample-filestate==0.0.20