Skip to content

Commit fe74b59

Browse files
committed
Clarify getting started and testing
The README now has improved documentation to run tests and getting started. Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 60fb8b6 commit fe74b59

File tree

1 file changed

+74
-13
lines changed

1 file changed

+74
-13
lines changed

README.rst

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ python-inspector - inspect Python package dependencies and metadata
22
=====================================================================
33

44

5-
Copyright (c) nexB Inc. and others.
6-
SPDX-License-Identifier: Apache-2.0
7-
Homepage: https://github.com/aboutcode-org/python-inspector and https://www.aboutcode.org/
8-
95

106
``python-inspector`` is a collection of utilities to:
117

@@ -28,21 +24,21 @@ The goal of python-inspector is to be a comprehensive library
2824
that can handle every style of Python package layouts, manifests and lockfiles.
2925

3026

31-
Testing
32-
--------
27+
SPDX-License-Identifier: Apache-2.0
3328

34-
- Run the tests with::
29+
Copyright (c) AboutCode, nexB Inc. and others.
3530

36-
pytest -vvs
37-
38-
- There are live tests to regenerate the tests with updated data run::
31+
Homepage: https://github.com/aboutcode-org/python-inspector and https://www.aboutcode.org/
3932

40-
PYINSP_REGEN_TEST_FIXTURES=yes pytest -vvs
4133

4234
Usage
4335
--------
4436

45-
- Install with pip::
37+
- Install the stable release with pip from PyPI::
38+
39+
pip install python-inspector
40+
41+
- Or install the latest with pip::
4642

4743
pip install git+https://github.com/aboutcode-org/python-inspector
4844

@@ -51,8 +47,71 @@ Usage
5147
python-inspector --help
5248

5349

50+
Development
51+
--------------
52+
53+
Run::
54+
55+
git clone https://github.com/aboutcode-org/python-inspector
56+
57+
Create a virtual environment and install deps locally::
58+
59+
make dev
60+
source venv/bin/activate
61+
62+
63+
When in the virtual environment, run python-inspector from that clone::
64+
65+
python-inspector --help
66+
67+
68+
Run tests::
69+
70+
make test
71+
72+
Run code checks::
5473

55-
Its companion libraries are:
74+
make check
75+
76+
Run code formatting::
77+
78+
make valie
79+
80+
Check available make targets for further details
81+
82+
83+
84+
More testing
85+
------------------
86+
87+
- Run the tests with pytest::
88+
89+
pytest -vvs
90+
91+
- Or run them faster using 12 cores ::
92+
93+
pytest -vvs --numprocesses=12
94+
95+
96+
Regenerate test files
97+
-----------------------------
98+
99+
Some tests use live data from Pypi.org to run resolutions. When the package versions have
100+
changed, the resolution can change and some of the tests fail. We have an environment variable
101+
that regenerates the expected JSON result files when set.
102+
103+
To regenerate expected test result files for the failed tests, use this command::
104+
105+
PYINSP_REGEN_TEST_FIXTURES=yes pytest -vvs --lf
106+
107+
Then, carefully review the diff before committing the expected JSON test result files to validate
108+
that the changes are OK and mostly affect small changes in resolved package versions.
109+
110+
111+
Credits and dependencies
112+
---------------------------
113+
114+
For info, python-inspector embeds or depends on these libraries:
56115

57116
- ``pip-requirements-parser``, a mostly correct pip requirements parsing
58117
library extracted from pip.
@@ -72,6 +131,8 @@ Its companion libraries are:
72131

73132
- ``packageurl-python`` to use Package URL to reference Python packages
74133

134+
- ``scancode-toolkit`` for Python package manifest parsing.
135+
75136

76137

77138
Acknowledgements, Funding, Support and Sponsoring

0 commit comments

Comments
 (0)