pyprefab 0.2.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,62 @@
1
+ # .github/workflows/publish-pypi-test.yml
2
+ # uses trusted publishing to publish the package to test-pypi as described here:
3
+ # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
4
+ name: Publish to test PyPI
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ build:
14
+ name: Build distribution 📦
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout 🛎️
19
+ uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+ persist-credentials: false
23
+
24
+ - name: Set up Python 🐍
25
+ uses: actions/setup-python@v5
26
+
27
+ - name: Install uv 🌟
28
+ uses: astral-sh/setup-uv@v5
29
+ with:
30
+ version: ">=0.0.1"
31
+
32
+ - name: Build package for distribution 🛠️
33
+ run: |
34
+ uv build
35
+
36
+ - name: Upload distribution packages 📤
37
+ uses: actions/upload-artifact@v4
38
+ with:
39
+ name: package-distribution
40
+ path: dist/
41
+
42
+ publish-to-testpypi:
43
+ name: Publish Python distribution to test PyPI
44
+ needs:
45
+ - build
46
+ runs-on: ubuntu-latest
47
+ environment:
48
+ name: pypi-test
49
+ url: https://test.pypi.org/p/pyprefab
50
+ permissions:
51
+ id-token: write # needed for trusted publishing (i.e., OIDC)
52
+
53
+ steps:
54
+ - name: Download distribution artifacts 📥
55
+ uses: actions/download-artifact@v4
56
+ with:
57
+ name: package-distribution
58
+ path: dist/
59
+ - name: Publish distribution to test PyPI 🚀
60
+ uses: pypa/gh-action-pypi-publish@release/v1
61
+ with:
62
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,104 @@
1
+ # .github/workflows/publish-pypi.yml
2
+ # uses trusted publishing to publish the package to PyPI and create a GitHub
3
+ # release as described here:
4
+ # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
5
+ name: Publish to PyPI and create GitHub release
6
+
7
+ on:
8
+ push:
9
+ tags:
10
+ # only run workflow for tags in release format
11
+ - "v[0-9].[0-9].[0-9]"
12
+
13
+ jobs:
14
+ build:
15
+ name: Build distribution 📦
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout 🛎️
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+ persist-credentials: false
24
+
25
+ - name: Set up Python 🐍
26
+ uses: actions/setup-python@v5
27
+
28
+ - name: Install uv 🌟
29
+ uses: astral-sh/setup-uv@v5
30
+ with:
31
+ version: ">=0.0.1"
32
+
33
+ - name: Build package for distribution 🛠️
34
+ run: |
35
+ uv build
36
+
37
+ - name: Upload distribution packages 📤
38
+ uses: actions/upload-artifact@v4
39
+ with:
40
+ name: package-distribution
41
+ path: dist/
42
+
43
+ publish-to-pypi:
44
+ name: Publish Python distribution to PyPI
45
+ needs:
46
+ - build
47
+ runs-on: ubuntu-latest
48
+ environment:
49
+ name: pypi
50
+ url: https://pypi.org/p/pyprefab
51
+ permissions:
52
+ id-token: write # needed for trusted publishing (i.e., OIDC)
53
+
54
+ steps:
55
+ - name: Download distribution artifacts 📥
56
+ uses: actions/download-artifact@v4
57
+ with:
58
+ name: package-distribution
59
+ path: dist/
60
+ - name: Publish distribution to PyPI 🚀
61
+ uses: pypa/gh-action-pypi-publish@release/v1
62
+
63
+ github-release:
64
+ name: >-
65
+ Sign the Python distribution with Sigstore
66
+ and upload them to GitHub Release
67
+ needs:
68
+ - publish-to-pypi
69
+ runs-on: ubuntu-latest
70
+
71
+ permissions:
72
+ contents: write # required for creating GitHub Releases
73
+ id-token: write # required for sigstore
74
+
75
+ steps:
76
+ - name: Download distribution artifacts 📥
77
+ uses: actions/download-artifact@v4
78
+ with:
79
+ name: package-distribution
80
+ path: dist/
81
+ - name: Sign the dists with Sigstore 📝
82
+ uses: sigstore/gh-action-sigstore-python@v3.0.0
83
+ with:
84
+ inputs: >-
85
+ ./dist/*.tar.gz
86
+ ./dist/*.whl
87
+ - name: Create GitHub Release 🛠️
88
+ env:
89
+ GITHUB_TOKEN: ${{ github.token }}
90
+ run: >-
91
+ gh release create
92
+ "$GITHUB_REF_NAME"
93
+ --repo "$GITHUB_REPOSITORY"
94
+ --notes-from-tag
95
+ - name: Upload artifact signatures to GitHub Release 📤
96
+ env:
97
+ GITHUB_TOKEN: ${{ github.token }}
98
+ # Upload to GitHub Release.
99
+ # `dist/` contains the built packages, and the
100
+ # sigstore-produced signatures and certificates.
101
+ run: >-
102
+ gh release upload
103
+ "$GITHUB_REF_NAME" dist/**
104
+ --repo "$GITHUB_REPOSITORY"
@@ -0,0 +1,32 @@
1
+ name: run-code-checks
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ branches: [ $default-branch ]
7
+
8
+ jobs:
9
+ run-checks:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: checkout code 🧳
13
+ uses: actions/checkout@v4
14
+
15
+ - name: install uv 🌞
16
+ uses: astral-sh/setup-uv@v3
17
+
18
+ - name: set up Python 🐍
19
+ uses: actions/setup-python@v5
20
+
21
+ - name: install project 🚀
22
+ run: uv sync --dev
23
+
24
+ - name: lint 🧹
25
+ run: uv run ruff check .
26
+
27
+ - name: run tests 🧪
28
+ run: uv run pytest
29
+
30
+ - name: type check ⌨️
31
+ run: uv run mypy .
32
+
@@ -0,0 +1,172 @@
1
+ **/.DS_Store
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ share/python-wheels/
26
+ *.egg-info/
27
+ .installed.cfg
28
+ *.egg
29
+ MANIFEST
30
+
31
+ # PyInstaller
32
+ # Usually these files are written by a python script from a template
33
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
34
+ *.manifest
35
+ *.spec
36
+
37
+ # Installer logs
38
+ pip-log.txt
39
+ pip-delete-this-directory.txt
40
+
41
+ # Unit test / coverage reports
42
+ htmlcov/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # For a library or package, you might want to ignore these files since the code is
89
+ # intended to run in multiple environments; otherwise, check them in:
90
+ # .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # poetry
100
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
102
+ # commonly ignored for libraries.
103
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104
+ #poetry.lock
105
+
106
+ # pdm
107
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108
+ #pdm.lock
109
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110
+ # in version control.
111
+ # https://pdm.fming.dev/#use-with-ide
112
+ .pdm.toml
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # pdm
134
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
135
+ #pdm.lock
136
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
137
+ # in version control.
138
+ # https://pdm.fming.dev/#use-with-ide
139
+ .pdm.toml
140
+ .pdm-python
141
+ .pdm-build/
142
+
143
+ # Spyder project settings
144
+ .spyderproject
145
+ .spyproject
146
+
147
+ # Rope project settings
148
+ .ropeproject
149
+
150
+ # mkdocs documentation
151
+ /site
152
+
153
+ # mypy
154
+ .mypy_cache/
155
+ .dmypy.json
156
+ dmypy.json
157
+
158
+ # Pyre type checker
159
+ .pyre/
160
+
161
+ # pytype static type analyzer
162
+ .pytype/
163
+
164
+ # Cython debug symbols
165
+ cython_debug/
166
+
167
+ # PyCharm
168
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
169
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
170
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
171
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
172
+ #.idea/
@@ -0,0 +1,30 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.8.0
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff
8
+ args: [ --fix ]
9
+ # Run the formatter.
10
+ - id: ruff-format
11
+ - repo: https://github.com/pre-commit/pre-commit-hooks
12
+ rev: v4.6.0
13
+ hooks:
14
+ - id: trailing-whitespace
15
+ - id: check-yaml
16
+ args: [--allow-multiple-documents]
17
+ - id: debug-statements
18
+ - id: detect-aws-credentials
19
+ args: [--allow-missing-credentials]
20
+ - id: detect-private-key
21
+ - id: double-quote-string-fixer
22
+ - repo: https://github.com/pre-commit/mirrors-mypy
23
+ rev: 'v1.10.1' # Use the sha / tag you want to point at
24
+ hooks:
25
+ - id: mypy
26
+ additional_dependencies: [types-all]
27
+ - repo: https://github.com/codespell-project/codespell
28
+ rev: v2.3.0
29
+ hooks:
30
+ - id: codespell
@@ -0,0 +1 @@
1
+ 3.12
pyprefab-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Becky Sweger
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.
@@ -0,0 +1,82 @@
1
+ Metadata-Version: 2.2
2
+ Name: pyprefab
3
+ Version: 0.2.0
4
+ Summary: Python application template for personal use
5
+ License: MIT License
6
+ Project-URL: Repository, https://github.com/bsweger/pyprefab.git
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: structlog
13
+ Requires-Dist: rich
14
+
15
+ # pyprefab
16
+
17
+ A Python template for personal use. The package itself doesn't do much, but I
18
+ keep it up to date as my Python workflow and tooling preferences evolve.
19
+
20
+ ## Installing and running the package (no development)
21
+
22
+ To install this package via pip:
23
+
24
+ ```bash
25
+ pip install git+https://github.com/bsweger/pyprefab.git
26
+ ```
27
+
28
+ To run it:
29
+
30
+ ```bash
31
+ hello_world
32
+ ```
33
+
34
+ ## Setup for local development
35
+
36
+ The instructions below outline how to set up a development environment based
37
+ on uv tooling.
38
+
39
+ Prerequisites:
40
+
41
+ - [uv](https://docs.astral.sh/uv/getting-started/installation/)
42
+
43
+ 1. Clone this repository
44
+ 2. Change to the repo's root directory:
45
+
46
+ ```bash
47
+ cd pyprefab
48
+ ```
49
+
50
+ 3. Create a Python virtual environment and install dependencies. The command
51
+ below creates a virtual environment in the `.venv` directory, installs Python
52
+ if needed, installs project dependencies (including dev dependencies), and
53
+ installs the package in
54
+ [editable mode](https://setuptools.pypa.io/en/stable/userguide/development_mode.html):
55
+
56
+ ```bash
57
+ uv sync
58
+ ```
59
+
60
+ 4. Run the test suite to confirm that everything is working:
61
+
62
+ ```bash
63
+ uv run pytest
64
+ ```
65
+
66
+ ### Updating dependencies
67
+
68
+ Use [`uv add`](https://docs.astral.sh/uv/reference/cli/#uv-add) to include a
69
+ new dependency in the project. This command will install the new dependency
70
+ into the virtual environment, add it to `uv.lock`, and update the
71
+ `dependencies` section of [`pyproject.toml`](pyproject.toml).
72
+
73
+ ```bash
74
+ uv add <package-name>
75
+ ```
76
+
77
+ To add a dependency to a specific group (adding a dev dependency, for example),
78
+ use the `--group` flag:
79
+
80
+ ```bash
81
+ uv add <package-name> --group dev
82
+ ```
@@ -0,0 +1,68 @@
1
+ # pyprefab
2
+
3
+ A Python template for personal use. The package itself doesn't do much, but I
4
+ keep it up to date as my Python workflow and tooling preferences evolve.
5
+
6
+ ## Installing and running the package (no development)
7
+
8
+ To install this package via pip:
9
+
10
+ ```bash
11
+ pip install git+https://github.com/bsweger/pyprefab.git
12
+ ```
13
+
14
+ To run it:
15
+
16
+ ```bash
17
+ hello_world
18
+ ```
19
+
20
+ ## Setup for local development
21
+
22
+ The instructions below outline how to set up a development environment based
23
+ on uv tooling.
24
+
25
+ Prerequisites:
26
+
27
+ - [uv](https://docs.astral.sh/uv/getting-started/installation/)
28
+
29
+ 1. Clone this repository
30
+ 2. Change to the repo's root directory:
31
+
32
+ ```bash
33
+ cd pyprefab
34
+ ```
35
+
36
+ 3. Create a Python virtual environment and install dependencies. The command
37
+ below creates a virtual environment in the `.venv` directory, installs Python
38
+ if needed, installs project dependencies (including dev dependencies), and
39
+ installs the package in
40
+ [editable mode](https://setuptools.pypa.io/en/stable/userguide/development_mode.html):
41
+
42
+ ```bash
43
+ uv sync
44
+ ```
45
+
46
+ 4. Run the test suite to confirm that everything is working:
47
+
48
+ ```bash
49
+ uv run pytest
50
+ ```
51
+
52
+ ### Updating dependencies
53
+
54
+ Use [`uv add`](https://docs.astral.sh/uv/reference/cli/#uv-add) to include a
55
+ new dependency in the project. This command will install the new dependency
56
+ into the virtual environment, add it to `uv.lock`, and update the
57
+ `dependencies` section of [`pyproject.toml`](pyproject.toml).
58
+
59
+ ```bash
60
+ uv add <package-name>
61
+ ```
62
+
63
+ To add a dependency to a specific group (adding a dev dependency, for example),
64
+ use the `--group` flag:
65
+
66
+ ```bash
67
+ uv add <package-name> --group dev
68
+ ```
@@ -0,0 +1,66 @@
1
+ [project]
2
+ name = 'pyprefab'
3
+ description = 'Python application template for personal use'
4
+ license = {text = 'MIT License'}
5
+ readme = 'README.md'
6
+ requires-python = '>=3.9'
7
+ classifiers = [
8
+ 'Programming Language :: Python :: 3',
9
+ 'License :: OSI Approved :: MIT License',
10
+ ]
11
+ dynamic = ['version']
12
+
13
+ dependencies = [
14
+ 'structlog',
15
+ 'rich',
16
+ ]
17
+
18
+ [dependency-groups]
19
+ dev = [
20
+ 'coverage',
21
+ 'freezegun',
22
+ 'mypy',
23
+ 'pre-commit',
24
+ 'pytest',
25
+ "pytest-random-order>=1.1.1",
26
+ 'ruff',
27
+ ]
28
+
29
+ [project.urls]
30
+ Repository = "https://github.com/bsweger/pyprefab.git"
31
+
32
+ [project.entry-points.'console_scripts']
33
+ hello_world = 'hello_world.app:main'
34
+
35
+ [build-system]
36
+ # Minimum requirements for the build system to execute.
37
+ requires = ['setuptools', 'wheel', "setuptools_scm>=8"]
38
+ build-backend = "setuptools.build_meta"
39
+
40
+ [tool.setuptools.packages.find]
41
+ namespaces = true
42
+ where = ["src"]
43
+
44
+ [tool.setuptools_scm]
45
+ local_scheme = "no-local-version"
46
+
47
+ [tool.hello_world]
48
+ # to write json-formatted logs to disk, uncomment the following line specify the file location
49
+ # log_file = '/path/to/logs/files/hello_world.log'
50
+
51
+ [tool.pytest.ini_options]
52
+ addopts = "--random-order"
53
+ tmp_path_retention_policy = "none"
54
+ testpaths = [
55
+ "tests",
56
+ ]
57
+
58
+ [tool.ruff]
59
+ line-length = 120
60
+ lint.extend-select = ['I', 'Q']
61
+
62
+ [tool.ruff.lint.flake8-quotes]
63
+ inline-quotes = 'single'
64
+
65
+ [tool.ruff.format]
66
+ quote-style = 'single'
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = '0.0.3'
@@ -0,0 +1,20 @@
1
+ import structlog
2
+
3
+ from hello_world.util.date import get_current_date
4
+ from hello_world.util.logs import setup_logging
5
+
6
+ setup_logging()
7
+ logger = structlog.get_logger()
8
+
9
+
10
+ def main():
11
+ """Application entry point."""
12
+
13
+ today = get_current_date()
14
+ logger.info('retrieved the date', date=today)
15
+
16
+ return f'Hello, today is {today}!'
17
+
18
+
19
+ if __name__ == '__main__':
20
+ main()
File without changes
@@ -0,0 +1,15 @@
1
+ import datetime
2
+
3
+ import structlog
4
+
5
+ logger = structlog.get_logger()
6
+
7
+
8
+ def get_current_date() -> str:
9
+ """Return current date in human-readable format."""
10
+
11
+ logger.info('getting the current date')
12
+ current_date = datetime.datetime.now()
13
+ formatted_date = current_date.strftime('%B %d, %Y')
14
+
15
+ return formatted_date