validating 0.0.0__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.
@@ -0,0 +1,38 @@
1
+ name: Upload Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v3
17
+ with:
18
+ submodules: recursive
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v3
21
+ with:
22
+ python-version: "3.12.7"
23
+ - name: Upgrade pip
24
+ run: python -m pip install --upgrade pip
25
+ - name: Install yaml
26
+ run: python -m pip install pyyaml
27
+ - name: Install build
28
+ run: python -m pip install build
29
+ - name: Install twine
30
+ run: python -m pip install twine
31
+ - name: Install cfgtools
32
+ run: python -m pip install cfgtools
33
+ - name: Install re-extensions
34
+ run: python -m pip install re-extensions
35
+ - name: Build package
36
+ run: python install.py
37
+ - name: Publish package
38
+ run: twine upload dist/* --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,160 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, Chitaoji
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,42 @@
1
+ Metadata-Version: 2.4
2
+ Name: validating
3
+ Version: 0.0.0
4
+ Summary: For test
5
+ Project-URL: Documentation, https://github.com/Chitaoji/validating/blob/main/README.md
6
+ Project-URL: Repository, https://github.com/Chitaoji/validating/
7
+ Author-email: Chitaoji <2360742040@qq.com>
8
+ Maintainer-email: Chitaoji <2360742040@qq.com>
9
+ License-Expression: BSD-3-Clause
10
+ License-File: LICENSE
11
+ Keywords: config
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.12
15
+ Description-Content-Type: text/markdown
16
+
17
+ # validating
18
+ A template repository for building python packages.
19
+
20
+ ## Installation
21
+ ```sh
22
+ $ pip install validating
23
+ ```
24
+
25
+ ## Requirements
26
+ ```txt
27
+
28
+ ```
29
+
30
+ ## See Also
31
+ ### Github repository
32
+ * https://github.com/Chitaoji/validating/
33
+
34
+ ### PyPI project
35
+ * https://pypi.org/project/validating/
36
+
37
+ ## License
38
+ This project falls under the BSD 3-Clause License.
39
+
40
+ ## History
41
+ ### v0.0.0
42
+ * Initial release.
@@ -0,0 +1,26 @@
1
+ # validating
2
+ A template repository for building python packages.
3
+
4
+ ## Installation
5
+ ```sh
6
+ $ pip install validating
7
+ ```
8
+
9
+ ## Requirements
10
+ ```txt
11
+
12
+ ```
13
+
14
+ ## See Also
15
+ ### Github repository
16
+ * https://github.com/Chitaoji/validating/
17
+
18
+ ### PyPI project
19
+ * https://pypi.org/project/validating/
20
+
21
+ ## License
22
+ This project falls under the BSD 3-Clause License.
23
+
24
+ ## History
25
+ ### v0.0.0
26
+ * Initial release.
@@ -0,0 +1,107 @@
1
+ """Install the package."""
2
+
3
+ #!/usr/bin/env python
4
+ # -*- coding: utf-8 -*-
5
+ import os
6
+ import re
7
+ from pathlib import Path
8
+ from typing import Final
9
+
10
+ import cfgtools as cfg
11
+ from re_extensions import rsplit, word_wrap
12
+
13
+ here = Path(__file__).parent
14
+
15
+ # Load the package's meta-data from pyproject.toml.
16
+ f = cfg.read_toml(here / "pyproject.toml")
17
+ project = f["project"].asdict()
18
+ NAME: Final[str] = project["name"]
19
+ SUMMARY: Final[str] = project["description"]
20
+ HOMEPAGE: Final[str] = project["urls"]["Repository"]
21
+ REQUIRES: Final[list[str]] = project["dependencies"]
22
+ SOURCE = "src"
23
+ LICENSE = (here / project["license-files"][0]).read_text().partition("\n")[0]
24
+ VERSION = project["version"]
25
+
26
+ # Import the README and use it as the long-description.
27
+ readme_path = here / project["readme"]
28
+ if readme_path.exists():
29
+ long_description = "\n" + readme_path.read_text(encoding="utf-8")
30
+ else:
31
+ long_description = SUMMARY
32
+
33
+
34
+ def _readme2doc(
35
+ readme: str,
36
+ name: str = NAME,
37
+ requires: list[str] = REQUIRES,
38
+ homepage: str = HOMEPAGE,
39
+ pkg_license: str = LICENSE,
40
+ ) -> tuple[str, str]:
41
+ doc, rd = "", ""
42
+ for i, s in enumerate(rsplit("\n## ", readme)):
43
+ head = re.search(" .*\n", s).group()[1:-1]
44
+ if i == 0:
45
+ s = re.sub("^\n# .*", f"\n# {name}", s)
46
+ elif head == "Requirements":
47
+ s = re.sub(
48
+ "```txt.*```",
49
+ "```txt\n" + "\n".join(requires) + "\n```",
50
+ s,
51
+ flags=re.DOTALL,
52
+ )
53
+ elif head == "Installation":
54
+ s = re.sub(
55
+ "```sh.*```", f"```sh\n$ pip install {name}\n```", s, flags=re.DOTALL
56
+ )
57
+ elif head == "See Also":
58
+ pypipage = f"https://pypi.org/project/{name}/"
59
+ s = re.sub(
60
+ "### PyPI project\n.*",
61
+ f"### PyPI project\n* {pypipage}",
62
+ re.sub(
63
+ "### Github repository\n.*",
64
+ f"### Github repository\n* {homepage}",
65
+ s,
66
+ ),
67
+ )
68
+ elif head == "License":
69
+ s = f"\n## License\nThis project falls under the {pkg_license}.\n"
70
+
71
+ rd += s
72
+ if head not in {"Installation", "Requirements", "History"}:
73
+ doc += s
74
+ doc = re.sub("<!--html-->.*<!--/html-->", "", doc, flags=re.DOTALL)
75
+ return word_wrap(doc, maximum=88) + "\n\n", rd
76
+
77
+
78
+ def _quote(readme: str) -> str:
79
+ if "'''" in readme and '"""' in readme:
80
+ raise ReadmeFormatError("Both \"\"\" and ''' are found in the README")
81
+ if '"""' in readme:
82
+ return f"'''{readme}'''"
83
+ else:
84
+ return f'"""{readme}"""'
85
+
86
+
87
+ def _version(version: str = VERSION) -> str:
88
+ return f'"""Version file."""\n\n__version__ = "{version}"\n'
89
+
90
+
91
+ class ReadmeFormatError(Exception):
92
+ """Raised when the README has a wrong format."""
93
+
94
+
95
+ if __name__ == "__main__":
96
+ # Import the __init__.py and change the module docstring.
97
+ init_path = here / SOURCE / NAME / "__init__.py"
98
+ version_path = here / SOURCE / NAME / "_version.py"
99
+ module_file = init_path.read_text(encoding="utf-8")
100
+ new_doc, long_description = _readme2doc(long_description)
101
+ module_file = re.sub(
102
+ "^\"\"\".*\"\"\"|^'''.*'''|^", _quote(new_doc), module_file, flags=re.DOTALL
103
+ )
104
+ init_path.write_text(module_file, encoding="utf-8")
105
+ readme_path.write_text(long_description.strip(), encoding="utf-8")
106
+ version_path.write_text(_version())
107
+ os.system(f"cd {here} && python -m build")
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "validating"
7
+ version = "0.0.0"
8
+ dependencies = []
9
+ requires-python = ">=3.12"
10
+ authors = [
11
+ {name = "Chitaoji", email = "2360742040@qq.com"},
12
+ ]
13
+ maintainers = [
14
+ {name = "Chitaoji", email = "2360742040@qq.com"}
15
+ ]
16
+ description = "For test"
17
+ readme = "README.md"
18
+ license = "BSD-3-Clause"
19
+ license-files = ["LICENSE"]
20
+ keywords = ["config"]
21
+ classifiers = [
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.12"
24
+ ]
25
+
26
+ [project.urls]
27
+ Documentation = "https://github.com/Chitaoji/validating/blob/main/README.md"
28
+ Repository = "https://github.com/Chitaoji/validating/"
29
+
30
+ [project.scripts]
31
+ cfg = "template.__main__:run"
@@ -0,0 +1,22 @@
1
+ """
2
+ # validating
3
+ A template repository for building python packages.
4
+
5
+ ## See Also
6
+ ### Github repository
7
+ * https://github.com/Chitaoji/validating/
8
+
9
+ ### PyPI project
10
+ * https://pypi.org/project/validating/
11
+
12
+ ## License
13
+ This project falls under the BSD 3-Clause License.
14
+
15
+ """
16
+
17
+ from . import core
18
+ from ._version import __version__
19
+ from .core import *
20
+
21
+ __all__: list[str] = []
22
+ __all__.extend(core.__all__)
@@ -0,0 +1,14 @@
1
+ """
2
+ Contains the cli api of template.
3
+
4
+ NOTE: this module is private. All functions and objects are available in the main
5
+ `template` namespace - use that instead.
6
+
7
+ """
8
+
9
+ import click
10
+
11
+
12
+ @click.command(context_settings={"help_option_names": ["-h", "--help"]})
13
+ def run() -> None:
14
+ """Read and display a config file."""
@@ -0,0 +1,10 @@
1
+ """
2
+ Contains typing classes.
3
+
4
+ NOTE: this module is not intended to be imported at runtime.
5
+
6
+ """
7
+
8
+ import loggings
9
+
10
+ loggings.warning("this module is not intended to be imported at runtime")
@@ -0,0 +1,3 @@
1
+ """Version file."""
2
+
3
+ __version__ = "0.0.0"
@@ -0,0 +1,9 @@
1
+ """
2
+ Contains the core of template: ... , etc.
3
+
4
+ NOTE: this module is private. All functions and objects are available in the main
5
+ `template` namespace - use that instead.
6
+
7
+ """
8
+
9
+ __all__ = []