Move to hatch with VCS version tracking and src layout, requires 3.7+
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
This commit is contained in:
parent
8679c0af7c
commit
163140c217
|
@ -1,13 +1,6 @@
|
|||
*.pyc
|
||||
__pycache__
|
||||
*~
|
||||
*.egg-info/
|
||||
build/
|
||||
*.egg-info
|
||||
dist/
|
||||
.tox/
|
||||
/src/pipdeptree/version.py
|
||||
tests/virtualenvs/equimapper/
|
||||
.coverage
|
||||
coverage.xml
|
||||
htmlcov/
|
||||
.cache/
|
||||
.pytest_cache/
|
|
@ -1 +0,0 @@
|
|||
include LICENSE CHANGES.md
|
38
Makefile
38
Makefile
|
@ -1,38 +0,0 @@
|
|||
.PHONY: clean test-env test test-cov test-tox-all test-e2e
|
||||
|
||||
TOX_ENV ?= py36
|
||||
|
||||
E2E_PYTHON_EXE ?= python3.6
|
||||
|
||||
clean:
|
||||
find . -name '*.pyc' -exec rm -f {} +
|
||||
find . -name '*.pyo' -exec rm -f {} +
|
||||
find . -name '*~' -exec rm -f {} +
|
||||
find . -name '__pycache__' -exec rmdir {} +
|
||||
|
||||
test-env:
|
||||
pip install -r dev-requirements.txt
|
||||
|
||||
test:
|
||||
tox -e $(TOX_ENV)
|
||||
|
||||
test-cov:
|
||||
tox -e $(TOX_ENV) -- -x -vv --cov=pipdeptree --cov-report=xml --cov-report=html --cov-report=term-missing
|
||||
|
||||
# Requires all the versions of python executables to be present (See
|
||||
# tox.ini for list of python versions)
|
||||
test-tox-all:
|
||||
tox
|
||||
|
||||
clean-e2e:
|
||||
rm -rf tests/profiles/*/.env_$(E2E_PYTHON_EXE)*
|
||||
|
||||
test-e2e: clean-e2e
|
||||
cd tests && ./e2e-tests webapp
|
||||
cd tests && ./e2e-tests conflicting
|
||||
cd tests && ./e2e-tests cyclic
|
||||
|
||||
test-e2e-quick:
|
||||
cd tests && ./e2e-tests webapp
|
||||
cd tests && ./e2e-tests conflicting
|
||||
cd tests && ./e2e-tests cyclic
|
|
@ -14,7 +14,7 @@ requires some effort. It's also tedious to resolve conflicting
|
|||
dependencies that could have been installed because older version of
|
||||
``pip`` didn't have true dependency resolution [1]_. ``pipdeptree``
|
||||
can help here by identifying conflicting dependencies installed in the
|
||||
environment.
|
||||
environment.R
|
||||
|
||||
To some extent, ``pipdeptree`` is inspired by the ``lein deps :tree``
|
||||
command of `Leiningen <http://leiningen.org/>`_.
|
||||
|
|
|
@ -1,3 +1,61 @@
|
|||
[build-system]
|
||||
requires = ["setuptools>=65.1.1"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
build-backend = "hatchling.build"
|
||||
requires = ["hatchling>=1.8.1", "hatch-vcs>=0.2"]
|
||||
|
||||
[project]
|
||||
name = "pipdeptree"
|
||||
description = 'Command line utility to show dependency tree of packages.'
|
||||
readme = "README.rst"
|
||||
license.file = "LICENSE"
|
||||
maintainers = [
|
||||
{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" },
|
||||
{ name = "Vineet Naik", email = "naikvin@gmail.com" },
|
||||
]
|
||||
urls.Documentation = "https://github.com/tox-dev/pipdeptree/blob/main/README.rst#pipdeptree"
|
||||
urls.Homepage = "https://github.com/tox-dev/pipdeptree"
|
||||
urls.Source = "https://github.com/tox-dev/pipdeptree"
|
||||
urls.Tracker = "https://github.com/tox-dev/pipdeptree/issues"
|
||||
requires-python = ">=3.7"
|
||||
optional-dependencies.test = [
|
||||
"covdefaults>=2.2",
|
||||
"diff-cover>=6.5.1",
|
||||
"pip>=22.2.2",
|
||||
"pytest>=7.1.3",
|
||||
"pytest-cov>=3",
|
||||
"pytest-mock>=3.8.2",
|
||||
"virtualenv<21,>=20.16.4",
|
||||
]
|
||||
optional-dependencies.graphviz = [
|
||||
"graphviz>=0.20.1",
|
||||
]
|
||||
scripts.pipdeptree = "pipdeptree:main"
|
||||
keywords = ["application", "cache", "directory", "log", "user"]
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
]
|
||||
dynamic = ["version"]
|
||||
|
||||
[tool.hatch]
|
||||
build.hooks.vcs.version-file = "src/pipdeptree/version.py"
|
||||
version.source = "vcs"
|
||||
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
known_first_party = ["pipdeptree"]
|
||||
|
||||
[tool.coverage]
|
||||
html.show_contexts = true
|
||||
html.skip_covered = false
|
||||
paths.source = ["src", ".tox/*/lib/python*/site-packages", "*/src"]
|
||||
run.parallel = true
|
||||
run.plugins = ["covdefaults"]
|
||||
|
|
14
pytest.ini
14
pytest.ini
|
@ -1,14 +0,0 @@
|
|||
[pytest]
|
||||
norecursedirs = build docs/_build *.egg .tox *.venv profiles
|
||||
addopts =
|
||||
# --verbose
|
||||
--tb=short
|
||||
# Turn on --capture to have brief, less noisy output
|
||||
# You will only see output if the test fails
|
||||
# Use --capture no if you want to see it all or have problems debugging
|
||||
# --capture=fd
|
||||
# --capture=no
|
||||
# show extra test summary info as specified by chars (f)ailed, (E)error, (s)skipped, (x)failed, (X)passed.
|
||||
-rfEsxX
|
||||
# --junitxml=junit.xml
|
||||
# --cov=pipdeptree --cov-report=xml --cov-report=html --cov-report=term-missing
|
53
setup.py
53
setup.py
|
@ -1,53 +0,0 @@
|
|||
import re
|
||||
import ast
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
_version_re = re.compile(r'__version__\s+=\s+(.*)')
|
||||
|
||||
with open('pipdeptree.py', 'rb') as f:
|
||||
version = str(ast.literal_eval(_version_re.search(
|
||||
f.read().decode('utf-8')).group(1)))
|
||||
|
||||
|
||||
with open('./README.rst') as f:
|
||||
long_desc = f.read()
|
||||
|
||||
|
||||
install_requires = ["pip >= 6.0.0"]
|
||||
|
||||
|
||||
setup(
|
||||
name='pipdeptree',
|
||||
version=version,
|
||||
author='Vineet Naik',
|
||||
author_email='naikvin@gmail.com',
|
||||
url='https://github.com/naiquevin/pipdeptree',
|
||||
license='MIT License',
|
||||
license_file='LICENSE',
|
||||
description='Command line utility to show dependency tree of packages',
|
||||
long_description=long_desc,
|
||||
install_requires=install_requires,
|
||||
extras_require={'graphviz': ['graphviz']},
|
||||
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
|
||||
py_modules=['pipdeptree'],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'pipdeptree = pipdeptree:main'
|
||||
]
|
||||
},
|
||||
classifiers=[
|
||||
'Environment :: Console',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9'
|
||||
]
|
||||
)
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import print_function
|
||||
import os
|
||||
import inspect
|
||||
import shutil
|
||||
import sys
|
||||
import subprocess
|
||||
from itertools import chain
|
||||
|
@ -9,7 +10,7 @@ import argparse
|
|||
import json
|
||||
from importlib import import_module
|
||||
import tempfile
|
||||
|
||||
from .version import version as __version__
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except ImportError:
|
||||
|
@ -30,9 +31,6 @@ except ImportError:
|
|||
# from graphviz import parameters
|
||||
|
||||
|
||||
__version__ = '2.2.1'
|
||||
|
||||
|
||||
flatten = chain.from_iterable
|
||||
|
||||
|
||||
|
@ -829,19 +827,17 @@ def handle_non_host_target(args):
|
|||
del argv[py_at]
|
||||
elif value.startswith("--python"):
|
||||
del argv[py_at]
|
||||
# feed the file as argument, instead of file
|
||||
# to avoid adding the file path to sys.path, that can affect result
|
||||
file_path = inspect.getsourcefile(sys.modules[__name__])
|
||||
with open(file_path, 'rt') as file_handler:
|
||||
content = file_handler.read()
|
||||
cmd = [of_python, "-c", content]
|
||||
cmd.extend(argv)
|
||||
# invoke from an empty folder to avoid cwd altering sys.path
|
||||
cwd = tempfile.mkdtemp()
|
||||
try:
|
||||
return subprocess.call(cmd, cwd=cwd)
|
||||
finally:
|
||||
os.removedirs(cwd)
|
||||
|
||||
main_file = inspect.getsourcefile(sys.modules[__name__])
|
||||
with tempfile.TemporaryDirectory() as project:
|
||||
dest = os.path.join(project, 'pipdeptree')
|
||||
shutil.copytree(os.path.dirname(main_file), dest)
|
||||
# invoke from an empty folder to avoid cwd altering sys.path
|
||||
env = os.environ.copy()
|
||||
env['PYTHONPATH'] = project
|
||||
cmd = [of_python, '-m', 'pipdeptree']
|
||||
cmd.extend(argv)
|
||||
return subprocess.call(cmd, cwd=project, env=env)
|
||||
return None
|
||||
|
||||
|
||||
|
@ -922,7 +918,3 @@ def main():
|
|||
render_text(tree, args.all, args.freeze)
|
||||
|
||||
return return_code
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -0,0 +1,6 @@
|
|||
import sys
|
||||
|
||||
from pipdeptree import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
28
tox.ini
28
tox.ini
|
@ -1,6 +1,5 @@
|
|||
[tox]
|
||||
envlist =
|
||||
fix
|
||||
py310
|
||||
py39
|
||||
py38
|
||||
|
@ -11,17 +10,24 @@ skip_missing_interpreters = true
|
|||
minversion = 3.14
|
||||
|
||||
[testenv]
|
||||
description = run test suite under {basepython}
|
||||
commands =
|
||||
pytest {posargs:-vv}
|
||||
deps =
|
||||
graphviz>=0.20.1
|
||||
pip>=22.2.2
|
||||
pytest>=7.1.3
|
||||
pytest-cov>=3
|
||||
virtualenv<21,>=20.16.4
|
||||
description = run the unit tests with pytest under {basepython}
|
||||
setenv =
|
||||
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
|
||||
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
|
||||
_COVERAGE_SRC = {envsitepackagesdir}/sphinx_argparse_cli
|
||||
extras =
|
||||
graphviz
|
||||
graphviz
|
||||
test
|
||||
commands =
|
||||
python -m pytest {tty:--color=yes} {posargs: \
|
||||
--junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}pipdeptree \
|
||||
--cov {toxinidir}{/}tests --cov-fail-under=75 \
|
||||
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
|
||||
--cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \
|
||||
tests}
|
||||
diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}{/}coverage.{envname}.xml
|
||||
package = wheel
|
||||
wheel_build_env = .pkg
|
||||
|
||||
[testenv:readme]
|
||||
description = check that the long description is valid
|
||||
|
|
Loading…
Reference in New Issue