Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dev:

isort:
@echo "-> Apply isort changes to ensure proper imports ordering"
${VENV}/bin/isort --sl src tests
${VENV}/bin/isort --sl -l 100 src tests

black:
@echo "-> Apply black code formatter"
Expand All @@ -32,9 +32,10 @@ valid: isort black

check:
@echo "-> Run pycodestyle (PEP8) validation"
@${ACTIVATE} pycodestyle --max-line-length=100 --exclude=venv,lib,thirdparty,docs,migrations,settings.py .
@${ACTIVATE} pycodestyle --max-line-length=110 \
--exclude=.eggs,etc/scripts,src/_packagedcode,venv,lib,thirdparty,docs .
@echo "-> Run isort imports ordering validation"
@${ACTIVATE} isort --sl --check-only .
@${ACTIVATE} isort --sl --check-only -l 100 src tests
@echo "-> Run black validation"
@${ACTIVATE} black --check -l 100

Expand Down
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ The goal of python-inspector is to be a comprehensive library
that can handle every style of Python package layouts, manifests and lockfiles.


Usage
--------

- Install with pip::

pip install python-inspector

- Run a command line with::

dad --help



Its companion libraries are:

- ``pip-requirements-parser``, a mostly correct pip requirements parsing
Expand Down
15 changes: 8 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,47 @@ jobs:
parameters:
job_name: ubuntu18_cpython
image_name: ubuntu-18.04
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
python_versions: ['3.8', '3.9', '3.10']
test_suites:
all: venv/bin/pytest -n 2 -vvs
all: |
venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: ubuntu20_cpython
image_name: ubuntu-20.04
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
python_versions: ['3.8', '3.9', '3.10']
test_suites:
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos1015_cpython
image_name: macos-10.15
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
python_versions: ['3.8', '3.9', '3.10']
test_suites:
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-posix.yml
parameters:
job_name: macos11_cpython
image_name: macos-11
python_versions: ['3.7', '3.8', '3.9', '3.10']
python_versions: ['3.8', '3.9', '3.10']
test_suites:
all: venv/bin/pytest -n 2 -vvs

- template: etc/ci/azure-win.yml
parameters:
job_name: win2019_cpython
image_name: windows-2019
python_versions: ['3.6', '3.7', '3.8', '3.9', '3.10']
python_versions: ['3.8', '3.9', '3.10']
test_suites:
all: venv\Scripts\pytest -n 2 -vvs

- template: etc/ci/azure-win.yml
parameters:
job_name: win2022_cpython
image_name: windows-2022
python_versions: ['3.7', '3.8', '3.9', '3.10']
python_versions: ['3.8', '3.9', '3.10']
test_suites:
all: venv\Scripts\pytest -n 2 -vvs
18 changes: 9 additions & 9 deletions docs/source/dependencies-design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ For each dependency, there can be a version "requirement" that can be an
exact version, a version expression (aka. version specifier) as defined
in `pep-0440 <https://www.python.org/dev/peps/pep-0440/>`__
with additional OS and environment tags and constraints as specified in
`pep-0508 <https://www.python.org/dev/peps/pep-0508/>`__ .
`pep-0508 <https://www.python.org/dev/peps/pep-0508/>`__ .

In particular the required Python version of a package (or version specifier)
can be set for the whole package (with the``python_requires`` attribute) or as
a marker for a given direct or indirect dependency. pip processes requirement
In particular the required Python version of a package (or version specifier)
can be set for the whole package (with the``python_requires`` attribute) or as
a marker for a given direct or indirect dependency. pip processes requirement
specifiers and constraints from a "requirements" file and internally resolves
dependency versions recursively by querying the PyPI Python package
index repository at https://PyPI.org
Expand Down Expand Up @@ -129,7 +129,7 @@ And a flat list of unique dependencies would be:
- thing 3.0
- shebang 1.0

