python-update-checker 0.6__tar.gz → 0.7__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.
Files changed (25) hide show
  1. {python_update_checker-0.6 → python_update_checker-0.7}/Makefile +19 -3
  2. {python_update_checker-0.6 → python_update_checker-0.7}/PKG-INFO +41 -31
  3. {python_update_checker-0.6 → python_update_checker-0.7}/README.md +39 -29
  4. {python_update_checker-0.6 → python_update_checker-0.7}/pyproject.toml +21 -29
  5. python_update_checker-0.7/pyproject.toml.orig +65 -0
  6. {python_update_checker-0.6 → python_update_checker-0.7}/scripts/install_dev.sh +3 -1
  7. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/dependencies.py +11 -7
  8. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/pyprojecttoml.py +22 -12
  9. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/requirementstxt.py +9 -4
  10. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/uvlock.py +11 -10
  11. {python_update_checker-0.6 → python_update_checker-0.7}/.gitignore +0 -0
  12. {python_update_checker-0.6 → python_update_checker-0.7}/.ruff.toml +0 -0
  13. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/__init__.py +0 -0
  14. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/cli.py +0 -0
  15. {python_update_checker-0.6 → python_update_checker-0.7}/src/puc/logging.py +0 -0
  16. {python_update_checker-0.6 → python_update_checker-0.7}/tests/__init__.py +0 -0
  17. {python_update_checker-0.6 → python_update_checker-0.7}/tests/data/other-requirements.txt +0 -0
  18. {python_update_checker-0.6 → python_update_checker-0.7}/tests/data/pyproject.toml +0 -0
  19. {python_update_checker-0.6 → python_update_checker-0.7}/tests/data/pyproject_compatible.toml +0 -0
  20. {python_update_checker-0.6 → python_update_checker-0.7}/tests/data/requirements.txt +0 -0
  21. {python_update_checker-0.6 → python_update_checker-0.7}/tests/data/uv.lock +0 -0
  22. {python_update_checker-0.6 → python_update_checker-0.7}/tests/test_latest.py +0 -0
  23. {python_update_checker-0.6 → python_update_checker-0.7}/tests/test_pyproject_toml.py +0 -0
  24. {python_update_checker-0.6 → python_update_checker-0.7}/tests/test_requirements_txt.py +0 -0
  25. {python_update_checker-0.6 → python_update_checker-0.7}/tests/test_uv_lock.py +0 -0
@@ -60,7 +60,7 @@ init: ## install python virtual env and required development packages
60
60
  ############ Linting and syntax checks ############
61
61
 
62
62
  .PHONY: lint
63
- lint: lint-py lint-shell
63
+ lint: lint-py lint-shell lint-md
64
64
 
65
65
  .PHONY: lint-py
66
66
  lint-py: ## lint python code
@@ -70,14 +70,21 @@ lint-py: ## lint python code
70
70
  lint-shell:
