Skip to content

Commit

Permalink
Added check for missing dependencies
Browse files Browse the repository at this point in the history
Details:

* Test: Added a new make target 'check_reqs' that checks missing package
  dependencies, and added a step to the test workflow that runs it.
  (issue #155)

* As a result of adding the check, added the following missing
  dependencies:
    - typer
    - typer-cli
    - typer-slim
    - ruamel-yaml
    - safety-schemas
    - marshmallow
    - Authlib
    - pydantic
    - rich
    - tomli

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed May 6, 2024
1 parent a412cf2 commit d017788
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ jobs:
run: |
echo "Package dependency tree of installed Python packages:"
python -m pipdeptree --all
- name: Run check_reqs
env:
PACKAGE_LEVEL: ${{ matrix.package_level }}
run: |
make check_reqs
- name: Run build
env:
PACKAGE_LEVEL: ${{ matrix.package_level }}
Expand Down
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ dist_included_files := \
# Directory for .done files
done_dir := done

# Packages whose dependencies are checked using pip-missing-reqs
check_reqs_packages := pytest coverage coveralls flake8 pylint safety sphinx twine

.PHONY: help
help:
@echo "Makefile for $(project_name) project"
Expand All @@ -260,6 +263,7 @@ help:
@echo " pylint - Run PyLint on Python sources"
@echo " mypy - Run Mypy on Python sources"
@echo " safety - Run safety on Python sources"
@echo " check_reqs - Perform missing dependency checks"
@echo " installtest - Run install tests"
@echo " test - Run unit tests"
@echo " testlist - Run unit tests against standard list"
Expand Down Expand Up @@ -436,7 +440,7 @@ mypy: $(done_dir)/mypy_$(pymn)_$(PACKAGE_LEVEL).done
@echo "Makefile: Target $@ done."

.PHONY: all
all: develop build builddoc check pylint mypy installtest test doclinkcheck authors
all: develop check_reqs build builddoc check pylint mypy installtest test doclinkcheck authors
@echo "Makefile: Target $@ done."

.PHONY: clobber
Expand Down Expand Up @@ -591,6 +595,22 @@ $(done_dir)/safety_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_reqs_$(pym
echo "done" >$@
@echo "Makefile: Done running pyup.io safety check"

.PHONY: check_reqs
check_reqs: $(done_dir)/develop_reqs_$(pymn)_$(PACKAGE_LEVEL).done minimum-constraints.txt requirements.txt
@echo "Makefile: Checking missing dependencies of the package"
pip-missing-reqs $(package_name) --requirements-file=requirements.txt
pip-missing-reqs $(package_name) --requirements-file=minimum-constraints.txt
@echo "Makefile: Done checking missing dependencies of the package"
ifeq ($(PLATFORM),Windows_native)
# Reason for skipping on Windows is https://github.com/r1chardj0n3s/pip-check-reqs/issues/67
@echo "Makefile: Warning: Skipping the checking of missing dependencies of site-packages directory on native Windows" >&2
else
@echo "Makefile: Checking missing dependencies of some development packages"
@rc=0; for pkg in $(check_reqs_packages); do dir=$$($(PYTHON_CMD) -c "import $${pkg} as m,os; dm=os.path.dirname(m.__file__); d=dm if not dm.endswith('site-packages') else m.__file__; print(d)"); cmd="pip-missing-reqs $${dir} --requirements-file=minimum-constraints.txt"; echo $${cmd}; $${cmd}; rc=$$(expr $${rc} + $${?}); done; exit $${rc}
@echo "Makefile: Done checking missing dependencies of some development packages"
endif
@echo "Makefile: $@ done."

ifdef TEST_INSTALLED
test_deps =
else
Expand Down
6 changes: 6 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ mypy>=1.2.0; python_version >= '3.7'

# Package dependency management tools
pipdeptree>=2.2.0
# pip-check-reqs 2.3.2 is needed to have proper support for pip>=21.3 and below.
# pip-check-reqs 2.4.3 fixes a speed issue on Python 3.11.
# pip-check-reqs 2.5.0 has issue https://github.com/r1chardj0n3s/pip-check-reqs/issues/143
pip-check-reqs>=2.3.2; python_version >= '3.6' and python_version <= '3.7'
pip-check-reqs>=2.4.3,!=2.5.0; python_version >= '3.8' and python_version <= '3.11'
pip-check-reqs>=2.5.1; python_version >= '3.12'


# Indirect dependencies with special constraints:
Expand Down
4 changes: 4 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Released: not yet
* Test: Added a step to the test workflow for displaying the tree of all
package dependencies using pipdeptree. (issue #153)

* Test: Added a new make target 'check_reqs' that checks missing package
dependencies, and added a step to the test workflow that runs it.
(issue #155)

**Cleanup:**

* Converted any use of percent-style formatting strings and most use of
Expand Down
22 changes: 22 additions & 0 deletions minimum-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ coveralls==3.3.0
# Safety CI by pyup.io
safety==2.2.0
dparse==0.6.2
typer==0.9.0; python_version == '3.6'
typer==0.12.0; python_version >= '3.7'
typer-cli==0.12.0; python_version >= '3.7'
typer-slim==0.12.0; python_version >= '3.7'
# safety 2.2.0 depends on ruamel.yaml>=0.17.21
ruamel-yaml==0.17.21
safety-schemas==0.0.1
marshmallow==3.15.0
# dataclasses is used by safety>=2.3.1 on (only) py36
dataclasses==0.8; python_version == '3.6'

# Click is used by safety
Click==8.0.2
Expand Down Expand Up @@ -127,6 +137,12 @@ mypy==1.2.0; python_version >= '3.7'
# Package dependency management tools
pipdeptree==2.2.0

# Package dependency management tools
pipdeptree==2.2.0
pip-check-reqs==2.3.2; python_version >= '3.6' and python_version <= '3.7'
pip-check-reqs==2.4.3; python_version >= '3.8' and python_version <= '3.11'
pip-check-reqs==2.5.1; python_version >= '3.12'


# Indirect dependencies with special constraints:

Expand All @@ -143,6 +159,7 @@ alabaster==0.7.9
appdirs==1.4.4
args==0.1.0
attrs==19.2.0
Authlib==1.2.0
bleach==3.3.0
certifi==2023.07.22
chardet==3.0.3
Expand All @@ -160,6 +177,7 @@ MarkupSafe==2.0.0
more-itertools==5.0.0
pkginfo==1.4.2
py==1.11.0
pydantic==1.10.13
pyparsing==2.4.7
python-dateutil==2.6.0
pyzmq==16.0.4
Expand All @@ -168,6 +186,7 @@ requests==2.31.0; python_version >= '3.7'
requests-mock==1.6.0
requests-toolbelt==0.8.0
rfc3986==1.3.0
rich==12.0.0
smmap==3.0.1
snowballstemmer==1.2.1
sphinxcontrib-applehelp==1.0.0
Expand All @@ -177,6 +196,9 @@ sphinxcontrib-jsmath==1.0.0
sphinxcontrib-qthelp==1.0.0
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.0
# tomli 2.0.0 removed support for py36
tomli==1.1.0; python_version == '3.6'
tomli==2.0.1; python_version >= '3.7'
tqdm==4.14
urllib3==1.26.18
wcwidth==0.1.7
Expand Down

0 comments on commit d017788

Please sign in to comment.