importtime-check 0.1.0a1__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.
- importtime_check-0.1.0a1/.gitignore +36 -0
- importtime_check-0.1.0a1/CONTRIBUTING.md +128 -0
- importtime_check-0.1.0a1/LICENSE +201 -0
- importtime_check-0.1.0a1/NOTICE +4 -0
- importtime_check-0.1.0a1/PKG-INFO +214 -0
- importtime_check-0.1.0a1/README.md +187 -0
- importtime_check-0.1.0a1/SECURITY.md +30 -0
- importtime_check-0.1.0a1/docs/design/0001-packaging-and-compatibility.md +225 -0
- importtime_check-0.1.0a1/docs/design/0002-quality-and-test-policy.md +341 -0
- importtime_check-0.1.0a1/docs/design/0003-contribution-governance-and-release-tracking.md +180 -0
- importtime_check-0.1.0a1/docs/design/0004-contributor-friendly-templates.md +108 -0
- importtime_check-0.1.0a1/docs/design/0005-parser-and-domain-model-contract.md +137 -0
- importtime_check-0.1.0a1/docs/design/0006-isolated-measurement-and-sampling.md +181 -0
- importtime_check-0.1.0a1/docs/design/0007-regression-and-integration-contract.md +291 -0
- importtime_check-0.1.0a1/docs/design/README.md +45 -0
- importtime_check-0.1.0a1/docs/releases/README.md +72 -0
- importtime_check-0.1.0a1/docs/releases/v0.1.0a1.md +45 -0
- importtime_check-0.1.0a1/pyproject.toml +139 -0
- importtime_check-0.1.0a1/src/importtime_check/__init__.py +68 -0
- importtime_check-0.1.0a1/src/importtime_check/_baseline.py +312 -0
- importtime_check-0.1.0a1/src/importtime_check/_cli.py +247 -0
- importtime_check-0.1.0a1/src/importtime_check/_measurement.py +258 -0
- importtime_check-0.1.0a1/src/importtime_check/_model.py +63 -0
- importtime_check-0.1.0a1/src/importtime_check/_parser.py +103 -0
- importtime_check-0.1.0a1/src/importtime_check/_regression.py +309 -0
- importtime_check-0.1.0a1/src/importtime_check/_report.py +125 -0
- importtime_check-0.1.0a1/src/importtime_check/_sampling.py +132 -0
- importtime_check-0.1.0a1/src/importtime_check/_version.py +17 -0
- importtime_check-0.1.0a1/src/importtime_check/py.typed +1 -0
- importtime_check-0.1.0a1/src/importtime_check/pytest_plugin.py +165 -0
- importtime_check-0.1.0a1/tests/test_artifact_validation.py +180 -0
- importtime_check-0.1.0a1/tests/test_baseline.py +287 -0
- importtime_check-0.1.0a1/tests/test_check_dco.py +86 -0
- importtime_check-0.1.0a1/tests/test_cli.py +216 -0
- importtime_check-0.1.0a1/tests/test_measurement.py +317 -0
- importtime_check-0.1.0a1/tests/test_package_contract.py +46 -0
- importtime_check-0.1.0a1/tests/test_parser.py +179 -0
- importtime_check-0.1.0a1/tests/test_pytest_plugin.py +385 -0
- importtime_check-0.1.0a1/tests/test_regression.py +470 -0
- importtime_check-0.1.0a1/tests/test_release_preflight.py +197 -0
- importtime_check-0.1.0a1/tests/test_report.py +142 -0
- importtime_check-0.1.0a1/tests/test_sampling.py +271 -0
- importtime_check-0.1.0a1/tools/__init__.py +15 -0
- importtime_check-0.1.0a1/tools/check_dco.py +113 -0
- importtime_check-0.1.0a1/tools/release_preflight.py +229 -0
- importtime_check-0.1.0a1/tools/smoke_wheel.py +190 -0
- importtime_check-0.1.0a1/tools/validate_artifacts.py +351 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Project working files
|
|
2
|
+
.tmp/
|
|
3
|
+
|
|
4
|
+
# Byte-compiled and optimized Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
ENV/
|
|
14
|
+
|
|
15
|
+
# Test, type-checking, lint, and coverage caches
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.mypy_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
.coverage
|
|
20
|
+
.coverage.*
|
|
21
|
+
coverage.xml
|
|
22
|
+
htmlcov/
|
|
23
|
+
|
|
24
|
+
# Packaging and build output
|
|
25
|
+
build/
|
|
26
|
+
dist/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.eggs/
|
|
29
|
+
pip-wheel-metadata/
|
|
30
|
+
*.whl
|
|
31
|
+
|
|
32
|
+
# Local editor and operating-system files
|
|
33
|
+
.idea/
|
|
34
|
+
.vscode/
|
|
35
|
+
.DS_Store
|
|
36
|
+
Thumbs.db
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributing to importtime-check
|
|
2
|
+
|
|
3
|
+
Thank you for helping improve `importtime-check`. Every change starts with an
|
|
4
|
+
issue created from an approved Issue Form. Blank issues and pull requests
|
|
5
|
+
without an open, same-repository issue are not accepted.
|
|
6
|
+
|
|
7
|
+
## Issues and planning
|
|
8
|
+
|
|
9
|
+
Choose the Bug report, Feature proposal, Design proposal, Maintenance task, or
|
|
10
|
+
Release checklist that best matches the work. The forms ask for the information
|
|
11
|
+
needed for that kind of contribution without forcing unrelated questions.
|
|
12
|
+
Reports containing secrets or suspected vulnerabilities must use the private
|
|
13
|
+
process in [SECURITY.md](SECURITY.md), never a public issue.
|
|
14
|
+
|
|
15
|
+
Maintainers assign implementation issues to a release milestone before a pull
|
|
16
|
+
request is opened. Milestones own release progress; labels classify the kind
|
|
17
|
+
of change. A project board may be introduced when concurrent work makes a
|
|
18
|
+
second planning view useful, but it is not another source of release truth.
|
|
19
|
+
|
|
20
|
+
Blank issues are disabled. Maintainers use review and normal triage to request
|
|
21
|
+
missing context; submissions are not automatically closed because prose or
|
|
22
|
+
headings differ.
|
|
23
|
+
|
|
24
|
+
## Development environment
|
|
25
|
+
|
|
26
|
+
Use Python 3.11 or newer and pip 25.1 or newer. From the repository root:
|
|
27
|
+
|
|
28
|
+
```console
|
|
29
|
+
python -m venv .venv
|
|
30
|
+
python -m pip install --upgrade "pip>=25.1"
|
|
31
|
+
python -m pip install --group dev --editable .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Activate the virtual environment using the command appropriate for your shell,
|
|
35
|
+
or invoke its Python executable directly.
|
|
36
|
+
|
|
37
|
+
## Required checks
|
|
38
|
+
|
|
39
|
+
Run the complete local gate before requesting review:
|
|
40
|
+
|
|
41
|
+
```console
|
|
42
|
+
python -m ruff format --check .
|
|
43
|
+
python -m ruff check .
|
|
44
|
+
python -m mypy src tests tools
|
|
45
|
+
python -m pytest
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
CI additionally checks each pull-request commit for a matching DCO sign-off,
|
|
49
|
+
reviews changed dependencies, and scans Python source with CodeQL. These
|
|
50
|
+
remote checks are included in the aggregate required `CI` result.
|
|
51
|
+
|
|
52
|
+
When packaging or artifact behavior changes, also run:
|
|
53
|
+
|
|
54
|
+
```console
|
|
55
|
+
python -m build --outdir .tmp/dist
|
|
56
|
+
python -m twine check .tmp/dist/*
|
|
57
|
+
python -m tools.validate_artifacts .tmp/dist
|
|
58
|
+
python -m tools.smoke_wheel .tmp/dist
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The artifact directory must be fresh. The smoke check installs the exact wheel
|
|
62
|
+
offline with no dependencies and imports it outside the source path.
|
|
63
|
+
|
|
64
|
+
## Changes and tests
|
|
65
|
+
|
|
66
|
+
- Keep pull requests focused on one issue, but include the production code,
|
|
67
|
+
tests, documentation, and migration details needed to make that issue whole.
|
|
68
|
+
- Add deterministic tests for success, boundary, and failure behavior. Unit
|
|
69
|
+
tests must not require network access, production credentials, wall-clock
|
|
70
|
+
sleeps, execution order, or mutable global machine state.
|
|
71
|
+
- Preserve the zero-runtime-dependency core unless an accepted design change
|
|
72
|
+
explicitly says otherwise.
|
|
73
|
+
- Maintain compatibility with every Python version claimed in project metadata
|
|
74
|
+
and enforced by CI.
|
|
75
|
+
- Do not weaken strict typing, linting, coverage, or artifact checks merely to
|
|
76
|
+
make a change pass.
|
|
77
|
+
|
|
78
|
+
## Commits and pull requests
|
|
79
|
+
|
|
80
|
+
Every commit must include a Developer Certificate of Origin sign-off. Create it
|
|
81
|
+
with `git commit --signoff`; the resulting commit message contains a
|
|
82
|
+
`Signed-off-by` line. By signing off, you certify the
|
|
83
|
+
[Developer Certificate of Origin](https://developercertificate.org/).
|
|
84
|
+
|
|
85
|
+
Pull request titles use this conventional shape:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
type(optional-scope): imperative summary
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Allowed types are `build`, `chore`, `ci`, `docs`, `feat`, `fix`, `perf`,
|
|
92
|
+
`refactor`, and `test`. Keep the complete title at 80 characters or fewer.
|
|
93
|
+
|
|
94
|
+
Every pull request follows the tracked Apache-inspired template and contains a
|
|
95
|
+
closing reference such as `Closes #123` to one open, milestone-assigned issue.
|
|
96
|
+
Its eight sections explain the proposal, motivation, issue, user impact,
|
|
97
|
+
validation, compatibility and rollback, documentation and follow-up, and a
|
|
98
|
+
short practical checklist. Maintainers request corrections during review when
|
|
99
|
+
context is missing; custom code does not police contributor prose.
|
|
100
|
+
|
|
101
|
+
A design proposal and accepted design record precede changes to public APIs,
|
|
102
|
+
serialized formats, compatibility promises, architecture, dependencies,
|
|
103
|
+
security-sensitive behavior, release policy, or contributor governance.
|
|
104
|
+
Repository rules require a pull request and aggregate `CI` before `main` can
|
|
105
|
+
accept a merge.
|
|
106
|
+
|
|
107
|
+
## Release notes and changelog
|
|
108
|
+
|
|
109
|
+
Not every internal change is useful release news. Describe user-facing behavior
|
|
110
|
+
and migration impact in the pull request, or write `None` when it is not
|
|
111
|
+
applicable. Maintainers apply a generated-release-note category label to
|
|
112
|
+
user-visible work and `skip-release-notes` to internal-only changes.
|
|
113
|
+
|
|
114
|
+
The first alpha has curated notes in `docs/releases/`; the generated release
|
|
115
|
+
note configuration can group later merged pull requests by labels. The
|
|
116
|
+
project does not require every pull request to edit one shared `CHANGELOG.md`;
|
|
117
|
+
that produces noise and merge conflicts for non-user-facing work. A curated
|
|
118
|
+
changelog or per-pull-request news fragments may be added through a dedicated
|
|
119
|
+
issue when release volume, backports, or multiple concurrent contributors make
|
|
120
|
+
them valuable.
|
|
121
|
+
|
|
122
|
+
## Security
|
|
123
|
+
|
|
124
|
+
Do not report suspected vulnerabilities in a public issue. Follow
|
|
125
|
+
[SECURITY.md](SECURITY.md) for private reporting instructions.
|
|
126
|
+
|
|
127
|
+
This project is independent and is not affiliated with or endorsed by the
|
|
128
|
+
Apache Software Foundation.
|
|
@@ -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,214 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: importtime-check
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Detect Python import-time regressions in CI.
|
|
5
|
+
Project-URL: Repository, https://github.com/SEPURI-SAI-KRISHNA/importtime-check
|
|
6
|
+
Project-URL: Issues, https://github.com/SEPURI-SAI-KRISHNA/importtime-check/issues
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Keywords: ci,import-time,performance,pytest,regression-testing,startup-time
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
21
|
+
Classifier: Topic :: System :: Benchmark
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Provides-Extra: pytest
|
|
25
|
+
Requires-Dist: pytest>=9.1.1; extra == 'pytest'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# importtime-check
|
|
29
|
+
|
|
30
|
+
[](https://github.com/SEPURI-SAI-KRISHNA/importtime-check/actions/workflows/ci.yml)
|
|
31
|
+
|
|
32
|
+
`importtime-check` is a CI gate for detecting regressions in Python import
|
|
33
|
+
time. It measures imports in clean subprocesses, compares results with
|
|
34
|
+
deterministic baselines, and reports actionable diagnostics when startup
|
|
35
|
+
performance regresses.
|
|
36
|
+
|
|
37
|
+
## Project status
|
|
38
|
+
|
|
39
|
+
This project is in early alpha development; its public API is not yet a stable
|
|
40
|
+
compatibility commitment.
|
|
41
|
+
|
|
42
|
+
Version `0.1.0a1` is the first public alpha. Install it with:
|
|
43
|
+
|
|
44
|
+
```console
|
|
45
|
+
python -m pip install --pre importtime-check==0.1.0a1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
CPython 3.11 through 3.14 are tested. Package metadata requires Python 3.11
|
|
49
|
+
or newer; newer interpreter versions are not yet in the tested support matrix.
|
|
50
|
+
The core install has no runtime dependencies. Pytest is available only through
|
|
51
|
+
the optional `pytest` extra.
|
|
52
|
+
|
|
53
|
+
The numeric stderr produced by CPython's `-X importtime` option can already be
|
|
54
|
+
parsed without executing a subprocess:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from importtime_check import parse_importtime
|
|
58
|
+
|
|
59
|
+
result = parse_importtime(
|
|
60
|
+
"import time: self [us] | cumulative | imported package\n"
|
|
61
|
+
"import time: 12 | 34 | example"
|
|
62
|
+
)
|
|
63
|
+
event = result.events[0]
|
|
64
|
+
assert (event.module, event.self_us, event.cumulative_us, event.depth) == (
|
|
65
|
+
"example",
|
|
66
|
+
12,
|
|
67
|
+
34,
|
|
68
|
+
0,
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This API remains an alpha API and may change before the first stable release.
|
|
73
|
+
|
|
74
|
+
To measure one installed module in a fresh CPython process:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from importtime_check import measure_import
|
|
78
|
+
|
|
79
|
+
measurement = measure_import("json")
|
|
80
|
+
print(measurement.target_event.cumulative_us) # integer microseconds
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The target must be installed in the selected interpreter. The child uses
|
|
84
|
+
Python's isolated mode, so the current directory and user site packages are
|
|
85
|
+
not import locations. This reports CPython's target import time, not total
|
|
86
|
+
process startup time. For a less noisy observation, use repeated sampling:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from importtime_check import sample_import
|
|
90
|
+
|
|
91
|
+
result = sample_import("json", warmups=1, samples=5)
|
|
92
|
+
print(result.median_cumulative_us) # upper median, integer microseconds
|
|
93
|
+
print([run.target_event.cumulative_us for run in result.samples])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Each warmup and sample uses a fresh child process. Warmups are preserved but
|
|
97
|
+
excluded from the median. This reduces single-run noise; it does not guarantee
|
|
98
|
+
that two machines or CI runs have comparable timings.
|
|
99
|
+
|
|
100
|
+
The library also supports reviewable baselines and exact regression decisions:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from importtime_check import (
|
|
104
|
+
check_baseline,
|
|
105
|
+
probe_environment,
|
|
106
|
+
record_baseline,
|
|
107
|
+
sample_import,
|
|
108
|
+
save_baseline,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
baseline = record_baseline(
|
|
112
|
+
{"json": sample_import("json")},
|
|
113
|
+
probe_environment(),
|
|
114
|
+
max_increase_us=25,
|
|
115
|
+
max_increase_percent="10",
|
|
116
|
+
)
|
|
117
|
+
save_baseline("importtime-baseline.json", baseline)
|
|
118
|
+
report = check_baseline(baseline)
|
|
119
|
+
print(report.status) # "pass" or "regression"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Baselines are versioned JSON and require the same Python minor version,
|
|
123
|
+
platform, machine, and profile at check time. Review baseline changes before
|
|
124
|
+
using them as CI policy; matching identity does not eliminate host noise.
|
|
125
|
+
|
|
126
|
+
The installed command supports measuring, recording, inspecting, and checking:
|
|
127
|
+
|
|
128
|
+
```console
|
|
129
|
+
importtime-check measure --module json
|
|
130
|
+
importtime-check baseline record --output importtime-baseline.json --module json --max-increase-us 25 --max-increase-percent 10
|
|
131
|
+
importtime-check baseline show --file importtime-baseline.json
|
|
132
|
+
importtime-check check --baseline importtime-baseline.json
|
|
133
|
+
importtime-check check --baseline importtime-baseline.json --format json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`check` exits `0` when all targets pass, `1` for a regression, and `2` for
|
|
137
|
+
invalid input or an operational failure. Its JSON output is a stable schema-1
|
|
138
|
+
document on standard output, including for exit codes `1` and `2` (except
|
|
139
|
+
command-line syntax errors).
|
|
140
|
+
|
|
141
|
+
Pytest integration is optional and must be explicitly loaded. For a development
|
|
142
|
+
checkout, install its extra and run against an approved baseline. After
|
|
143
|
+
publication, install `"importtime-check[pytest]==0.1.0a1"` instead of the
|
|
144
|
+
editable checkout:
|
|
145
|
+
|
|
146
|
+
```console
|
|
147
|
+
python -m pip install --editable ".[pytest]"
|
|
148
|
+
python -m pytest -p importtime_check.pytest_plugin --importtime-baseline importtime-baseline.json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The plugin accepts repeated `--importtime-module` flags to assert the exact
|
|
152
|
+
target set and `--importtime-python`, `--importtime-timeout-seconds`,
|
|
153
|
+
`--importtime-working-directory`, and `--importtime-profile` to select the
|
|
154
|
+
runtime. The corresponding `pytest.ini` settings are `importtime_baseline`,
|
|
155
|
+
`importtime_modules`, `importtime_python`, `importtime_timeout_seconds`,
|
|
156
|
+
`importtime_working_directory`, and `importtime_profile`. Explicit command-line
|
|
157
|
+
values replace settings; otherwise the baseline supplies targets and sampling.
|
|
158
|
+
Invalid configuration exits pytest with code `4` before tests. After a passing
|
|
159
|
+
test session, a regression or measurement error exits with code `1`; an
|
|
160
|
+
existing test failure or interruption is preserved without measuring. The
|
|
161
|
+
plugin never refreshes baselines and is not loaded automatically.
|
|
162
|
+
|
|
163
|
+
## Development
|
|
164
|
+
|
|
165
|
+
Create a virtual environment with Python 3.11 or newer, then install the
|
|
166
|
+
project and its unpublished development dependency group. Dependency-group
|
|
167
|
+
installation requires pip 25.1 or newer.
|
|
168
|
+
|
|
169
|
+
```console
|
|
170
|
+
python -m venv .venv
|
|
171
|
+
python -m pip install --upgrade "pip>=25.1"
|
|
172
|
+
python -m pip install --group dev --editable .
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Run the local quality gate from the repository root:
|
|
176
|
+
|
|
177
|
+
```console
|
|
178
|
+
python -m ruff format --check .
|
|
179
|
+
python -m ruff check .
|
|
180
|
+
python -m mypy src tests tools
|
|
181
|
+
python -m pytest
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Build validation uses fresh artifacts in the ignored `.tmp` directory:
|
|
185
|
+
|
|
186
|
+
```console
|
|
187
|
+
python -m build --outdir .tmp/dist
|
|
188
|
+
python -m twine check .tmp/dist/*
|
|
189
|
+
python -m tools.validate_artifacts .tmp/dist
|
|
190
|
+
python -m tools.smoke_wheel .tmp/dist
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
See [CONTRIBUTING.md](https://github.com/SEPURI-SAI-KRISHNA/importtime-check/blob/main/CONTRIBUTING.md)
|
|
194
|
+
for the complete contribution workflow and
|
|
195
|
+
[SECURITY.md](https://github.com/SEPURI-SAI-KRISHNA/importtime-check/blob/main/SECURITY.md)
|
|
196
|
+
for private vulnerability reporting.
|
|
197
|
+
The [first alpha release notes](https://github.com/SEPURI-SAI-KRISHNA/importtime-check/blob/main/docs/releases/v0.1.0a1.md) summarize its
|
|
198
|
+
capabilities, compatibility, and limitations.
|
|
199
|
+
|
|
200
|
+
## Current limits
|
|
201
|
+
|
|
202
|
+
Measurements are sensitive to host load, dependency changes, and interpreter
|
|
203
|
+
configuration. Compare results only in controlled environments with reviewed
|
|
204
|
+
baselines. The tool reports CPython's import-time diagnostics, not whole-process
|
|
205
|
+
startup time, and it does not yet identify the cause of a regression automatically.
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
Licensed under the Apache License, Version 2.0. See
|
|
210
|
+
[LICENSE](https://github.com/SEPURI-SAI-KRISHNA/importtime-check/blob/main/LICENSE)
|
|
211
|
+
and [NOTICE](https://github.com/SEPURI-SAI-KRISHNA/importtime-check/blob/main/NOTICE).
|
|
212
|
+
|
|
213
|
+
This is an independent open-source project. It is not affiliated with or
|
|
214
|
+
endorsed by the Apache Software Foundation.
|