71
71
  shellcheck -x scripts/*.sh
72
72
 
73
+ .PHONY: lint-md
74
+ lint-md: ## lint markdown files
75
+ rumdl check *.md
76
+
73
77
  .PHONY: audit
74
78
  audit: ## run audit checks
79
+ zizmor --pedantic .github/workflows/python-package.yml
75
80
  uv audit
76
81
 
77
82
  .PHONY: reformat
78
83
  reformat: ## format the python code
79
84
  ruff check --fix $(PY_FILES_DIRS)
80
85
  ruff format $(PY_FILES_DIRS)
86
+ shfmt -w scripts/
87
+ tombi format pyproject.toml
81
88
 
82
89
  .PHONY: checkoutdated checkoutdated-py checkoutdated-gh
83
90
  checkoutdated: checkoutdated-py checkoutdated-gh
@@ -88,20 +95,29 @@ checkoutdated-py: ## Check for outdated package requirements
88
95
  --exclude-newer-package "python-update-checker=1 minute" \
89
96
  check pyproject.toml uv.lock
90
97
 
91
- checkoutdated-gh: ## check for outdated github projects
98
+ checkoutdated-gh: checkratelimit-gh ## check for outdated github projects
92
99
  # github-check-outdated is a local tool which compares a given version with the latest available github release version
93
100
  # see https://gist.github.com/wummel/ef14989766009effa4e262b01096fc8c for an example implementation
94
101
  @echo "Check for outdated Github tools"
95
102
  github-check-outdated astral-sh uv "$(shell uv --version | cut -f2 -d" ")"
96
103
  github-check-outdated python cpython v$(shell python --version | cut -f2 -d" ") '^v3\.14\.[0-9]+$$'
97
104
 
105
+ .PHONY: checkratelimit-gh
106
+ checkratelimit-gh: ## test for rate limiting
107
+ (
108
+ set +e
109
+ github-check-outdated astral-sh uv 0 > /dev/null
110
+ if [ "$$?" == 2 ]; then exit 1; fi
111
+ )
112
+
98
113
 
99
114
  .PHONY: upgradeoutdated
100
115
  upgradeoutdated: upgradeoutdated-gh upgradeoutdated-py
101
116
 
102
117
  .PHONY: upgradeoutdated-gh
103
- upgradeoutdated-gh:
118
+ upgradeoutdated-gh: checkratelimit-gh
104
119
  sed -i -e 's/uv_version_dev = ".*"/uv_version_dev = "$(shell github-check-outdated astral-sh uv 0 | cut -f4 -d" ")"/' pyproject.toml
120
+ sed -i -e 's/ version: ".*"/ version: "$(shell github-check-outdated astral-sh uv 0 | cut -f4 -d" ")"/' .github/workflows/python-package.yml
105
121
  sed -i -e 's/python_version_dev = ".*"/python_version_dev = "$(shell github-check-outdated python cpython 0 '^v3\.14\.[0-9]+$$' | cut -f4 -d" " | cut -b2-)"/' pyproject.toml
106
122
  scripts/install_dev.sh
107
123
 
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-update-checker
3
- Version: 0.6
3
+ Version: 0.7
4
4
  License-Expression: GPL-3.0-only
5
+ Classifier: Development Status :: 4 - Beta
5
6
  Classifier: Environment :: Console
6
7
  Classifier: Intended Audience :: Developers
7
- Classifier: Development Status :: 4 - Beta
8
8
  Classifier: Operating System :: OS Independent
9
9
  Classifier: Programming Language :: Python :: 3 :: Only
10
10
  Classifier: Programming Language :: Python :: 3.11
@@ -16,21 +16,25 @@ Requires-Dist: packaging>=26.1
16
16
  Requires-Python: >=3.11
17
17
  Description-Content-Type: text/markdown
18
18
 
19
- python-update-checker
20
- ======================
19
+ # python-update-checker
20
+
21
21
  Python-update-checker (puc) checks or updates pinned dependencies
22
22
  in `pyproject.toml`, `requirements.txt` or `uv.lock` files.
23
23
 
24
- See https://github.com/astral-sh/uv/issues/6794 for a discussion
25
- about different pinning strategies.
24
+ If you are developing an application you should pin all dependencies.
25
+ When developing a library, only development dependencies should be pinned.
26
+ Since puc updates pinned dependencies, it is mostly suitable
27
+ when developing applications.
26
28
 
29
+ See [https://github.com/astral-sh/uv/issues/6794] for a discussion
30
+ about different pinning strategies.
27
31
 
28
- Features
29
- ---------
32
+ ## Features
30
33
 
31
34
  * updates pinned dependencies, ignores unpinned dependencies
32
35
  * supports pyproject.toml, uv.lock and requirements.txt formats
33
- * supports `[project.dependencies]`, `[project.optional-dependencies]` and `[dependency-groups]` in pyproject.toml
36
+ * supports `[project.dependencies]`, `[project.optional-dependencies]`
37
+ and `[dependency-groups]` in pyproject.toml
34
38
  * supports recursive references (-r) in requirements.txt formats
35
39
  * can run in check only mode, ie. it checks if updates are available
36
40
  * limit updates to specific packages
@@ -39,11 +43,18 @@ Features
39
43
  * (limited) support for environment markers, ie. `"pywin32==311; os_name=='nt'"`
40
44
  * runs on Linux, MacOS and Windows platforms
41
45
 
46
+ ## Quickstart
47
+
48
+ ```bash
49
+
50
+ uvx --from python-update-checker puc --exclude-newer "1 day" update pyproject.toml
51
+ uv sync
52
+ ```
42
53
 
43
- Examples
44
- ---------
54
+ ## Examples
45
55
 
46
56
  ```bash
57
+
47
58
  $ # check all pinned packages for updates in pyproject.toml
48
59
  $ puc check pyproject.toml
49
60
  puc INFO: check pyproject file pyproject.toml
@@ -55,6 +66,8 @@ $ puc --exclude-newer="7 days" update pyproject.toml
55
66
  puc INFO: update pyproject file pyproject.toml
56
67
  puc INFO: updating 'ty==0.0.29' --> 0.0.31
57
68
  puc INFO: Wrote 1 updated package version(s) to pyproject.toml
69
+ $ # update the project environment after upgrading pyproject.toml
70
+ $ uv sync
58
71
 
59
72
  $ # check all pinned packages for updates in requirements.txt
60
73
  $ puc check requirements.txt
@@ -65,52 +78,49 @@ puc WARNING: found update 'Django==5.2.0' --> 6.0.4
65
78
  $ # update only the django package version in requirements.txt
66
79
  $ # limit updates to django versions less than 6
67
80
  $ puc --package="Django" --constraints="Django<6" update requirements.txt
68
- INFO: update requirements file requirements.txt
69
- INFO: updating 'Django==5.2.0' --> 5.2.13
70
- INFO: Wrote 1 updated package version(s) to requirements.txt
81
+ puc INFO: update requirements file requirements.txt
82
+ puc INFO: updating 'Django==5.2.0' --> 5.2.13
83
+ puc INFO: Wrote 1 updated package version(s) to requirements.txt
71
84
  ```
72
85
 
73
- Script behaviour
74
- -----------------
86
+ ## Script behaviour
75
87
 
76
88
  The exit code of `puc check` is non-zero when updates are available.
77
89
 
78
90
  Checking a `pyproject.toml` or `uv.lock`file with `puc` should be done
79
91
  from the directory of the `pyproject.toml` file,
80
- especially if your project relies on a [project directory](https://docs.astral.sh/uv/concepts/projects/layout/) (for example to define additional package indexes in pyproject.toml).
92
+ especially if your project relies on a [project directory](https://docs.astral.sh/uv/concepts/projects/layout/)
93
+ (for example to define additional package indexes in pyproject.toml).
81
94
 
82
95
  After updating versions in pyproject.toml, run `uv lock --upgrade` to update
83
- the transitive dependencies in `uv.lock`.
84
-
85
- Pinned dependencies are packages with `==` or `===` constraints and no wildcards in the version.
96
+ the transitive dependencies in `uv.lock` and `uv sync` to update your
97
+ virtual environment.
86
98
 
99
+ Pinned dependencies are packages with `==` or `===` constraints
100
+ and no wildcards in the version.
87
101
 
88
- Installation
89
- -------------
102
+ ## Installation
90
103
 
91
104
  1) Install [python uv](https://docs.astral.sh/uv/getting-started/installation/)
92
- 2) Install puc with `uv pip install python-update-checker`.
105
+ 2) Install puc with `uv pip install python-update-checker`
106
+ or run with `uvx --from python-update-checker puc ...`
93
107
 
94
-
95
-
96
- Architecture
97
- -------------
108
+ ## Architecture
98
109
 
99
110
  Dependencies are
100
111
 
101
112
  * [uv](https://docs.astral.sh/uv/):
102
113
  The uv binary must be available for the script to call.
103
114
  puc uses `echo "package" | uv pip compile -` to get latest package versions.
104
- puc uses `uv add "package==<version>"` to update pyproject.toml dependencies.
115
+ puc uses `uv add "package==<version>"` to update pyproject.toml
116
+ dependencies and `uv lock --upgrade-package` to update uv.lock dependencies.
105
117
 
106
118
  * [packaging](https://packaging.pypa.io/):
107
119
  Parses dependencies with the packaging.requirements.Requirement class.
108
120
 
109
121
  puc needs Python >= 3.11 since it uses the tomllib Python module.
110
122
 
111
-
112
- Limitations
113
- ------------
123
+ ## Limitations
114
124
 
115
125
  * No support for custom dependency formats in pyproject.toml
116
126
  (eg. `[tool.poetry.dependencies]`).
@@ -1,18 +1,22 @@
1
- python-update-checker
2
- ======================
1
+ # python-update-checker
2
+
3
3
  Python-update-checker (puc) checks or updates pinned dependencies
4
4
  in `pyproject.toml`, `requirements.txt` or `uv.lock` files.
5
5
 
6
- See https://github.com/astral-sh/uv/issues/6794 for a discussion
7
- about different pinning strategies.
6
+ If you are developing an application you should pin all dependencies.
7
+ When developing a library, only development dependencies should be pinned.
8
+ Since puc updates pinned dependencies, it is mostly suitable
9
+ when developing applications.
8
10
 
11
+ See [https://github.com/astral-sh/uv/issues/6794] for a discussion
12
+ about different pinning strategies.
9
13
 
10
- Features
11
- ---------
14
+ ## Features
12
15
 
13
16
  * updates pinned dependencies, ignores unpinned dependencies
14
17
  * supports pyproject.toml, uv.lock and requirements.txt formats
15
- * supports `[project.dependencies]`, `[project.optional-dependencies]` and `[dependency-groups]` in pyproject.toml
18
+ * supports `[project.dependencies]`, `[project.optional-dependencies]`
19
+ and `[dependency-groups]` in pyproject.toml
16
20
  * supports recursive references (-r) in requirements.txt formats
17
21
  * can run in check only mode, ie. it checks if updates are available
18
22
  * limit updates to specific packages
@@ -21,11 +25,18 @@ Features
21
25
  * (limited) support for environment markers, ie. `"pywin32==311; os_name=='nt'"`
22
26
  * runs on Linux, MacOS and Windows platforms
23
27
 
28
+ ## Quickstart
29
+
30
+ ```bash
31
+
32
+ uvx --from python-update-checker puc --exclude-newer "1 day" update pyproject.toml
33
+ uv sync
34
+ ```
24
35
 
25
- Examples
26
- ---------
36
+ ## Examples
27
37
 
28
38
  ```bash
39
+
29
40
  $ # check all pinned packages for updates in pyproject.toml
30
41
  $ puc check pyproject.toml
31
42
  puc INFO: check pyproject file pyproject.toml
@@ -37,6 +48,8 @@ $ puc --exclude-newer="7 days" update pyproject.toml
37
48
  puc INFO: update pyproject file pyproject.toml
38
49
  puc INFO: updating 'ty==0.0.29' --> 0.0.31
39
50
  puc INFO: Wrote 1 updated package version(s) to pyproject.toml
51
+ $ # update the project environment after upgrading pyproject.toml
52
+ $ uv sync
40
53
 
41
54
  $ # check all pinned packages for updates in requirements.txt
42
55
  $ puc check requirements.txt
@@ -47,52 +60,49 @@ puc WARNING: found update 'Django==5.2.0' --> 6.0.4
47
60
  $ # update only the django package version in requirements.txt
48
61
  $ # limit updates to django versions less than 6
49
62
  $ puc --package="Django" --constraints="Django<6" update requirements.txt
50
- INFO: update requirements file requirements.txt
51
- INFO: updating 'Django==5.2.0' --> 5.2.13
52
- INFO: Wrote 1 updated package version(s) to requirements.txt
63
+ puc INFO: update requirements file requirements.txt
64
+ puc INFO: updating 'Django==5.2.0' --> 5.2.13
65
+ puc INFO: Wrote 1 updated package version(s) to requirements.txt
53
66
  ```
54
67
 
55
- Script behaviour
56
- -----------------
68
+ ## Script behaviour
57
69
 
58
70
  The exit code of `puc check` is non-zero when updates are available.
59
71
 
60
72
  Checking a `pyproject.toml` or `uv.lock`file with `puc` should be done
61
73
  from the directory of the `pyproject.toml` file,
62
- especially if your project relies on a [project directory](https://docs.astral.sh/uv/concepts/projects/layout/) (for example to define additional package indexes in pyproject.toml).
74
+ especially if your project relies on a [project directory](https://docs.astral.sh/uv/concepts/projects/layout/)
75
+ (for example to define additional package indexes in pyproject.toml).
63
76
 
64
77
  After updating versions in pyproject.toml, run `uv lock --upgrade` to update
65
- the transitive dependencies in `uv.lock`.
66
-
67
- Pinned dependencies are packages with `==` or `===` constraints and no wildcards in the version.
78
+ the transitive dependencies in `uv.lock` and `uv sync` to update your
79
+ virtual environment.
68
80
 
81
+ Pinned dependencies are packages with `==` or `===` constraints
82
+ and no wildcards in the version.
69
83
 
70
- Installation
71
- -------------
84
+ ## Installation
72
85
 
73
86
  1) Install [python uv](https://docs.astral.sh/uv/getting-started/installation/)
74
- 2) Install puc with `uv pip install python-update-checker`.
87
+ 2) Install puc with `uv pip install python-update-checker`
88
+ or run with `uvx --from python-update-checker puc ...`
75
89
 
76
-
77
-
78
- Architecture
79
- -------------
90
+ ## Architecture
80
91
 
81
92
  Dependencies are
82
93
 
83
94
  * [uv](https://docs.astral.sh/uv/):
84
95
  The uv binary must be available for the script to call.
85
96
  puc uses `echo "package" | uv pip compile -` to get latest package versions.
86
- puc uses `uv add "package==<version>"` to update pyproject.toml dependencies.
97
+ puc uses `uv add "package==<version>"` to update pyproject.toml
98
+ dependencies and `uv lock --upgrade-package` to update uv.lock dependencies.
87
99
 
88
100
  * [packaging](https://packaging.pypa.io/):
89
101
  Parses dependencies with the packaging.requirements.Requirement class.
90
102
 
91
103
  puc needs Python >= 3.11 since it uses the tomllib Python module.
92
104
 
93
-
94
- Limitations
95
- ------------
105
+ ## Limitations
96
106
 
97
107
  * No support for custom dependency formats in pyproject.toml
98
108
  (eg. `[tool.poetry.dependencies]`).
@@ -1,17 +1,13 @@
1
1
  [project]
2
2
  name = "python-update-checker"
3
- version = "0.6"
3
+ version = "0.7"
4
+ readme = "README.md"
4
5
  requires-python = ">=3.11"
5
6
  license = "GPL-3.0-only"
6
- license_files = [
7
- "COPYING",
8
- ]
9
- readme = "README.md"
10
- # https://pypi.org/classifiers/
11
7
  classifiers = [
8
+ "Development Status :: 4 - Beta",
12
9
  "Environment :: Console",
13
10
  "Intended Audience :: Developers",
14
- "Development Status :: 4 - Beta",
15
11
  "Operating System :: OS Independent",
16
12
  "Programming Language :: Python :: 3 :: Only",
17
13
  "Programming Language :: Python :: 3.11",
@@ -20,40 +16,36 @@ classifiers = [
20
16
  "Programming Language :: Python :: 3.14",
21
17
  "Topic :: Software Development :: Build Tools",
22
18
  ]
23
- dependencies = [
24
- # track compatibility for dependencies, do not pin
25
- "packaging>=26.1",
26
- ]
19
+ dependencies = ["packaging>=26.1"]
20
+ license_files = ["COPYING"]
27
21
 
28
22
  [project.scripts]
29
23
  puc = "puc:cli.main"
30
24
 
31
25
  [dependency-groups]
32
- # these packages are only needed for development
33
26
  dev = [
34
- # for python code linting
35
- "ruff==0.15.12",
36
- # for python type checking
37
- "ty==0.0.34",
38
- # for testing
39
- "pytest==9.0.3",
27
+ "pytest==9.1.1",
28
+ "ruff==0.16.4",
29
+ "rumdl==0.2.61",
30
+ "tombi==1.4.1",
31
+ "ty==0.0.75",
32
+ "zizmor==1.29.0",
40
33
  ]
41
34
 
42
35
  [build-system]
43
- requires = ["uv_build>=0.11,<0.12"]
36
+ requires = ["uv_build>=0.11.32,<0.13"]
44
37
  build-backend = "uv_build"
45
38
 
39
+ [tool.project]
40
+ python_version_dev = "3.14.7"
41
+ uv_version_dev = "0.12.9"
42
+
46
43
  [tool.uv.build-backend]
47
44
  module-name = "puc"
48
45
  source-include = [
49
- ".gitignore",
50
- ".ruff.toml",
51
- "Makefile",
52
- "scripts/**",
53
- "tests/**",
46
+ ".gitignore",
47
+ ".ruff.toml",
48
+ "Makefile",
49
+ "scripts/**",
50
+ "tests/**",
54
51
  ]
55
-
56
- [tool.project]
57
- # pin versions of Python and uv for development
58
- python_version_dev = "3.14.5"
59
- uv_version_dev = "0.11.14"
@@ -0,0 +1,65 @@
1
+ [project]
2
+ name = "python-update-checker"
3
+ version = "0.7"
4
+ readme = "README.md"
5
+ requires-python = ">=3.11"
6
+ license = "GPL-3.0-only"
7
+ # https://pypi.org/classifiers/
8
+ classifiers = [
9
+ "Development Status :: 4 - Beta",
10
+ "Environment :: Console",
11
+ "Intended Audience :: Developers",
12
+ "Operating System :: OS Independent",
13
+ "Programming Language :: Python :: 3 :: Only",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ "Topic :: Software Development :: Build Tools",
19
+ ]
20
+ dependencies = [
21
+ # track compatibility for dependencies, do not pin
22
+ "packaging>=26.1",
23
+ ]
24
+ license_files = [
25
+ "COPYING",
26
+ ]
27
+
28
+ [project.scripts]
29
+ puc = "puc:cli.main"
30
+
31
+ [dependency-groups]
32
+ # these packages are only needed for development
33
+ dev = [
34
+ # for testing
35
+ "pytest==9.1.1",
36
+ # for python code linting
37
+ "ruff==0.16.4",
38
+ # Markdown style checking and formatting
39
+ "rumdl==0.2.61",
40
+ # reformat toml files
41
+ "tombi==1.4.1",
42
+ # for python type checking
43
+ "ty==0.0.75",
44
+ # for auditing github actions
45
+ "zizmor==1.29.0",
46
+ ]
47
+
48
+ [build-system]
49
+ requires = ["uv_build>=0.11.32,<0.13"]
50
+ build-backend = "uv_build"
51
+
52
+ [tool.project]
53
+ # pin versions of Python and uv for development
54
+ python_version_dev = "3.14.7"
55
+ uv_version_dev = "0.12.9"
56
+
57
+ [tool.uv.build-backend]
58
+ module-name = "puc"
59
+ source-include = [
60
+ ".gitignore",
61
+ ".ruff.toml",
62
+ "Makefile",
63
+ "scripts/**",
64
+ "tests/**",
65
+ ]
@@ -44,7 +44,7 @@ install_package() {
44
44
  local pkg=$1
45
45
  if ! dpkg --status "${pkg}" >/dev/null 2>&1; then
46
46
  echo "Installing ${pkg}"
47
- sudo apt-get install "${pkg}"
47
+ sudo apt-get install --assume-yes "${pkg}"
48
48
  fi
49
49
  }
50
50
 
@@ -58,6 +58,8 @@ install_package curl
58
58
  install_package direnv
59
59
  # lint shell
60
60
  install_package shellcheck
61
+ # for formatting shell scripts (used by make reformat)
62
+ install_package shfmt
61
63
 
62
64
  # the rest of this scripts relies on being in the project directory
63
65
  cd "${PROJECTDIR}"
@@ -4,6 +4,7 @@
4
4
 
5
5
  import subprocess
6
6
  import re
7
+ import logging
7
8
  from packaging.requirements import Requirement
8
9
  from packaging.markers import Variable, MarkerList
9
10
  from packaging.version import parse as parse_version
@@ -12,9 +13,9 @@ from .logging import logger
12
13
 
13
14
  def get_latest_version(
14
15
  package: str,
15
- exclude_newer: None | str = None,
16
- exclude_newer_package: None | str = None,
17
- constraint_file: None | str = None,
16
+ exclude_newer: str | None = None,
17
+ exclude_newer_package: str | None = None,
18
+ constraint_file: str | None = None,
18
19
  python_platform: str | None = None,
19
20
  python_version: str | None = None,
20
21
  ) -> str:
@@ -28,12 +29,15 @@ def get_latest_version(
28
29
  "compile",
29
30
  "-",
30
31
  "--color=never",
31
- "--quiet",
32
32
  "--no-deps",
33
33
  "--no-header",
34
34
  "--no-annotate",
35
35
  "--no-progress",
36
36
  ]
37
+ if logger.getEffectiveLevel() <= logging.DEBUG:
38
+ cmd.append("--verbose")
39
+ else:
40
+ cmd.append("--quiet")
37
41
  if exclude_newer:
38
42
  cmd.extend(("--exclude-newer", exclude_newer))
39
43
  if exclude_newer_package:
@@ -122,9 +126,9 @@ def get_min_python_version_from_req(pkg_req: Requirement) -> str | None:
122
126
 
123
127
  def parse_requirement(
124
128
  line: str,
125
- exclude_newer: None | str = None,
126
- constraint_file: None | str = None,
127
- ) -> None | str | Requirement:
129
+ exclude_newer: str | None = None,
130
+ constraint_file: str | None = None,
131
+ ) -> str | Requirement | None:
128
132
  """Parse one line of a requirements.txt file."""
129
133
  line = line.strip()
130
134
  if not line or line.startswith("#"):
@@ -5,6 +5,7 @@
5
5
  import subprocess
6
6
  import os
7
7
  import tomllib
8
+ import logging
8
9
  from packaging.utils import canonicalize_name
9
10
  from packaging.requirements import Requirement
10
11
 
@@ -14,16 +15,17 @@ from .dependencies import (
14
15
  get_python_platform_from_req,
15
16
  get_min_python_version_from_req,
16
17
  check_requirement,
18
+ is_newer_version,
17
19
  )
18
20
 
19
21
 
20
22
  def handle_pyproject_toml(
21
23
  pyproject_path: str,
22
- command: None | str = None,
24
+ command: str | None = None,
23
25
  packages=None,
24
- exclude_newer: None | str = None,
25
- exclude_newer_package: None | str = None,
26
- constraint_file: None | str = None,
26
+ exclude_newer: str | None = None,
27
+ exclude_newer_package: str | None = None,
28
+ constraint_file: str | None = None,
27
29
  color: bool = True,
28
30
  ) -> int:
29
31
  """Check or update pinned dependencies of a pyproject.toml file.
@@ -96,13 +98,13 @@ def update_pyproject_dependencies(
96
98
  dependencies: list[str | dict],
97
99
  project_dir: str,
98
100
  projectname: str,
99
- group: None | str = None,
101
+ group: str | None = None,
100
102
  optional=False,
101
- command: None | str = None,
103
+ command: str | None = None,
102
104
  packages=None,
103
- exclude_newer: None | str = None,
104
- exclude_newer_package: None | str = None,
105
- constraint_file: None | str = None,
105
+ exclude_newer: str | None = None,
106
+ exclude_newer_package: str | None = None,
107
+ constraint_file: str | None = None,
106
108
  color: bool = True,
107
109
  ) -> int:
108
110
  """Update given dependency list of a pyproject.toml file."""
@@ -140,6 +142,10 @@ def update_pyproject_dependencies(
140
142
  spec = next(s for s in pkg_req.specifier)
141
143
  if latest_version is not None and latest_version != spec.version:
142
144
  updatable += 1
145
+ if not is_newer_version(spec.version, latest_version):
146
+ logger.warning(
147
+ f"{pkg_req.name} latest version {latest_version} is older than specified version {spec.version}"
148
+ )
143
149
  version = (
144
150
  colorize_updated_version(spec.version, latest_version)
145
151
  if color
@@ -160,7 +166,7 @@ def update_pyproject_pkg(
160
166
  dependency: str,
161
167
  package: str,
162
168
  projectdir: str,
163
- group: None | str = None,
169
+ group: str | None = None,
164
170
  optional: bool = False,
165
171
  ) -> None:
166
172
  """Update one package in pyproject.toml."""
@@ -169,11 +175,15 @@ def update_pyproject_pkg(
169
175
  "add",
170
176
  "--project",
171
177
  projectdir,
172
- "--quiet",
173
178
  "--frozen",
174
179
  "--color=never",
175
- f"--upgrade-package={package}",
180
+ "--upgrade-package",
181
+ package,
176
182
  ]
183
+ if logger.getEffectiveLevel() <= logging.DEBUG:
184
+ command.append("--verbose")
185
+ else:
186
+ command.append("--quiet")
177
187
  if optional and group:
178
188
  command.append("--optional")
179
189
  command.append(group)
@@ -14,6 +14,7 @@ from .dependencies import (
14
14
  get_python_platform_from_req,
15
15
  get_min_python_version_from_req,
16
16
  parse_requirement,
17
+ is_newer_version,
17
18
  )
18
19
 
19
20
 
@@ -23,11 +24,11 @@ max_rec_level = 5
23
24
 
24
25
  def handle_requirements_txt(
25
26
  requirements_txt_path: str,
26
- command: None | str = None,
27
+ command: str | None = None,
27
28
  packages=None,
28
- exclude_newer: None | str = None,
29
- exclude_newer_package: None | str = None,
30
- constraint_file: None | str = None,
29
+ exclude_newer: str | None = None,
30
+ exclude_newer_package: str | None = None,
31
+ constraint_file: str | None = None,
31
32
  color: bool = True,
32
33
  rec_level: int = 0,
33
34
  handled_files: list[str] | None = None,
@@ -91,6 +92,10 @@ def handle_requirements_txt(
91
92
  output.write(line)
92
93
  elif latest_version is not None and latest_version != spec.version:
93
94
  updatable += 1
95
+ if not is_newer_version(spec.version, latest_version):
96
+ logger.warning(
97
+ f"{pkg_req.name} latest version {latest_version} is older than specified version {spec.version}"
98
+ )
94
99
  version = (
95
100
  colorize_updated_version(spec.version, latest_version)
96
101
  if color
@@ -16,11 +16,11 @@ from .dependencies import (
16
16
 
17
17
  def handle_uv_lock(
18
18
  uvlock_path: str,
19
- command: None | str = None,
19
+ command: str | None = None,
20
20
  packages=None,
21
- exclude_newer: None | str = None,
22
- exclude_newer_package: None | str = None,
23
- constraint_file: None | str = None,
21
+ exclude_newer: str | None = None,
22
+ exclude_newer_package: str | None = None,
23
+ constraint_file: str | None = None,
24
24
  color: bool = True,
25
25
  ) -> int:
26
26
  """Check or update pinned dependencies of a uv.lock file."""
@@ -69,11 +69,11 @@ def update_uvlock_dependency(
69
69
  package,
70
70
  version,
71
71
  project_dir: str,
72
- command: None | str = None,
72
+ command: str | None = None,
73
73
  packages=None,
74
- exclude_newer: None | str = None,
75
- exclude_newer_package: None | str = None,
76
- constraint_file: None | str = None,
74
+ exclude_newer: str | None = None,
75
+ exclude_newer_package: str | None = None,
76
+ constraint_file: str | None = None,
77
77
  color: bool = True,
78
78
  ) -> int:
79
79
  """Update uv lock dependency."""
@@ -114,7 +114,7 @@ def update_uvlock_dependency(
114
114
  def update_uvlock_pkg(
115
115
  package: str,
116
116
  projectdir: str,
117
- exclude_newer: None | str = None,
117
+ exclude_newer: str | None = None,
118
118
  ) -> None:
119
119
  """Update one package in pyproject.toml."""
120
120
  command = [
@@ -124,7 +124,8 @@ def update_uvlock_pkg(
124
124
  projectdir,
125
125
  "--quiet",
126
126
  "--color=never",
127
- f"--upgrade-package={package}",
127
+ "--upgrade-package",
128
+ package,
128
129
  ]
129
130
  if exclude_newer:
130
131
  command.extend(