pyprefab 0.2.0__py3-none-any.whl

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 @@
1
+ __version__ = '0.0.3'
hello_world/app.py ADDED
@@ -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
@@ -0,0 +1,41 @@
1
+ import sys
2
+
3
+ import structlog
4
+
5
+ import hello_world
6
+
7
+
8
+ def add_custom_info(logger, method_name, event_dict):
9
+ event_dict['version'] = hello_world.__version__
10
+ return event_dict
11
+
12
+
13
+ def setup_logging():
14
+ shared_processors = [
15
+ add_custom_info,
16
+ structlog.processors.TimeStamper(fmt='iso'),
17
+ structlog.processors.add_log_level,
18
+ structlog.processors.CallsiteParameterAdder(
19
+ [
20
+ structlog.processors.CallsiteParameter.FILENAME,
21
+ structlog.processors.CallsiteParameter.FUNC_NAME,
22
+ ]
23
+ ),
24
+ ]
25
+
26
+ if sys.stderr.isatty():
27
+ # If we're in a terminal, pretty print the logs.
28
+ processors = shared_processors + [
29
+ structlog.dev.ConsoleRenderer(),
30
+ ]
31
+ else:
32
+ # Otherwise, output logs in JSON format
33
+ processors = shared_processors + [
34
+ structlog.processors.dict_tracebacks,
35
+ structlog.processors.JSONRenderer(),
36
+ ]
37
+
38
+ structlog.configure(
39
+ processors=processors,
40
+ cache_logger_on_first_use=True,
41
+ )
@@ -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,11 @@
1
+ hello_world/__init__.py,sha256=yyLtGsBhynC-sSHdax-rRGvHNjH-gdWxIY68WnPVfDw,22
2
+ hello_world/app.py,sha256=b2g8sI5oxPZzh47JY3Vxiirg8ZxcMuuiJNJkI84umLo,377
3
+ hello_world/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ hello_world/util/date.py,sha256=wQTb-vtB4xxBGg0C9nlbwd23OcfLRw1pZsIi5QKm5Uw,327
5
+ hello_world/util/logs.py,sha256=wsLzyedm_jNKT917kPnWjaVNx0JJIAeIsH49hZMik9s,1076
6
+ pyprefab-0.2.0.dist-info/LICENSE,sha256=Is9RG0xG5jLBaEjfwOYJvkwUYhH7SYdNKaIHtwwk8hk,1068
7
+ pyprefab-0.2.0.dist-info/METADATA,sha256=d2A6GDUIwvuRlMBv_AHj1C1pRRsg9tTwbnBms6Ad7sk,2062
8
+ pyprefab-0.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
9
+ pyprefab-0.2.0.dist-info/entry_points.txt,sha256=XIZcyRINylRXwE_TGh-BzJBrQ2nl0plC0dhWBSJXHKw,53
10
+ pyprefab-0.2.0.dist-info/top_level.txt,sha256=vY8b2A8Sa2-5PUXRoDjDABQ-zMBnaxTqNarDpG9ub2s,12
11
+ pyprefab-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hello_world = hello_world.app:main
@@ -0,0 +1 @@
1
+ hello_world