boilerplates 1.2.0.dev2__tar.gz → 1.2.0.dev3__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.
- {boilerplates-1.2.0.dev2/boilerplates.egg-info → boilerplates-1.2.0.dev3}/PKG-INFO +8 -11
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/packaging_tests.py +22 -14
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/sentry.py +28 -13
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3/boilerplates.egg-info}/PKG-INFO +8 -11
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates.egg-info/requires.txt +1 -4
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/pyproject.toml +3 -2
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_packaging_tests.txt +1 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_setup.txt +0 -2
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_test.txt +0 -1
- boilerplates-1.2.0.dev3/test/test_sentry.py +62 -0
- boilerplates-1.2.0.dev2/test/test_sentry.py +0 -36
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/LICENSE +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/MANIFEST.in +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/NOTICE +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/README.rst +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/__init__.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/__init__.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/git_query.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/parser.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/patterns.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/py.typed +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/py_query.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/query.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/version.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/cli.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/config.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/git_repo_tests.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/logging.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/py.typed +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/setup.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates.egg-info/SOURCES.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates.egg-info/dependency_links.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates.egg-info/top_level.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_cli.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_config.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_git_repo_tests.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_logging.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/requirements_sentry.txt +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/setup.cfg +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/setup.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/__init__.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/test_cli.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/test_config.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/test_git_repo.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/test_logging.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/test_packaging.py +0 -0
- {boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/test/test_setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: boilerplates
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev3
|
|
4
4
|
Summary: Various boilerplates used in almost all of my Python packages.
|
|
5
5
|
Home-page: https://github.com/mbdevpl/python-boilerplates
|
|
6
6
|
Download-URL:
|
|
@@ -8,7 +8,7 @@ Author: Mateusz Bysiek, Stian Hanssen
|
|
|
8
8
|
Author-email: mateusz.bysiek@gmail.com
|
|
9
9
|
Maintainer: Mateusz Bysiek
|
|
10
10
|
Maintainer-email: mateusz.bysiek@gmail.com
|
|
11
|
-
License
|
|
11
|
+
License: Apache License 2.0
|
|
12
12
|
Keywords: git,logging,packaging,releasing
|
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
@@ -33,17 +33,14 @@ Description-Content-Type: text/x-rst; charset=UTF-8
|
|
|
33
33
|
License-File: LICENSE
|
|
34
34
|
License-File: NOTICE
|
|
35
35
|
Provides-Extra: setup
|
|
36
|
-
Requires-Dist: build~=1.2; extra == "setup"
|
|
37
36
|
Requires-Dist: docutils~=0.20; extra == "setup"
|
|
38
37
|
Requires-Dist: Pygments~=2.14; extra == "setup"
|
|
39
38
|
Requires-Dist: setuptools>=77.0.3; extra == "setup"
|
|
40
|
-
Requires-Dist: version-query~=1.6; extra == "setup"
|
|
41
39
|
Provides-Extra: packaging-tests
|
|
42
|
-
Requires-Dist: build~=1.2; extra == "packaging-tests"
|
|
43
40
|
Requires-Dist: docutils~=0.20; extra == "packaging-tests"
|
|
44
41
|
Requires-Dist: Pygments~=2.14; extra == "packaging-tests"
|
|
45
42
|
Requires-Dist: setuptools>=77.0.3; extra == "packaging-tests"
|
|
46
|
-
Requires-Dist:
|
|
43
|
+
Requires-Dist: build~=1.2; extra == "packaging-tests"
|
|
47
44
|
Requires-Dist: pip>=24.0; extra == "packaging-tests"
|
|
48
45
|
Requires-Dist: wheel>=0.43; extra == "packaging-tests"
|
|
49
46
|
Provides-Extra: config
|
|
@@ -62,8 +59,8 @@ Dynamic: description
|
|
|
62
59
|
Dynamic: description-content-type
|
|
63
60
|
Dynamic: home-page
|
|
64
61
|
Dynamic: keywords
|
|
62
|
+
Dynamic: license
|
|
65
63
|
Dynamic: license-file
|
|
66
|
-
Dynamic: license-expression
|
|
67
64
|
Dynamic: maintainer
|
|
68
65
|
Dynamic: maintainer-email
|
|
69
66
|
Dynamic: provides-extra
|
|
@@ -99,7 +96,7 @@ Various boilerplates used in almost all of my Python packages.
|
|
|
99
96
|
:alt: grade from Codacy
|
|
100
97
|
|
|
101
98
|
.. image:: https://img.shields.io/github/license/mbdevpl/python-boilerplates.svg
|
|
102
|
-
:target: https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
99
|
+
:target: https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/NOTICE
|
|
103
100
|
:alt: license
|
|
104
101
|
|
|
105
102
|
This package includes boilerplates for various common tasks in Python packages, such as building
|
|
@@ -114,9 +111,9 @@ Requirements
|
|
|
114
111
|
|
|
115
112
|
Python version 3.9 or later.
|
|
116
113
|
|
|
117
|
-
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
114
|
+
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/requirements.txt>`_.
|
|
118
115
|
|
|
119
|
-
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
116
|
+
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/requirements_test.txt>`_.
|
|
120
117
|
|
|
121
118
|
Tested on Linux, macOS and Windows.
|
|
122
119
|
|
|
@@ -399,7 +396,7 @@ Your example ``cli.py`` file which defines your command-line interface may look
|
|
|
399
396
|
verbosity = boilerplates.cli.get_verbosity_level(parsed_args)
|
|
400
397
|
...
|
|
401
398
|
|
|
402
|
-
You can see the above example in action in the `examples.ipynb <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
399
|
+
You can see the above example in action in the `examples.ipynb <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/examples.ipynb>`_ notebook.
|
|
403
400
|
Please see the ``boilerplates.cli`` module for details of the available features.
|
|
404
401
|
|
|
405
402
|
And then, an example ``__main__.py`` file may look like:
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""Test definitions for package building."""
|
|
2
2
|
|
|
3
|
+
import contextlib
|
|
3
4
|
import importlib
|
|
5
|
+
import io
|
|
4
6
|
import logging
|
|
5
7
|
import os
|
|
6
8
|
import pathlib
|
|
@@ -100,43 +102,49 @@ class PackagingTests(unittest.TestCase):
|
|
|
100
102
|
expanded_args = expand_args_by_globbing_items('*.py', cwd=pathlib.Path(self.pkg_name))
|
|
101
103
|
self.assertIn('__init__.py', expanded_args)
|
|
102
104
|
|
|
105
|
+
def test_setup_help(self):
|
|
106
|
+
stdout_buffer = io.StringIO()
|
|
107
|
+
with contextlib.redirect_stdout(stdout_buffer):
|
|
108
|
+
run_module('setup', '--help')
|
|
109
|
+
self.assertIn('usage: setup.py', stdout_buffer.getvalue())
|
|
110
|
+
|
|
103
111
|
def test_build(self):
|
|
104
112
|
run_program(sys.executable, '-m', 'build')
|
|
105
113
|
self.assertTrue(os.path.isdir('dist'))
|
|
106
114
|
|
|
107
|
-
def
|
|
108
|
-
run_module('
|
|
115
|
+
def test_build_wheel(self):
|
|
116
|
+
run_module('build', '--wheel')
|
|
109
117
|
self.assertTrue(os.path.isdir('dist'))
|
|
110
118
|
|
|
111
|
-
def
|
|
112
|
-
run_module('
|
|
119
|
+
def test_build_wheel_no_isolation(self):
|
|
120
|
+
run_module('build', '--wheel', '--no-isolation')
|
|
113
121
|
self.assertTrue(os.path.isdir('dist'))
|
|
114
122
|
|
|
115
123
|
def test_build_source(self):
|
|
116
|
-
run_module('
|
|
124
|
+
run_module('build', '--sdist')
|
|
125
|
+
self.assertTrue(os.path.isdir('dist'))
|
|
126
|
+
|
|
127
|
+
def test_build_source_no_isolation(self):
|
|
128
|
+
run_module('build', '--sdist', '--no-isolation')
|
|
117
129
|
self.assertTrue(os.path.isdir('dist'))
|
|
118
130
|
|
|
119
131
|
def test_install_code(self):
|
|
120
132
|
with tempfile.TemporaryDirectory() as temporary_folder:
|
|
121
|
-
run_pip('install', '--prefix', temporary_folder, '.')
|
|
133
|
+
run_pip('install', '--ignore-installed', '--prefix', temporary_folder, '.')
|
|
122
134
|
self.assertFalse(pathlib.Path(temporary_folder).exists())
|
|
123
135
|
|
|
124
136
|
def test_install_source_tar(self):
|
|
125
137
|
with tempfile.TemporaryDirectory() as temporary_folder:
|
|
126
138
|
run_pip(
|
|
127
|
-
'install', '--
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def test_install_source_zip(self):
|
|
131
|
-
with tempfile.TemporaryDirectory() as temporary_folder:
|
|
132
|
-
run_pip(
|
|
133
|
-
'install', '--prefix', temporary_folder, f'dist/*-{self.version}.zip', glob=True)
|
|
139
|
+
'install', '--ignore-installed', '--prefix', temporary_folder,
|
|
140
|
+
f'dist/*-{self.version}.tar.gz', glob=True)
|
|
134
141
|
self.assertFalse(pathlib.Path(temporary_folder).exists())
|
|
135
142
|
|
|
136
143
|
def test_install_wheel(self):
|
|
137
144
|
with tempfile.TemporaryDirectory() as temporary_folder:
|
|
138
145
|
run_pip(
|
|
139
|
-
'install', '--
|
|
146
|
+
'install', '--ignore-installed', '--prefix', temporary_folder,
|
|
147
|
+
f'dist/*-{self.version}-*.whl', glob=True)
|
|
140
148
|
self.assertFalse(pathlib.Path(temporary_folder).exists())
|
|
141
149
|
|
|
142
150
|
def test_pip_error(self):
|
|
@@ -20,11 +20,11 @@ _LOG = logging.getLogger(__name__)
|
|
|
20
20
|
class Sentry:
|
|
21
21
|
"""Sentry configuration.
|
|
22
22
|
|
|
23
|
-
For parameters 'dsn', 'release'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
For
|
|
23
|
+
For parameters 'dsn', 'release', 'environment', 'default_integrations', 'debug',
|
|
24
|
+
'attach_stacktrace', 'shutdown_timeout', 'traces_sample_rate' and 'profiles_sample_rate'
|
|
25
|
+
the value is taken from the environment variable if it is set,
|
|
26
|
+
otherwise from the class attribute if it is set.
|
|
27
|
+
For those parameters, the expected name of the environment variable name is 'SENTRY_'
|
|
28
28
|
followed by the parameter name in upper case.
|
|
29
29
|
|
|
30
30
|
The class attribute tags, if set, will be added to the global scope of the
|
|
@@ -56,7 +56,7 @@ class Sentry:
|
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
58
|
default_integrations: bool = True
|
|
59
|
-
"""If
|
|
59
|
+
"""If True, enable Sentry's default integrations besides the ones set via 'integrations'."""
|
|
60
60
|
|
|
61
61
|
debug: bool = False
|
|
62
62
|
"""If True, enable debug mode for the Sentry SDK."""
|
|
@@ -91,6 +91,21 @@ class Sentry:
|
|
|
91
91
|
assert param_name in ('dsn', 'release', 'environment'), param_name
|
|
92
92
|
return os.environ.get(f'SENTRY_{param_name.upper()}', getattr(cls, param_name, None))
|
|
93
93
|
|
|
94
|
+
@classmethod
|
|
95
|
+
def _get_float_param(cls, param_name: str) -> float:
|
|
96
|
+
assert param_name in (
|
|
97
|
+
'shutdown_timeout', 'traces_sample_rate', 'profiles_sample_rate'), param_name
|
|
98
|
+
if f'SENTRY_{param_name.upper()}' in os.environ:
|
|
99
|
+
return float(os.environ[f'SENTRY_{param_name.upper()}'])
|
|
100
|
+
return getattr(cls, param_name)
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def _get_bool_param(cls, param_name: str) -> bool:
|
|
104
|
+
assert param_name in ('default_integrations', 'debug', 'attach_stacktrace'), param_name
|
|
105
|
+
if f'SENTRY_{param_name.upper()}' in os.environ:
|
|
106
|
+
return os.environ[f'SENTRY_{param_name.upper()}'].lower() in {'true', 'yes', 'on', '1'}
|
|
107
|
+
return getattr(cls, param_name)
|
|
108
|
+
|
|
94
109
|
@classmethod
|
|
95
110
|
def is_dsn_set(cls) -> bool:
|
|
96
111
|
"""Check if Sentry DSN parameter is set, thus if Sentry SDK should be initialised or not."""
|
|
@@ -108,14 +123,14 @@ class Sentry:
|
|
|
108
123
|
release=cls._get_str_param('release'),
|
|
109
124
|
environment=cls._get_str_param('environment'),
|
|
110
125
|
integrations=cls.integrations,
|
|
111
|
-
traces_sample_rate=cls.traces_sample_rate,
|
|
112
|
-
profiles_sample_rate=cls.profiles_sample_rate,
|
|
113
|
-
enable_tracing=cls.profiles_sample_rate > 0,
|
|
114
|
-
debug=cls.debug,
|
|
115
|
-
attach_stacktrace=cls.attach_stacktrace,
|
|
116
|
-
shutdown_timeout=cls.shutdown_timeout,
|
|
126
|
+
traces_sample_rate=cls._get_float_param('traces_sample_rate'),
|
|
127
|
+
profiles_sample_rate=cls._get_float_param('profiles_sample_rate'),
|
|
128
|
+
enable_tracing=cls._get_float_param('profiles_sample_rate') > 0,
|
|
129
|
+
debug=cls._get_bool_param('debug'),
|
|
130
|
+
attach_stacktrace=cls._get_bool_param('attach_stacktrace'),
|
|
131
|
+
shutdown_timeout=cls._get_float_param('shutdown_timeout'),
|
|
117
132
|
send_default_pii=cls.send_default_pii,
|
|
118
|
-
default_integrations=cls.default_integrations,
|
|
133
|
+
default_integrations=cls._get_bool_param('default_integrations'),
|
|
119
134
|
**kwargs)
|
|
120
135
|
|
|
121
136
|
sentry_sdk.set_tags(cls.tags)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: boilerplates
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev3
|
|
4
4
|
Summary: Various boilerplates used in almost all of my Python packages.
|
|
5
5
|
Home-page: https://github.com/mbdevpl/python-boilerplates
|
|
6
6
|
Download-URL:
|
|
@@ -8,7 +8,7 @@ Author: Mateusz Bysiek, Stian Hanssen
|
|
|
8
8
|
Author-email: mateusz.bysiek@gmail.com
|
|
9
9
|
Maintainer: Mateusz Bysiek
|
|
10
10
|
Maintainer-email: mateusz.bysiek@gmail.com
|
|
11
|
-
License
|
|
11
|
+
License: Apache License 2.0
|
|
12
12
|
Keywords: git,logging,packaging,releasing
|
|
13
13
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
@@ -33,17 +33,14 @@ Description-Content-Type: text/x-rst; charset=UTF-8
|
|
|
33
33
|
License-File: LICENSE
|
|
34
34
|
License-File: NOTICE
|
|
35
35
|
Provides-Extra: setup
|
|
36
|
-
Requires-Dist: build~=1.2; extra == "setup"
|
|
37
36
|
Requires-Dist: docutils~=0.20; extra == "setup"
|
|
38
37
|
Requires-Dist: Pygments~=2.14; extra == "setup"
|
|
39
38
|
Requires-Dist: setuptools>=77.0.3; extra == "setup"
|
|
40
|
-
Requires-Dist: version-query~=1.6; extra == "setup"
|
|
41
39
|
Provides-Extra: packaging-tests
|
|
42
|
-
Requires-Dist: build~=1.2; extra == "packaging-tests"
|
|
43
40
|
Requires-Dist: docutils~=0.20; extra == "packaging-tests"
|
|
44
41
|
Requires-Dist: Pygments~=2.14; extra == "packaging-tests"
|
|
45
42
|
Requires-Dist: setuptools>=77.0.3; extra == "packaging-tests"
|
|
46
|
-
Requires-Dist:
|
|
43
|
+
Requires-Dist: build~=1.2; extra == "packaging-tests"
|
|
47
44
|
Requires-Dist: pip>=24.0; extra == "packaging-tests"
|
|
48
45
|
Requires-Dist: wheel>=0.43; extra == "packaging-tests"
|
|
49
46
|
Provides-Extra: config
|
|
@@ -62,8 +59,8 @@ Dynamic: description
|
|
|
62
59
|
Dynamic: description-content-type
|
|
63
60
|
Dynamic: home-page
|
|
64
61
|
Dynamic: keywords
|
|
62
|
+
Dynamic: license
|
|
65
63
|
Dynamic: license-file
|
|
66
|
-
Dynamic: license-expression
|
|
67
64
|
Dynamic: maintainer
|
|
68
65
|
Dynamic: maintainer-email
|
|
69
66
|
Dynamic: provides-extra
|
|
@@ -99,7 +96,7 @@ Various boilerplates used in almost all of my Python packages.
|
|
|
99
96
|
:alt: grade from Codacy
|
|
100
97
|
|
|
101
98
|
.. image:: https://img.shields.io/github/license/mbdevpl/python-boilerplates.svg
|
|
102
|
-
:target: https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
99
|
+
:target: https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/NOTICE
|
|
103
100
|
:alt: license
|
|
104
101
|
|
|
105
102
|
This package includes boilerplates for various common tasks in Python packages, such as building
|
|
@@ -114,9 +111,9 @@ Requirements
|
|
|
114
111
|
|
|
115
112
|
Python version 3.9 or later.
|
|
116
113
|
|
|
117
|
-
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
114
|
+
Python libraries as specified in `requirements.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/requirements.txt>`_.
|
|
118
115
|
|
|
119
|
-
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
116
|
+
Building and running tests additionally requires packages listed in `requirements_test.txt <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/requirements_test.txt>`_.
|
|
120
117
|
|
|
121
118
|
Tested on Linux, macOS and Windows.
|
|
122
119
|
|
|
@@ -399,7 +396,7 @@ Your example ``cli.py`` file which defines your command-line interface may look
|
|
|
399
396
|
verbosity = boilerplates.cli.get_verbosity_level(parsed_args)
|
|
400
397
|
...
|
|
401
398
|
|
|
402
|
-
You can see the above example in action in the `examples.ipynb <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.
|
|
399
|
+
You can see the above example in action in the `examples.ipynb <https://github.com/mbdevpl/python-boilerplates/blob/v1.2.0.dev3/examples.ipynb>`_ notebook.
|
|
403
400
|
Please see the ``boilerplates.cli`` module for details of the available features.
|
|
404
401
|
|
|
405
402
|
And then, an example ``__main__.py`` file may look like:
|
|
@@ -11,11 +11,10 @@ GitPython~=3.1
|
|
|
11
11
|
colorlog~=6.7
|
|
12
12
|
|
|
13
13
|
[packaging-tests]
|
|
14
|
-
build~=1.2
|
|
15
14
|
docutils~=0.20
|
|
16
15
|
Pygments~=2.14
|
|
17
16
|
setuptools>=77.0.3
|
|
18
|
-
|
|
17
|
+
build~=1.2
|
|
19
18
|
pip>=24.0
|
|
20
19
|
wheel>=0.43
|
|
21
20
|
|
|
@@ -23,8 +22,6 @@ wheel>=0.43
|
|
|
23
22
|
sentry-sdk[pure_eval]~=2.5
|
|
24
23
|
|
|
25
24
|
[setup]
|
|
26
|
-
build~=1.2
|
|
27
25
|
docutils~=0.20
|
|
28
26
|
Pygments~=2.14
|
|
29
27
|
setuptools>=77.0.3
|
|
30
|
-
version-query~=1.6
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
+
build-backend = 'setuptools.build_meta'
|
|
2
3
|
requires = [
|
|
3
|
-
'
|
|
4
|
+
'boilerplates[setup] ~= 1.1, >= 1.1.4',
|
|
4
5
|
'docutils ~= 0.20',
|
|
5
6
|
'GitPython ~= 3.1',
|
|
6
7
|
'packaging >= 24.0',
|
|
7
8
|
'Pygments ~= 2.14',
|
|
8
9
|
'semver >= 2.13, < 3.1',
|
|
9
|
-
'setuptools >=
|
|
10
|
+
'setuptools >= 70.0.3'
|
|
10
11
|
]
|
|
11
12
|
|
|
12
13
|
[tool.flake8]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Unit tests for Sentry boilerplate."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
import unittest
|
|
6
|
+
import unittest.mock
|
|
7
|
+
|
|
8
|
+
import boilerplates.sentry
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SentryTests(unittest.TestCase):
|
|
12
|
+
|
|
13
|
+
def test_init(self):
|
|
14
|
+
with self.assertLogs('boilerplates.sentry', logging.INFO) as context:
|
|
15
|
+
boilerplates.sentry.Sentry.init()
|
|
16
|
+
self.assertEqual(len(context.output), 1, msg=context.output)
|
|
17
|
+
self.assertIn('skipping Sentry SDK initialisation', context.output[0])
|
|
18
|
+
|
|
19
|
+
def test_init_without_dsn(self):
|
|
20
|
+
class Sentry(boilerplates.sentry.Sentry):
|
|
21
|
+
dsn = ''
|
|
22
|
+
with self.assertLogs('boilerplates.sentry', logging.INFO) as context, \
|
|
23
|
+
unittest.mock.patch('sentry_sdk.init') as sentry_sdk_init_mock:
|
|
24
|
+
Sentry.init()
|
|
25
|
+
sentry_sdk_init_mock.assert_not_called()
|
|
26
|
+
self.assertEqual(len(context.output), 1, msg=context.output)
|
|
27
|
+
self.assertIn('skipping Sentry SDK initialisation', context.output[0])
|
|
28
|
+
|
|
29
|
+
@unittest.skipUnless(sys.version_info >= (3, 10), 'this test requires Python 3.10')
|
|
30
|
+
def test_init_with_dsn(self):
|
|
31
|
+
class Sentry(boilerplates.sentry.Sentry):
|
|
32
|
+
dsn = 'https://spam@ham.ingest.sentry.io/eggs'
|
|
33
|
+
with self.assertNoLogs('boilerplates.sentry', logging.INFO), \
|
|
34
|
+
unittest.mock.patch('sentry_sdk.init') as sentry_sdk_init_mock:
|
|
35
|
+
Sentry.init()
|
|
36
|
+
sentry_sdk_init_mock.assert_called_once()
|
|
37
|
+
|
|
38
|
+
@unittest.skipUnless(sys.version_info >= (3, 10), 'this test requires Python 3.10')
|
|
39
|
+
def test_init_with_envvar(self):
|
|
40
|
+
class Sentry(boilerplates.sentry.Sentry):
|
|
41
|
+
pass
|
|
42
|
+
environ_override = {'SENTRY_DSN': 'https://spam@ham.ingest.sentry.io/eggs'}
|
|
43
|
+
with unittest.mock.patch.dict('os.environ', environ_override), \
|
|
44
|
+
self.assertNoLogs('boilerplates.sentry', logging.INFO), \
|
|
45
|
+
unittest.mock.patch('sentry_sdk.init') as sentry_sdk_init_mock:
|
|
46
|
+
Sentry.init()
|
|
47
|
+
sentry_sdk_init_mock.assert_called_once()
|
|
48
|
+
|
|
49
|
+
@unittest.skipUnless(sys.version_info >= (3, 10), 'this test requires Python 3.10')
|
|
50
|
+
def test_configure_with_envvars(self):
|
|
51
|
+
class Sentry(boilerplates.sentry.Sentry):
|
|
52
|
+
dsn = 'https://spam@ham.ingest.sentry.io/eggs'
|
|
53
|
+
environ_override = {'SENTRY_PROFILES_SAMPLE_RATE': '0.42', 'SENTRY_DEBUG': 'True'}
|
|
54
|
+
with unittest.mock.patch.dict('os.environ', environ_override), \
|
|
55
|
+
self.assertNoLogs('boilerplates.sentry', logging.INFO), \
|
|
56
|
+
unittest.mock.patch('sentry_sdk.init') as sentry_sdk_init_mock:
|
|
57
|
+
Sentry.init()
|
|
58
|
+
sentry_sdk_init_mock.assert_called_once()
|
|
59
|
+
self.assertIn('profiles_sample_rate', sentry_sdk_init_mock.call_args.kwargs)
|
|
60
|
+
self.assertEqual(sentry_sdk_init_mock.call_args.kwargs['profiles_sample_rate'], 0.42)
|
|
61
|
+
self.assertIn('debug', sentry_sdk_init_mock.call_args.kwargs)
|
|
62
|
+
self.assertTrue(sentry_sdk_init_mock.call_args.kwargs['debug'], 0.42)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"""Unit tests for Sentry boilerplate."""
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
import sys
|
|
5
|
-
import unittest
|
|
6
|
-
import unittest.mock
|
|
7
|
-
|
|
8
|
-
import boilerplates.sentry
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class SentryTests(unittest.TestCase):
|
|
12
|
-
|
|
13
|
-
def test_init(self):
|
|
14
|
-
with self.assertLogs('boilerplates.sentry', logging.INFO) as context:
|
|
15
|
-
boilerplates.sentry.Sentry.init()
|
|
16
|
-
self.assertEqual(len(context.output), 1, msg=context.output)
|
|
17
|
-
self.assertIn('skipping Sentry SDK initialisation', context.output[0])
|
|
18
|
-
|
|
19
|
-
def test_init_without_dsn(self):
|
|
20
|
-
class Sentry(boilerplates.sentry.Sentry):
|
|
21
|
-
dsn = ''
|
|
22
|
-
with self.assertLogs('boilerplates.sentry', logging.INFO) as context, \
|
|
23
|
-
unittest.mock.patch('sentry_sdk.init') as sentry_sdk_init_mock:
|
|
24
|
-
Sentry.init()
|
|
25
|
-
sentry_sdk_init_mock.assert_not_called()
|
|
26
|
-
self.assertEqual(len(context.output), 1, msg=context.output)
|
|
27
|
-
self.assertIn('skipping Sentry SDK initialisation', context.output[0])
|
|
28
|
-
|
|
29
|
-
@unittest.skipUnless(sys.version_info >= (3, 10), 'this test requires Python 3.10')
|
|
30
|
-
def test_init_with_dsn(self):
|
|
31
|
-
class Sentry(boilerplates.sentry.Sentry):
|
|
32
|
-
dsn = 'https://spam@ham.ingest.sentry.io/eggs'
|
|
33
|
-
with self.assertNoLogs('boilerplates.sentry', logging.INFO), \
|
|
34
|
-
unittest.mock.patch('sentry_sdk.init') as sentry_sdk_init_mock:
|
|
35
|
-
Sentry.init()
|
|
36
|
-
sentry_sdk_init_mock.assert_called_once()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/__init__.py
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/git_query.py
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/parser.py
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/patterns.py
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/py.typed
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/py_query.py
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/query.py
RENAMED
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates/bundled_version_query/version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boilerplates-1.2.0.dev2 → boilerplates-1.2.0.dev3}/boilerplates.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|