mia101 0.1.1__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.
- mia101-0.1.1/AUTHORS.rst +15 -0
- mia101-0.1.1/LICENSE.txt +21 -0
- mia101-0.1.1/PKG-INFO +122 -0
- mia101-0.1.1/README.rst +71 -0
- mia101-0.1.1/mia101/__init__.py +1 -0
- mia101-0.1.1/mia101/api.py +2 -0
- mia101-0.1.1/mia101/paths.py +60 -0
- mia101-0.1.1/mia101/vendor/__init__.py +2 -0
- mia101-0.1.1/mia101/vendor/pytest_cov_helper.py +148 -0
- mia101-0.1.1/mia101.egg-info/PKG-INFO +122 -0
- mia101-0.1.1/mia101.egg-info/SOURCES.txt +15 -0
- mia101-0.1.1/mia101.egg-info/dependency_links.txt +1 -0
- mia101-0.1.1/mia101.egg-info/requires.txt +26 -0
- mia101-0.1.1/mia101.egg-info/top_level.txt +1 -0
- mia101-0.1.1/pyproject.toml +125 -0
- mia101-0.1.1/setup.cfg +4 -0
- mia101-0.1.1/tests/test_api.py +17 -0
mia101-0.1.1/AUTHORS.rst
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.. _about_author:
|
|
2
|
+
|
|
3
|
+
About the Author
|
|
4
|
+
------------------------------------------------------------------------------
|
|
5
|
+
::
|
|
6
|
+
|
|
7
|
+
(\ (\
|
|
8
|
+
( -.-)o
|
|
9
|
+
o_(")(")
|
|
10
|
+
|
|
11
|
+
**Sanhe Hu** is a seasoned software engineer with a deep passion for Python development since 2010. As an author and maintainer of `150+ open-source Python projects <https://pypi.org/user/machugwu/>`_, with over `15 million monthly downloads <https://github.com/MacHu-GWU>`_, I bring a wealth of experience to the table. As a Senior Solution Architect and Subject Matter Expert in AI, Data, Amazon Web Services, Cloud Engineering, DevOps, I thrive on helping clients with platform design, enterprise architecture, and strategic roadmaps.
|
|
12
|
+
|
|
13
|
+
Talk is cheap, show me the code:
|
|
14
|
+
|
|
15
|
+
- My Github: https://github.com/MacHu-GWU
|
mia101-0.1.1/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sanhe Hu <husanhe@email.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
mia101-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mia101
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: An example project generated by cookiecutter-pywf_open_source.
|
|
5
|
+
Author-email: Sanhe Hu <husanhe@email.com>
|
|
6
|
+
Maintainer-email: Sanhe Hu <husanhe@email.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/MacHu-GWU/mia101-project
|
|
9
|
+
Project-URL: Documentation, https://mia101.readthedocs.io/en/latest/
|
|
10
|
+
Project-URL: Repository, https://github.com/MacHu-GWU/mia101-project
|
|
11
|
+
Project-URL: Issues, https://github.com/MacHu-GWU/mia101-project/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/MacHu-GWU/mia101-project/blob/main/release-history.rst
|
|
13
|
+
Project-URL: Download, https://pypi.org/pypi/mia101#files
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: Unix
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Requires-Python: <4.0,>=3.10
|
|
27
|
+
Description-Content-Type: text/x-rst
|
|
28
|
+
License-File: LICENSE.txt
|
|
29
|
+
License-File: AUTHORS.rst
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: rich<14.0.0,>=13.8.1; extra == "dev"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest<9.0.0,>=8.2.2; extra == "test"
|
|
34
|
+
Requires-Dist: pytest-cov<7.0.0,>=6.0.0; extra == "test"
|
|
35
|
+
Provides-Extra: doc
|
|
36
|
+
Requires-Dist: Sphinx<8.0.0,>=7.4.7; extra == "doc"
|
|
37
|
+
Requires-Dist: sphinx-copybutton<1.0.0,>=0.5.2; extra == "doc"
|
|
38
|
+
Requires-Dist: sphinx-design<1.0.0,>=0.6.1; extra == "doc"
|
|
39
|
+
Requires-Dist: sphinx-jinja<3.0.0,>=2.0.2; extra == "doc"
|
|
40
|
+
Requires-Dist: furo==2024.8.6; extra == "doc"
|
|
41
|
+
Requires-Dist: pygments<3.0.0,>=2.18.0; extra == "doc"
|
|
42
|
+
Requires-Dist: ipython<8.19.0,>=8.18.1; extra == "doc"
|
|
43
|
+
Requires-Dist: nbsphinx<1.0.0,>=0.8.12; extra == "doc"
|
|
44
|
+
Requires-Dist: rstobj==2.0.0; extra == "doc"
|
|
45
|
+
Requires-Dist: docfly==3.0.3; extra == "doc"
|
|
46
|
+
Provides-Extra: mise
|
|
47
|
+
Requires-Dist: PyGithub<3.0.0,>=2.8.0; extra == "mise"
|
|
48
|
+
Requires-Dist: httpx<1.0.0,>=0.28.0; extra == "mise"
|
|
49
|
+
Requires-Dist: tomli<3.0.0,>=2.0.0; python_version < "3.11" and extra == "mise"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.. image:: https://readthedocs.org/projects/mia101/badge/?version=latest
|
|
54
|
+
:target: https://mia101.readthedocs.io/en/latest/
|
|
55
|
+
:alt: Documentation Status
|
|
56
|
+
|
|
57
|
+
.. image:: https://github.com/MacHu-GWU/mia101-project/actions/workflows/main.yml/badge.svg
|
|
58
|
+
:target: https://github.com/MacHu-GWU/mia101-project/actions?query=workflow:CI
|
|
59
|
+
|
|
60
|
+
.. image:: https://codecov.io/gh/MacHu-GWU/mia101-project/branch/main/graph/badge.svg
|
|
61
|
+
:target: https://codecov.io/gh/MacHu-GWU/mia101-project
|
|
62
|
+
|
|
63
|
+
.. image:: https://img.shields.io/pypi/v/mia101.svg
|
|
64
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
65
|
+
|
|
66
|
+
.. image:: https://img.shields.io/pypi/l/mia101.svg
|
|
67
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
68
|
+
|
|
69
|
+
.. image:: https://img.shields.io/pypi/pyversions/mia101.svg
|
|
70
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
71
|
+
|
|
72
|
+
.. image:: https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github
|
|
73
|
+
:target: https://github.com/MacHu-GWU/mia101-project/blob/main/release-history.rst
|
|
74
|
+
|
|
75
|
+
.. image:: https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
|
|
76
|
+
:target: https://github.com/MacHu-GWU/mia101-project
|
|
77
|
+
|
|
78
|
+
------
|
|
79
|
+
|
|
80
|
+
.. image:: https://img.shields.io/badge/Link-API-blue.svg
|
|
81
|
+
:target: https://mia101.readthedocs.io/en/latest/py-modindex.html
|
|
82
|
+
|
|
83
|
+
.. image:: https://img.shields.io/badge/Link-Install-blue.svg
|
|
84
|
+
:target: `install`_
|
|
85
|
+
|
|
86
|
+
.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
|
|
87
|
+
:target: https://github.com/MacHu-GWU/mia101-project
|
|
88
|
+
|
|
89
|
+
.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
|
|
90
|
+
:target: https://github.com/MacHu-GWU/mia101-project/issues
|
|
91
|
+
|
|
92
|
+
.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
|
|
93
|
+
:target: https://github.com/MacHu-GWU/mia101-project/issues
|
|
94
|
+
|
|
95
|
+
.. image:: https://img.shields.io/badge/Link-Download-blue.svg
|
|
96
|
+
:target: https://pypi.org/pypi/mia101#files
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
Welcome to ``mia101`` Documentation
|
|
100
|
+
==============================================================================
|
|
101
|
+
.. image:: https://mia101.readthedocs.io/en/latest/_static/mia101-logo.png
|
|
102
|
+
:target: https://mia101.readthedocs.io/en/latest/
|
|
103
|
+
|
|
104
|
+
Documentation for ``mia101``.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
.. _install:
|
|
108
|
+
|
|
109
|
+
Install
|
|
110
|
+
------------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
``mia101`` is released on PyPI, so all you need is to:
|
|
113
|
+
|
|
114
|
+
.. code-block:: console
|
|
115
|
+
|
|
116
|
+
$ pip install mia101
|
|
117
|
+
|
|
118
|
+
To upgrade to latest version:
|
|
119
|
+
|
|
120
|
+
.. code-block:: console
|
|
121
|
+
|
|
122
|
+
$ pip install --upgrade mia101
|
mia101-0.1.1/README.rst
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
.. image:: https://readthedocs.org/projects/mia101/badge/?version=latest
|
|
3
|
+
:target: https://mia101.readthedocs.io/en/latest/
|
|
4
|
+
:alt: Documentation Status
|
|
5
|
+
|
|
6
|
+
.. image:: https://github.com/MacHu-GWU/mia101-project/actions/workflows/main.yml/badge.svg
|
|
7
|
+
:target: https://github.com/MacHu-GWU/mia101-project/actions?query=workflow:CI
|
|
8
|
+
|
|
9
|
+
.. image:: https://codecov.io/gh/MacHu-GWU/mia101-project/branch/main/graph/badge.svg
|
|
10
|
+
:target: https://codecov.io/gh/MacHu-GWU/mia101-project
|
|
11
|
+
|
|
12
|
+
.. image:: https://img.shields.io/pypi/v/mia101.svg
|
|
13
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
14
|
+
|
|
15
|
+
.. image:: https://img.shields.io/pypi/l/mia101.svg
|
|
16
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
17
|
+
|
|
18
|
+
.. image:: https://img.shields.io/pypi/pyversions/mia101.svg
|
|
19
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
20
|
+
|
|
21
|
+
.. image:: https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github
|
|
22
|
+
:target: https://github.com/MacHu-GWU/mia101-project/blob/main/release-history.rst
|
|
23
|
+
|
|
24
|
+
.. image:: https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
|
|
25
|
+
:target: https://github.com/MacHu-GWU/mia101-project
|
|
26
|
+
|
|
27
|
+
------
|
|
28
|
+
|
|
29
|
+
.. image:: https://img.shields.io/badge/Link-API-blue.svg
|
|
30
|
+
:target: https://mia101.readthedocs.io/en/latest/py-modindex.html
|
|
31
|
+
|
|
32
|
+
.. image:: https://img.shields.io/badge/Link-Install-blue.svg
|
|
33
|
+
:target: `install`_
|
|
34
|
+
|
|
35
|
+
.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
|
|
36
|
+
:target: https://github.com/MacHu-GWU/mia101-project
|
|
37
|
+
|
|
38
|
+
.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
|
|
39
|
+
:target: https://github.com/MacHu-GWU/mia101-project/issues
|
|
40
|
+
|
|
41
|
+
.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
|
|
42
|
+
:target: https://github.com/MacHu-GWU/mia101-project/issues
|
|
43
|
+
|
|
44
|
+
.. image:: https://img.shields.io/badge/Link-Download-blue.svg
|
|
45
|
+
:target: https://pypi.org/pypi/mia101#files
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Welcome to ``mia101`` Documentation
|
|
49
|
+
==============================================================================
|
|
50
|
+
.. image:: https://mia101.readthedocs.io/en/latest/_static/mia101-logo.png
|
|
51
|
+
:target: https://mia101.readthedocs.io/en/latest/
|
|
52
|
+
|
|
53
|
+
Documentation for ``mia101``.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
.. _install:
|
|
57
|
+
|
|
58
|
+
Install
|
|
59
|
+
------------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
``mia101`` is released on PyPI, so all you need is to:
|
|
62
|
+
|
|
63
|
+
.. code-block:: console
|
|
64
|
+
|
|
65
|
+
$ pip install mia101
|
|
66
|
+
|
|
67
|
+
To upgrade to latest version:
|
|
68
|
+
|
|
69
|
+
.. code-block:: console
|
|
70
|
+
|
|
71
|
+
$ pip install --upgrade mia101
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from functools import cached_property
|
|
5
|
+
|
|
6
|
+
_dir_here = Path(__file__).absolute().parent
|
|
7
|
+
PACKAGE_NAME = _dir_here.name
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PathEnum:
|
|
11
|
+
"""
|
|
12
|
+
Centralized enumeration of all project paths with absolute path references.
|
|
13
|
+
|
|
14
|
+
Provides IDE-autocomplete-friendly access to all project directories and files using
|
|
15
|
+
absolute paths to eliminate current directory dependencies and ensure consistent path
|
|
16
|
+
resolution across different execution contexts and DevOps workflows.
|
|
17
|
+
"""
|
|
18
|
+
@cached_property
|
|
19
|
+
def dir_home(self):
|
|
20
|
+
return Path.home()
|
|
21
|
+
|
|
22
|
+
dir_project_root = _dir_here.parent
|
|
23
|
+
dir_tmp = dir_project_root / "tmp"
|
|
24
|
+
|
|
25
|
+
# Source Code
|
|
26
|
+
dir_package = _dir_here
|
|
27
|
+
path_version_py = dir_package / "_version.py"
|
|
28
|
+
path_pyproject_toml = dir_project_root / "pyproject.toml"
|
|
29
|
+
path_requirements_txt = dir_project_root / "requirements.txt"
|
|
30
|
+
path_authors = dir_project_root / "AUTHORS.txt"
|
|
31
|
+
path_license = dir_project_root / "LICENSE.txt"
|
|
32
|
+
path_release_history = dir_project_root / "release-history.rst"
|
|
33
|
+
|
|
34
|
+
# Virtual Environment
|
|
35
|
+
dir_venv = dir_project_root / ".venv"
|
|
36
|
+
dir_venv_bin = dir_venv / "bin"
|
|
37
|
+
path_venv_bin_pip = dir_venv_bin / "pip"
|
|
38
|
+
path_venv_bin_python = dir_venv_bin / "python"
|
|
39
|
+
path_venv_bin_pytest = dir_venv_bin / "pytest"
|
|
40
|
+
|
|
41
|
+
# Test
|
|
42
|
+
dir_htmlcov = dir_project_root / "htmlcov"
|
|
43
|
+
path_cov_index_html = dir_htmlcov / "index.html"
|
|
44
|
+
dir_unit_test = dir_project_root / "tests"
|
|
45
|
+
dir_int_test = dir_project_root / "tests_int"
|
|
46
|
+
dir_load_test = dir_project_root / "tests_load"
|
|
47
|
+
|
|
48
|
+
# Documentation
|
|
49
|
+
dir_docs_source = dir_project_root / "docs" / "source"
|
|
50
|
+
dir_docs_build_html = dir_project_root / "docs" / "build" / "html"
|
|
51
|
+
|
|
52
|
+
# Build
|
|
53
|
+
dir_build = dir_project_root / "build"
|
|
54
|
+
dir_dist = dir_project_root / "dist"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
path_enum = PathEnum()
|
|
58
|
+
"""
|
|
59
|
+
Single entry point for all project paths with absolute path references.
|
|
60
|
+
"""
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import contextlib
|
|
6
|
+
import subprocess
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
__version__ = "0.2.1"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@contextlib.contextmanager
|
|
13
|
+
def temp_cwd(path: Path):
|
|
14
|
+
"""
|
|
15
|
+
Temporarily set the current working directory (CWD) and automatically
|
|
16
|
+
switch back when it's done.
|
|
17
|
+
"""
|
|
18
|
+
cwd = os.getcwd()
|
|
19
|
+
os.chdir(str(path))
|
|
20
|
+
try:
|
|
21
|
+
yield path
|
|
22
|
+
finally:
|
|
23
|
+
os.chdir(cwd)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def run_unit_test(
|
|
27
|
+
script: str,
|
|
28
|
+
root_dir: str,
|
|
29
|
+
):
|
|
30
|
+
"""
|
|
31
|
+
Run ``pytest -s --tb=native /path/to/script.py`` Command.
|
|
32
|
+
|
|
33
|
+
:param script: the path to test script
|
|
34
|
+
:param root_dir: the dir you want to temporarily set as cwd
|
|
35
|
+
"""
|
|
36
|
+
bin_pytest = Path(sys.executable).parent / "pytest"
|
|
37
|
+
args = [
|
|
38
|
+
f"{bin_pytest}",
|
|
39
|
+
"-s",
|
|
40
|
+
"--tb=native",
|
|
41
|
+
script,
|
|
42
|
+
]
|
|
43
|
+
with temp_cwd(Path(root_dir)):
|
|
44
|
+
subprocess.run(args)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def run_cov_test(
|
|
48
|
+
script: str,
|
|
49
|
+
module: str,
|
|
50
|
+
root_dir: str,
|
|
51
|
+
htmlcov_dir: str,
|
|
52
|
+
preview: bool = False,
|
|
53
|
+
is_folder: bool = False,
|
|
54
|
+
):
|
|
55
|
+
"""
|
|
56
|
+
The pytest-cov plugin gives you the coverage for entire project. What if
|
|
57
|
+
I want run per-module test independently and get per-module coverage?
|
|
58
|
+
|
|
59
|
+
This is a simple wrapper around pytest + coverage cli command. Allow you to run
|
|
60
|
+
coverage test from Python script and set the code coverage measurement scope.
|
|
61
|
+
|
|
62
|
+
Usage example:
|
|
63
|
+
|
|
64
|
+
suppose you have a source code folder structure like this::
|
|
65
|
+
|
|
66
|
+
/dir_git_repo/
|
|
67
|
+
/dir_git_repo/my_library
|
|
68
|
+
/dir_git_repo/my_library/__init__.py
|
|
69
|
+
/dir_git_repo/my_library/module1.py
|
|
70
|
+
/dir_git_repo/my_library/module2.py
|
|
71
|
+
|
|
72
|
+
In your module 1 unit test script, you can do this:
|
|
73
|
+
|
|
74
|
+
.. code-block:: python
|
|
75
|
+
|
|
76
|
+
from my_library.module1 import func1, func2
|
|
77
|
+
|
|
78
|
+
def test_func1():
|
|
79
|
+
pass
|
|
80
|
+
|
|
81
|
+
def test_func2():
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
if __name__ == "__main__":
|
|
85
|
+
from fixa.pytest_cov_helper import run_cov_test
|
|
86
|
+
|
|
87
|
+
run_cov_test(
|
|
88
|
+
script=__file__,
|
|
89
|
+
module="my_library.module1", # test scope is the module1.py
|
|
90
|
+
root_dir="/path/to/dir_git_repo",
|
|
91
|
+
htmlcov_dir="/path/to/dir_git_repo/htmlcov",
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
In your all modules unit test script, you can do this:
|
|
95
|
+
|
|
96
|
+
.. code-block:: python
|
|
97
|
+
|
|
98
|
+
if __name__ == "__main__":
|
|
99
|
+
from fixa.pytest_cov_helper import run_cov_test
|
|
100
|
+
|
|
101
|
+
run_cov_test(
|
|
102
|
+
script=__file__,
|
|
103
|
+
module="my_library", # test scope is the my_library/
|
|
104
|
+
root_dir="/path/to/dir_git_repo",
|
|
105
|
+
htmlcov_dir="/path/to/dir_git_repo/htmlcov",
|
|
106
|
+
is_folder=True, # my_library is a folder
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
:param script: the test script absolute path
|
|
110
|
+
:param module: the dot notation to the python module you want to calculate
|
|
111
|
+
coverage
|
|
112
|
+
:param root_dir: the dir to dump coverage results binary file
|
|
113
|
+
:param htmlcov_dir: the dir to dump HTML output
|
|
114
|
+
:param preview: whether to open the HTML output in web browser after the test
|
|
115
|
+
:param is_folder: whether the module is a folder
|
|
116
|
+
|
|
117
|
+
Reference:
|
|
118
|
+
|
|
119
|
+
- https://pypi.org/project/pytest-cov/
|
|
120
|
+
"""
|
|
121
|
+
bin_pytest = Path(sys.executable).parent / "pytest"
|
|
122
|
+
if is_folder:
|
|
123
|
+
script = f"{Path(script).parent}"
|
|
124
|
+
if module.endswith(".py"): # pragma: no cover
|
|
125
|
+
module = module[:-3]
|
|
126
|
+
args = [
|
|
127
|
+
f"{bin_pytest}",
|
|
128
|
+
"-s",
|
|
129
|
+
"--tb=native",
|
|
130
|
+
f"--rootdir={root_dir}",
|
|
131
|
+
f"--cov={module}",
|
|
132
|
+
"--cov-report",
|
|
133
|
+
"term-missing",
|
|
134
|
+
"--cov-report",
|
|
135
|
+
f"html:{htmlcov_dir}",
|
|
136
|
+
script,
|
|
137
|
+
]
|
|
138
|
+
with temp_cwd(Path(root_dir)):
|
|
139
|
+
subprocess.run(args)
|
|
140
|
+
if preview: # pragma: no cover
|
|
141
|
+
platform = sys.platform
|
|
142
|
+
if platform in ["win32", "cygwin"]:
|
|
143
|
+
open_command = "start"
|
|
144
|
+
elif platform in ["darwin", "linux"]:
|
|
145
|
+
open_command = "open"
|
|
146
|
+
else:
|
|
147
|
+
raise NotImplementedError
|
|
148
|
+
subprocess.run([open_command, f"{Path(htmlcov_dir).joinpath('index.html')}"])
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mia101
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: An example project generated by cookiecutter-pywf_open_source.
|
|
5
|
+
Author-email: Sanhe Hu <husanhe@email.com>
|
|
6
|
+
Maintainer-email: Sanhe Hu <husanhe@email.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/MacHu-GWU/mia101-project
|
|
9
|
+
Project-URL: Documentation, https://mia101.readthedocs.io/en/latest/
|
|
10
|
+
Project-URL: Repository, https://github.com/MacHu-GWU/mia101-project
|
|
11
|
+
Project-URL: Issues, https://github.com/MacHu-GWU/mia101-project/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/MacHu-GWU/mia101-project/blob/main/release-history.rst
|
|
13
|
+
Project-URL: Download, https://pypi.org/pypi/mia101#files
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: Unix
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Requires-Python: <4.0,>=3.10
|
|
27
|
+
Description-Content-Type: text/x-rst
|
|
28
|
+
License-File: LICENSE.txt
|
|
29
|
+
License-File: AUTHORS.rst
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: rich<14.0.0,>=13.8.1; extra == "dev"
|
|
32
|
+
Provides-Extra: test
|
|
33
|
+
Requires-Dist: pytest<9.0.0,>=8.2.2; extra == "test"
|
|
34
|
+
Requires-Dist: pytest-cov<7.0.0,>=6.0.0; extra == "test"
|
|
35
|
+
Provides-Extra: doc
|
|
36
|
+
Requires-Dist: Sphinx<8.0.0,>=7.4.7; extra == "doc"
|
|
37
|
+
Requires-Dist: sphinx-copybutton<1.0.0,>=0.5.2; extra == "doc"
|
|
38
|
+
Requires-Dist: sphinx-design<1.0.0,>=0.6.1; extra == "doc"
|
|
39
|
+
Requires-Dist: sphinx-jinja<3.0.0,>=2.0.2; extra == "doc"
|
|
40
|
+
Requires-Dist: furo==2024.8.6; extra == "doc"
|
|
41
|
+
Requires-Dist: pygments<3.0.0,>=2.18.0; extra == "doc"
|
|
42
|
+
Requires-Dist: ipython<8.19.0,>=8.18.1; extra == "doc"
|
|
43
|
+
Requires-Dist: nbsphinx<1.0.0,>=0.8.12; extra == "doc"
|
|
44
|
+
Requires-Dist: rstobj==2.0.0; extra == "doc"
|
|
45
|
+
Requires-Dist: docfly==3.0.3; extra == "doc"
|
|
46
|
+
Provides-Extra: mise
|
|
47
|
+
Requires-Dist: PyGithub<3.0.0,>=2.8.0; extra == "mise"
|
|
48
|
+
Requires-Dist: httpx<1.0.0,>=0.28.0; extra == "mise"
|
|
49
|
+
Requires-Dist: tomli<3.0.0,>=2.0.0; python_version < "3.11" and extra == "mise"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.. image:: https://readthedocs.org/projects/mia101/badge/?version=latest
|
|
54
|
+
:target: https://mia101.readthedocs.io/en/latest/
|
|
55
|
+
:alt: Documentation Status
|
|
56
|
+
|
|
57
|
+
.. image:: https://github.com/MacHu-GWU/mia101-project/actions/workflows/main.yml/badge.svg
|
|
58
|
+
:target: https://github.com/MacHu-GWU/mia101-project/actions?query=workflow:CI
|
|
59
|
+
|
|
60
|
+
.. image:: https://codecov.io/gh/MacHu-GWU/mia101-project/branch/main/graph/badge.svg
|
|
61
|
+
:target: https://codecov.io/gh/MacHu-GWU/mia101-project
|
|
62
|
+
|
|
63
|
+
.. image:: https://img.shields.io/pypi/v/mia101.svg
|
|
64
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
65
|
+
|
|
66
|
+
.. image:: https://img.shields.io/pypi/l/mia101.svg
|
|
67
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
68
|
+
|
|
69
|
+
.. image:: https://img.shields.io/pypi/pyversions/mia101.svg
|
|
70
|
+
:target: https://pypi.python.org/pypi/mia101
|
|
71
|
+
|
|
72
|
+
.. image:: https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github
|
|
73
|
+
:target: https://github.com/MacHu-GWU/mia101-project/blob/main/release-history.rst
|
|
74
|
+
|
|
75
|
+
.. image:: https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
|
|
76
|
+
:target: https://github.com/MacHu-GWU/mia101-project
|
|
77
|
+
|
|
78
|
+
------
|
|
79
|
+
|
|
80
|
+
.. image:: https://img.shields.io/badge/Link-API-blue.svg
|
|
81
|
+
:target: https://mia101.readthedocs.io/en/latest/py-modindex.html
|
|
82
|
+
|
|
83
|
+
.. image:: https://img.shields.io/badge/Link-Install-blue.svg
|
|
84
|
+
:target: `install`_
|
|
85
|
+
|
|
86
|
+
.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
|
|
87
|
+
:target: https://github.com/MacHu-GWU/mia101-project
|
|
88
|
+
|
|
89
|
+
.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
|
|
90
|
+
:target: https://github.com/MacHu-GWU/mia101-project/issues
|
|
91
|
+
|
|
92
|
+
.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
|
|
93
|
+
:target: https://github.com/MacHu-GWU/mia101-project/issues
|
|
94
|
+
|
|
95
|
+
.. image:: https://img.shields.io/badge/Link-Download-blue.svg
|
|
96
|
+
:target: https://pypi.org/pypi/mia101#files
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
Welcome to ``mia101`` Documentation
|
|
100
|
+
==============================================================================
|
|
101
|
+
.. image:: https://mia101.readthedocs.io/en/latest/_static/mia101-logo.png
|
|
102
|
+
:target: https://mia101.readthedocs.io/en/latest/
|
|
103
|
+
|
|
104
|
+
Documentation for ``mia101``.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
.. _install:
|
|
108
|
+
|
|
109
|
+
Install
|
|
110
|
+
------------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
``mia101`` is released on PyPI, so all you need is to:
|
|
113
|
+
|
|
114
|
+
.. code-block:: console
|
|
115
|
+
|
|
116
|
+
$ pip install mia101
|
|
117
|
+
|
|
118
|
+
To upgrade to latest version:
|
|
119
|
+
|
|
120
|
+
.. code-block:: console
|
|
121
|
+
|
|
122
|
+
$ pip install --upgrade mia101
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
AUTHORS.rst
|
|
2
|
+
LICENSE.txt
|
|
3
|
+
README.rst
|
|
4
|
+
pyproject.toml
|
|
5
|
+
mia101/__init__.py
|
|
6
|
+
mia101/api.py
|
|
7
|
+
mia101/paths.py
|
|
8
|
+
mia101.egg-info/PKG-INFO
|
|
9
|
+
mia101.egg-info/SOURCES.txt
|
|
10
|
+
mia101.egg-info/dependency_links.txt
|
|
11
|
+
mia101.egg-info/requires.txt
|
|
12
|
+
mia101.egg-info/top_level.txt
|
|
13
|
+
mia101/vendor/__init__.py
|
|
14
|
+
mia101/vendor/pytest_cov_helper.py
|
|
15
|
+
tests/test_api.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
[dev]
|
|
3
|
+
rich<14.0.0,>=13.8.1
|
|
4
|
+
|
|
5
|
+
[doc]
|
|
6
|
+
Sphinx<8.0.0,>=7.4.7
|
|
7
|
+
sphinx-copybutton<1.0.0,>=0.5.2
|
|
8
|
+
sphinx-design<1.0.0,>=0.6.1
|
|
9
|
+
sphinx-jinja<3.0.0,>=2.0.2
|
|
10
|
+
furo==2024.8.6
|
|
11
|
+
pygments<3.0.0,>=2.18.0
|
|
12
|
+
ipython<8.19.0,>=8.18.1
|
|
13
|
+
nbsphinx<1.0.0,>=0.8.12
|
|
14
|
+
rstobj==2.0.0
|
|
15
|
+
docfly==3.0.3
|
|
16
|
+
|
|
17
|
+
[mise]
|
|
18
|
+
PyGithub<3.0.0,>=2.8.0
|
|
19
|
+
httpx<1.0.0,>=0.28.0
|
|
20
|
+
|
|
21
|
+
[mise:python_version < "3.11"]
|
|
22
|
+
tomli<3.0.0,>=2.0.0
|
|
23
|
+
|
|
24
|
+
[test]
|
|
25
|
+
pytest<9.0.0,>=8.2.2
|
|
26
|
+
pytest-cov<7.0.0,>=6.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mia101
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# The [project] table defined by Official python.org
|
|
3
|
+
#
|
|
4
|
+
# Read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
|
|
5
|
+
# ==============================================================================
|
|
6
|
+
[project]
|
|
7
|
+
name = "mia101"
|
|
8
|
+
# Increment version before each release - follow `semantic versioning <https://semver.org/>`_
|
|
9
|
+
# Currently, poetry 2.1.X doesn't support dynamic versioning
|
|
10
|
+
# (Read https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#version)
|
|
11
|
+
# So this value has to be aligned with the one in ``mia101/_version.py``
|
|
12
|
+
version = "0.1.1"
|
|
13
|
+
description = "An example project generated by cookiecutter-pywf_open_source."
|
|
14
|
+
# Read https://dev-exp-share.readthedocs.io/en/latest/search.html?q=Pick+An+Open+Source+License+For+Python+Project&check_keywords=yes&area=default
|
|
15
|
+
# To pick a license and update the ``license``, ``classifier`` field in ``pyproject.toml``
|
|
16
|
+
# And also update the ``LICENSE.txt`` file in the git repo.
|
|
17
|
+
license = "MIT"
|
|
18
|
+
license-files = ["LICENSE.txt", "AUTHORS.rst"]
|
|
19
|
+
authors = [
|
|
20
|
+
{ name = "Sanhe Hu", email = "husanhe@email.com" },
|
|
21
|
+
]
|
|
22
|
+
maintainers = [
|
|
23
|
+
{ name = "Sanhe Hu", email = "husanhe@email.com" },
|
|
24
|
+
]
|
|
25
|
+
keywords = []
|
|
26
|
+
readme = "README.rst"
|
|
27
|
+
requires-python = ">=3.10,<4.0"
|
|
28
|
+
# Full list of classifiers: https://pypi.org/classifiers/
|
|
29
|
+
classifiers = [
|
|
30
|
+
"Development Status :: 4 - Beta",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Natural Language :: English",
|
|
33
|
+
"Operating System :: Microsoft :: Windows",
|
|
34
|
+
"Operating System :: MacOS",
|
|
35
|
+
"Operating System :: Unix",
|
|
36
|
+
"Programming Language :: Python :: 3",
|
|
37
|
+
"Programming Language :: Python :: 3.10",
|
|
38
|
+
"Programming Language :: Python :: 3.11",
|
|
39
|
+
"Programming Language :: Python :: 3.12",
|
|
40
|
+
"Programming Language :: Python :: 3.13",
|
|
41
|
+
"Programming Language :: Python :: 3.14",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
# ------------------------------------------------------------------------------
|
|
45
|
+
# Core Dependencies
|
|
46
|
+
# ------------------------------------------------------------------------------
|
|
47
|
+
dependencies = [
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
# ------------------------------------------------------------------------------
|
|
51
|
+
# Optional dependency that can be used in ``pip install ${your_project_name}[${feature_name}]``
|
|
52
|
+
# Sometime this is also called "extras"
|
|
53
|
+
# Read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#dependencies-optional-dependencies
|
|
54
|
+
#
|
|
55
|
+
# IMPORTANT: all optional dependencies has to be compatible with the "requires-python" field
|
|
56
|
+
# ------------------------------------------------------------------------------
|
|
57
|
+
[project.optional-dependencies]
|
|
58
|
+
|
|
59
|
+
# ------------------------------------------------------------------------------
|
|
60
|
+
# Local Development dependenceies
|
|
61
|
+
# ------------------------------------------------------------------------------
|
|
62
|
+
dev = [
|
|
63
|
+
"rich>=13.8.1,<14.0.0", # pretty print
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
# ------------------------------------------------------------------------------
|
|
67
|
+
# (Unit/Coverage/Integration/Load) Test dependenceies
|
|
68
|
+
# ------------------------------------------------------------------------------
|
|
69
|
+
test = [
|
|
70
|
+
"pytest>=8.2.2,<9.0.0", # Testing framework
|
|
71
|
+
"pytest-cov>=6.0.0,<7.0.0", # Coverage reporting
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
# ------------------------------------------------------------------------------
|
|
75
|
+
# Documentation build dependenceies
|
|
76
|
+
# ------------------------------------------------------------------------------
|
|
77
|
+
doc = [
|
|
78
|
+
"Sphinx>=7.4.7,<8.0.0",
|
|
79
|
+
"sphinx-copybutton>=0.5.2,<1.0.0", # add copy button to code block
|
|
80
|
+
"sphinx-design>=0.6.1,<1.0.0", # add additional design pattern to sphinx
|
|
81
|
+
"sphinx-jinja>=2.0.2,<3.0.0", # enable jinja syntax in reStructuredText
|
|
82
|
+
"furo==2024.8.6", # the furo sphinx theme
|
|
83
|
+
"pygments>=2.18.0,<3.0.0", # syntax highlight
|
|
84
|
+
"ipython>=8.18.1,<8.19.0", # interactive Python
|
|
85
|
+
"nbsphinx>=0.8.12,<1.0.0", # add jupyter notebook in sphinx doc
|
|
86
|
+
"rstobj==2.0.0", # generate reStructuredText from Python code
|
|
87
|
+
"docfly==3.0.3", # automaticall generate .. toctree directives and API reference doc
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
# ------------------------------------------------------------------------------
|
|
91
|
+
# Mise task runner dependencies
|
|
92
|
+
# ------------------------------------------------------------------------------
|
|
93
|
+
mise = [
|
|
94
|
+
"PyGithub>=2.8.0,<3.0.0", # GitHub API client
|
|
95
|
+
"httpx>=0.28.0,<1.0.0", # HTTP client for ReadTheDocs API
|
|
96
|
+
"tomli>=2.0.0,<3.0.0; python_version < '3.11'", # TOML parser for Python 3.10
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
# Quick Links
|
|
100
|
+
[project.urls]
|
|
101
|
+
Homepage = "https://github.com/MacHu-GWU/mia101-project"
|
|
102
|
+
Documentation = "https://mia101.readthedocs.io/en/latest/"
|
|
103
|
+
Repository = "https://github.com/MacHu-GWU/mia101-project"
|
|
104
|
+
Issues = "https://github.com/MacHu-GWU/mia101-project/issues"
|
|
105
|
+
Changelog = "https://github.com/MacHu-GWU/mia101-project/blob/main/release-history.rst"
|
|
106
|
+
Download = "https://pypi.org/pypi/mia101#files"
|
|
107
|
+
|
|
108
|
+
# For command line interface, read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#creating-executable-scripts
|
|
109
|
+
[project.scripts]
|
|
110
|
+
|
|
111
|
+
[tool.setuptools.packages.find]
|
|
112
|
+
where = ["."]
|
|
113
|
+
include = [
|
|
114
|
+
"mia101*"
|
|
115
|
+
]
|
|
116
|
+
exclude = [
|
|
117
|
+
"mia101.tests",
|
|
118
|
+
"mia101.tests.*",
|
|
119
|
+
"mia101.docs",
|
|
120
|
+
"mia101.docs.*",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[build-system]
|
|
124
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
125
|
+
build-backend = "setuptools.build_meta"
|
mia101-0.1.1/setup.cfg
ADDED