The implementation may likely be similar to
The implementation may likely be similar to
`pipgrip <https://github.com/ddelange/pipgrip>`__,
but using the `resolvelib <https://github.com/sarugaku/resolvelib>`__
library as used and vendored in pip instead of an implementation of
Expand All @@ -139,7 +139,7 @@ The expected benefit of this tool is a simpler way to resolve Python
dependencies that will not require complex installation of a Python toolchain
specific to a given project environment when the goal is only to resolve
dependencies. In particular the key new capability is to run this tool on a
single Python version and resolve versions for alternative Python versions,
single Python version and resolve versions for alternative Python versions,
operating systems and architectures without having to install all the packages
in the dependency tree.

Expand All @@ -158,7 +158,8 @@ The outline of the processing is to:
- For each top-level requirement (e.g. name/version):

- Fetch all the corresponding versions metadata using the PyPI API(s)
- Fetch the packages as needed to further obtain the next-level dependencies, and this recursively
- Fetch the packages as needed to further obtain the next-level
dependencies, and this recursively

- Resolve a correct dependency version for each name.
- Dump JSON
Expand All @@ -168,7 +169,7 @@ User experience:
----------------

The goal of the command line interface and user experience is to be
obvious and familiar to a pip user.
obvious and familiar to a pip user.

Create a new CLI named "dad" short for "dad analyzes dependencies" with
these key options:
Expand Down Expand Up @@ -352,4 +353,3 @@ ScanCode Toolkit can detect the and normalize the declared licenses in package
metadata and also collect and normalize all the metadata. This could be
a refinement for later.


1 change: 1 addition & 0 deletions etc/scripts/utils_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# See https://github.com/nexB/skeleton for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
import os
import re
import subprocess

Expand Down
41 changes: 41 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
aboutcode-toolkit==7.0.2
black==22.3.0
bleach==4.1.0
boolean.py==4.0
cffi==1.15.0
cryptography==37.0.2
dataclasses==0.8
docutils==0.18.1
et-xmlfile==1.1.0
execnet==1.9.0
importlib-resources==5.4.0
iniconfig==1.1.1
isort==5.10.1
jeepney==0.7.1
jinja2==3.0.3
keyring==23.4.1
license-expression==30.0.0
markupsafe==2.0.1
mypy-extensions==0.4.3
openpyxl==3.0.10
pathspec==0.9.0
pkginfo==1.8.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.8.0
pycparser==2.21
pygments==2.12.0
pytest==7.0.1
pytest-forked==1.4.0
pytest-xdist==2.5.0
readme-renderer==34.0
requests-toolbelt==0.9.1
rfc3986==1.5.0
secretstorage==3.3.2
six==1.16.0
tomli==1.2.3
tqdm==4.64.0
twine==3.8.0
typed-ast==1.5.4
webencodings==0.5.1
27 changes: 27 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
attrs==21.4.0
beautifulsoup4==4.11.1
certifi==2022.5.18.1
charset-normalizer==2.0.12
click==8.0.4
colorama==0.4.4
commoncode==30.2.0
dparse2==0.6.1
idna==3.3
importlib-metadata==4.8.3
intbitset==3.0.1
packageurl-python==0.9.9
packaging==21.3
pip-requirements-parser==31.2.0
pkginfo2==30.0.0
pyparsing==3.0.9
PyYAML==6.0
requests==2.27.1
resolvelib==0.8.1
saneyaml==0.5.2
soupsieve==2.3.2.post1
text-unidecode==1.3
toml==0.10.2
typing==3.6.6
typing_extensions==4.1.1
urllib3==1.26.9
zipp==3.6.0
6 changes: 6 additions & 0 deletions src/_packagedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ class DependentPackage(ModelMixin):
"lockfiles for Composer or Cargo contain extra dependency data.",
)

# dependencies = List(
# item_type="DependentPackage",
# label="dependencies",
# help="A list of DependentPackage for this package.",
# )


@attr.attributes(slots=True)
class Dependency(DependentPackage):
Expand Down
2 changes: 1 addition & 1 deletion src/_packagedcode/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def get_requires_dependencies(requires, default_scope="install"):
is_runtime=True,
is_optional=False,
is_resolved=is_resolved,
extracted_requirement=requirement,
extracted_requirement=str(req),
)
)

Expand Down
Loading