laminprofiler 0.0.2__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,37 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main, staging]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ GITHUB_EVENT_NAME: ${{ github.event_name }}
14
+ GITHUB_TOKEN: ${{ secrets.LAMIN_BUILD_DOCS }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ include:
19
+ - os: ubuntu-latest
20
+ python: "3.12"
21
+ timeout-minutes: 15
22
+
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python }}
30
+ - run: pip install git+https://github.com/laminlabs/laminci
31
+ - uses: actions/cache@v4
32
+ with:
33
+ path: ~/.cache/pre-commit
34
+ key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
35
+ - run: nox -s lint
36
+ - run: uv pip install --system -e .[dev]
37
+ - run: nox -s build
@@ -0,0 +1,108 @@
1
+ # macOS
2
+ .DS_Store
3
+ .AppleDouble
4
+ .LSOverride
5
+
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ env/
17
+ build/
18
+ develop-eggs/
19
+ dist/
20
+ downloads/
21
+ eggs/
22
+ .eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+
63
+ # Flask stuff:
64
+ instance/
65
+ .webassets-cache
66
+
67
+ # Scrapy stuff:
68
+ .scrapy
69
+
70
+ # Sphinx documentation
71
+ docs/_build/
72
+
73
+ # PyBuilder
74
+ target/
75
+
76
+ # Jupyter Notebook
77
+ .ipynb_checkpoints
78
+
79
+ # pyenv
80
+ .python-version
81
+
82
+ # celery beat schedule file
83
+ celerybeat-schedule
84
+
85
+ # SageMath parsed files
86
+ *.sage.py
87
+
88
+ # dotenv
89
+ .env
90
+
91
+ # virtualenv
92
+ .venv
93
+ venv/
94
+ ENV/
95
+
96
+ # mypy
97
+ .mypy_cache/
98
+
99
+ # IDE settings
100
+ .vscode/
101
+ .idea/
102
+
103
+ # Lamin
104
+ _build
105
+ docs/ghcontribs.*
106
+ lamin_sphinx
107
+ docs/conf.py
108
+ _docs_tmp*
@@ -0,0 +1,50 @@
1
+ fail_fast: false
2
+ default_language_version:
3
+ python: python3
4
+ default_stages:
5
+ - commit
6
+ minimum_pre_commit_version: 3.2.0
7
+ repos:
8
+ - repo: https://github.com/rbubley/mirrors-prettier
9
+ rev: v3.6.2
10
+ hooks:
11
+ - id: prettier
12
+ exclude: |
13
+ (?x)(
14
+ docs/changelog.md
15
+ )
16
+ - repo: https://github.com/kynan/nbstripout
17
+ rev: 0.6.1
18
+ hooks:
19
+ - id: nbstripout
20
+ exclude: |
21
+ (?x)(
22
+ docs/examples/|
23
+ docs/notes/
24
+ )
25
+ - repo: https://github.com/astral-sh/ruff-pre-commit
26
+ rev: v0.12.1
27
+ hooks:
28
+ - id: ruff-check
29
+ args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
30
+ - id: ruff-format
31
+ - repo: https://github.com/pre-commit/pre-commit-hooks
32
+ rev: v5.0.0
33
+ hooks:
34
+ - id: detect-private-key
35
+ - id: check-ast
36
+ - id: end-of-file-fixer
37
+ exclude: |
38
+ (?x)(
39
+ .github/workflows/latest-changes.jinja2
40
+ )
41
+ - id: mixed-line-ending
42
+ args: [--fix=lf]
43
+ - id: trailing-whitespace
44
+ - id: check-case-conflict
45
+ - repo: https://github.com/pre-commit/mirrors-mypy
46
+ rev: v1.16.1
47
+ hooks:
48
+ - id: mypy
49
+ args: [--no-strict-optional, --ignore-missing-imports]
50
+ additional_dependencies: ["types-requests", "types-attrs"]
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.3
2
+ Name: laminprofiler
3
+ Version: 0.0.2
4
+ Summary: Simple analytics for GitHub contributions across an organization.
5
+ Author-email: Lamin Labs <open-source@lamin.ai>
6
+ Requires-Python: >=3.10,<3.14
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: click
9
+ Requires-Dist: lamindb
10
+ Requires-Dist: pre-commit ; extra == "dev"
11
+ Requires-Dist: nox ; extra == "dev"
12
+ Requires-Dist: pytest>=6.0 ; extra == "dev"
13
+ Requires-Dist: pytest-cov ; extra == "dev"
14
+ Requires-Dist: nbproject_test ; extra == "dev"
15
+ Project-URL: Home, https://github.com/laminlabs/laminprofiler
16
+ Provides-Extra: dev
17
+
18
+ # laminprofiler: Profile scripts
19
+
@@ -0,0 +1 @@
1
+ # laminprofiler: Profile scripts
@@ -0,0 +1,33 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "7f26a335-cf1c-4e69-be3b-0c26b154606a",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Quickstart"
9
+ ]
10
+ }
11
+ ],
12
+ "metadata": {
13
+ "kernelspec": {
14
+ "display_name": "py312",
15
+ "language": "python",
16
+ "name": "python3"
17
+ },
18
+ "language_info": {
19
+ "codemirror_mode": {
20
+ "name": "ipython",
21
+ "version": 3
22
+ },
23
+ "file_extension": ".py",
24
+ "mimetype": "text/x-python",
25
+ "name": "python",
26
+ "nbconvert_exporter": "python",
27
+ "pygments_lexer": "ipython3",
28
+ "version": "3.12.8"
29
+ }
30
+ },
31
+ "nbformat": 4,
32
+ "nbformat_minor": 5
33
+ }
@@ -0,0 +1,3 @@
1
+ """Simple analytics for GitHub contributions across an organization."""
2
+
3
+ __version__ = "0.0.2" # denote a pre-release for 0.1.0 with 0.1rc1
@@ -0,0 +1,65 @@
1
+ import importlib
2
+ import re
3
+ from pathlib import Path
4
+
5
+ import click
6
+ import lamindb as ln
7
+
8
+
9
+ @click.group()
10
+ def main():
11
+ """LaminProfiler."""
12
+
13
+
14
+ @main.command("check")
15
+ @click.argument(
16
+ "script",
17
+ type=click.Path(path_type=Path, exists=True),
18
+ )
19
+ @click.option(
20
+ "--threshold",
21
+ default=None,
22
+ type=float,
23
+ help="Max allowed duration in seconds; exit 1 if exceeded. Omit to skip check.",
24
+ )
25
+ def check(script: Path, threshold: float | None) -> None:
26
+ script = script.resolve()
27
+ assert script.parent.name == "profiling"
28
+ assert script.parent.parent.name == "tests"
29
+ package_name = script.parent.parent.parent.name.replace("-", "_")
30
+ script_basename = script.name
31
+
32
+ module = importlib.import_module(package_name, package=".")
33
+ version = module.__version__
34
+
35
+ # Parse duration from pyinstrument text output
36
+ with open("profile.txt") as f:
37
+ content = f.read()
38
+ # Extract duration from line like: "Duration: 2.315 CPU time: 2.216"
39
+ match = re.search(r"Duration:\s+([\d.]+)", content)
40
+ duration = float(match.group(1)) if match else 1.0
41
+
42
+ print(content)
43
+ print(f"Extracted duration: {duration:.3f}s")
44
+ laminprofiler = ln.Record.get(name="LaminProfiler")
45
+ package = ln.Record.get(name=package_name, type=laminprofiler, is_type=True).save()
46
+ task = ln.Record.get(name=script_basename, type=package, is_type=True).save()
47
+ measurement = ln.Record(type=task).save()
48
+ measurement.features.add_values(
49
+ {
50
+ "package_version": version,
51
+ "duration_in_sec": duration,
52
+ }
53
+ )
54
+
55
+ if threshold is not None and duration > threshold:
56
+ print(
57
+ f"ERROR: Profiling time {duration:.3f}s exceeds threshold {threshold:.3f}s "
58
+ f"for script {script_basename}"
59
+ )
60
+ raise SystemExit(1)
61
+
62
+
63
+ if __name__ == "__main__":
64
+ assert ln.setup.settings.instance.slug == "laminlabs/lamindata"
65
+ main()
@@ -0,0 +1,18 @@
1
+ import nox
2
+ from laminci.nox import run_pre_commit, run_pytest
3
+
4
+ # we'd like to aggregate coverage information across sessions
5
+ # and for this the code needs to be located in the same
6
+ # directory in every github action runner
7
+ # this also allows to break out an installation section
8
+ nox.options.default_venv_backend = "none"
9
+
10
+
11
+ @nox.session
12
+ def lint(session: nox.Session) -> None:
13
+ run_pre_commit(session)
14
+
15
+
16
+ @nox.session()
17
+ def build(session):
18
+ run_pytest(session)
@@ -0,0 +1,143 @@
1
+ [build-system]
2
+ requires = ["flit_core >=3.2,<4"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [project]
6
+ name = "laminprofiler"
7
+ requires-python = ">=3.10,<3.14"
8
+ authors = [{name = "Lamin Labs", email = "open-source@lamin.ai"}]
9
+ readme = "README.md"
10
+ dynamic = ["version", "description"]
11
+ dependencies = [
12
+ "click",
13
+ "lamindb",
14
+ ]
15
+
16
+ [project.scripts]
17
+ laminprofiler = "laminprofiler.__main__:main"
18
+
19
+ [project.urls]
20
+ Home = "https://github.com/laminlabs/laminprofiler"
21
+
22
+ [project.optional-dependencies]
23
+ dev = [
24
+ "pre-commit",
25
+ "nox",
26
+ "pytest>=6.0",
27
+ "pytest-cov",
28
+ "nbproject_test",
29
+ ]
30
+
31
+ [tool.pytest.ini_options]
32
+ testpaths = [
33
+ "tests",
34
+ ]
35
+ filterwarnings = [
36
+ "ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning"
37
+ ]
38
+
39
+ [tool.ruff]
40
+ src = ["src"]
41
+ line-length = 88
42
+ lint.select = [
43
+ "F", # Errors detected by Pyflakes
44
+ "E", # Error detected by Pycodestyle
45
+ "W", # Warning detected by Pycodestyle
46
+ "I", # isort
47
+ "D", # pydocstyle
48
+ "B", # flake8-bugbear
49
+ "TID", # flake8-tidy-imports
50
+ "C4", # flake8-comprehensions
51
+ "BLE", # flake8-blind-except
52
+ "UP", # pyupgrade
53
+ "RUF100", # Report unused noqa directives
54
+ "TCH", # Typing imports
55
+ "NPY", # Numpy specific rules
56
+ "PTH", # Use pathlib
57
+ "S" # Security
58
+ ]
59
+ lint.ignore = [
60
+ # Do not catch blind exception: `Exception`
61
+ "BLE001",
62
+ # Errors from function calls in argument defaults. These are fine when the result is immutable.
63
+ "B008",
64
+ # line too long -> we accept long comment lines; black gets rid of long code lines
65
+ "E501",
66
+ # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
67
+ "E731",
68
+ # allow I, O, l as variable names -> I is the identity matrix
69
+ "E741",
70
+ # Missing docstring in public module
71
+ "D100",
72
+ # undocumented-public-class
73
+ "D101",
74
+ # Missing docstring in public method
75
+ "D102",
76
+ # Missing docstring in public function
77
+ "D103",
78
+ # Missing docstring in public package
79
+ "D104",
80
+ # __magic__ methods are are often self-explanatory, allow missing docstrings
81
+ "D105",
82
+ # Missing docstring in public nested class
83
+ "D106",
84
+ # Missing docstring in __init__
85
+ "D107",
86
+ ## Disable one in each pair of mutually incompatible rules
87
+ # We don’t want a blank line before a class docstring
88
+ "D203",
89
+ # 1 blank line required after class docstring
90
+ "D204",
91
+ # first line should end with a period [Bug: doesn't work with single-line docstrings]
92
+ # We want docstrings to start immediately after the opening triple quote
93
+ "D213",
94
+ # Section underline is over-indented ("{name}")
95
+ "D215",
96
+ # First line should end with a period
97
+ "D400",
98
+ # First line should be in imperative mood; try rephrasing
99
+ "D401",
100
+ # First word of the first line should be capitalized: {} -> {}
101
+ "D403",
102
+ # First word of the docstring should not be "This"
103
+ "D404",
104
+ # Section name should end with a newline ("{name}")
105
+ "D406",
106
+ # Missing dashed underline after section ("{name}")
107
+ "D407",
108
+ # Section underline should be in the line following the section's name ("{name}")
109
+ "D408",
110
+ # Section underline should match the length of its name ("{name}")
111
+ "D409",
112
+ # No blank lines allowed between a section header and its content ("{name}")
113
+ "D412",
114
+ # Missing blank line after last section ("{name}")
115
+ "D413",
116
+ # camcelcase imported as lowercase
117
+ "N813",
118
+ # module import not at top level of file
119
+ "E402",
120
+ # open()` should be replaced by `Path.open()
121
+ "PTH123",
122
+ # subprocess` call: check for execution of untrusted input - https://github.com/PyCQA/bandit/issues/333
123
+ "S603",
124
+ # Starting a process with a partial executable path
125
+ "S607",
126
+ # asserts
127
+ "S101"
128
+ ]
129
+
130
+ [tool.ruff.lint.pydocstyle]
131
+ convention = "google"
132
+
133
+ [tool.ruff.lint.per-file-ignores]
134
+ "docs/*" = ["I", "S101"]
135
+ "tests/**/*.py" = [
136
+ "D", # docstrings are allowed to look a bit off
137
+ "S101", # asserts allowed in tests...
138
+ "ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
139
+ "FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
140
+ "PLR2004", # Magic value used in comparison, ...
141
+ "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
142
+ ]
143
+ "*/__init__.py" = ["F401"]
@@ -0,0 +1,9 @@
1
+ from pathlib import Path
2
+
3
+ import nbproject_test as test
4
+
5
+
6
+ def test_notebooks():
7
+ docs_folder = Path(__file__).parents[1] / "docs/"
8
+ for check_folder in docs_folder.glob("./**"):
9
+ test.execute_notebooks(check_folder, write=True)