Repository: dennisvang/tufup (language: python)

Issue:
AttributeError: 'Root' object has no attribute 'revoke_key'. Did you mean: 'remove_key'?
"To get started, create a local example repository by running the
# repo_workflow_example.py script."
I run repo_workflow_example  and this error appeared
![image](https://user-images.githubusercontent.com/79363260/192118210-c45950c9-1b98-48ed-91fe-ea983fb87a17.png)



Discussion / hints:
@its-monotype Looks like you're running an old version of `python-tuf`.

`remove_key` was renamed to `revoke_key` in [python-tuf 2.0.0][1]

[1]: https://github.com/theupdateframework/python-tuf/blob/v2.0.0/docs/CHANGELOG.md
@dennisvang 
![Screenshot 2022-09-26 120539](https://user-images.githubusercontent.com/79363260/192250069-20692129-5619-4f1e-81ea-5f9ff1e39be4.png)
I manually updated tuf but you have some kind of dependency problem...
@its-monotype Not sure where that comes from, but your error message says 
> tufup 0.4.2 requires tuf==1.1.* ...

However, clearly, that's not true:

https://github.com/dennisvang/tufup/blob/0cfa708334e7df6f122d60d67c819ad030bfdb91/requirements.txt#L8

I think the best approach is:
- make sure you have the latest version of the `tufup` source code
- create a new `venv` from scratch
- install dependencies from the latest `requirements.txt` and `requirements-dev.txt`
@its-monotype By the way, I see [your prompt][1] now says `tufup-example`. 

Is this a `tufup` issue or a `tufup-example` issue?


[1]: https://github.com/dennisvang/tufup/issues/44#issuecomment-1257799668
The same problem is there and there, when I install tufup, it installs tuf 1.x.x as a dependency and not the 2.x.x.
But is this an issue with `tufup` or `tufup-example`?

Your first screenshot is from `tufup`. The second one is from `tufup-example`...
Yep, I understand, I want to say that I think it's tufup package related issue that when you do pip install tufup install as dependency tuf 1.x.x version and not the 2.x.x
The fact that `tufup` CI tests on Github all pass indicates that there is no dependency issue there (edit: in the requirements.txt).

I also verified `tufup-example` dependencies can be installed without issue in a fresh `venv`. 

Are you sure you are running the latest version of the original repo, not some fork, and that you've created an all new `venv`, without any customized installation steps?
I mean now, for example, I don't clone repo I just do pip install tufup and it installs tuf-1.1.0 as its dependency. Although I'm looking at the tuf repository in requirements.txt, everything is correctly indicated tuf==2.*. But why then does this happen?
@its-monotype Now I understand, and you're absolutely right.

This is quite embarassing: I forgot to update the `tuf` version in [setup.cfg][1].

This slipped through the cracks somehow...

Sorry for this. I'll fix it a.s.a.p.

[1]: https://github.com/dennisvang/tufup/blob/ba4ab2a3e2fb2a76ef534a77d726c7cb4b768cad/setup.cfg#L27

Fix patch:
diff --git a/pyproject.toml b/pyproject.toml
index b0f0765..09977b5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,3 @@
 [build-system]
-requires = ["setuptools>=42"]
+requires = ["setuptools>=61"]
 build-backend = "setuptools.build_meta"
diff --git a/requirements.txt b/requirements.txt
index 8358b7a..bba6989 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,17 @@
-# to upgrade packages in existing env: pip install -r requirements.txt --upgrade
+# install requirements from setup.cfg by calling `pip install .` from project root
 
-bsdiff4==1.2.*
-packaging==21.*
-requests
-securesystemslib[crypto,pynacl]==0.22.*
-setuptools>=61.0.0
-tuf==2.*
+bsdiff4==1.2.2
+certifi==2022.9.24
+cffi==1.15.1
+charset-normalizer==2.1.1
+cryptography==38.0.1
+idna==3.4
+packaging==21.3
+pycparser==2.21
+PyNaCl==1.5.0
+pyparsing==3.0.9
+requests==2.28.1
+securesystemslib==0.24.0
+setuptools==63.2.0
+tuf==2.0.0
+urllib3==1.26.12
diff --git a/setup.cfg b/setup.cfg
index 3973870..7c3210f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -23,8 +23,9 @@ python_requires = >=3.8
 install_requires =
     bsdiff4==1.2.*
     packaging==21.*
-    securesystemslib[crypto,pynacl]==0.22.*
-    tuf==1.1.*
+    securesystemslib[crypto,pynacl]==0.24.*
+    setuptools>=61.*.*
+    tuf==2.*
 
 [options.packages.find]
 where = src


Test patch:
diff --git a/tests/test_package.py b/tests/test_package.py
new file mode 100644
index 0000000..a6b2f79
--- /dev/null
+++ b/tests/test_package.py
@@ -0,0 +1,10 @@
+from unittest import TestCase
+
+from packaging.version import Version
+import tuf
+
+
+class PackageTests(TestCase):
+    def test_tuf_version(self):
+        # quick & dirty regression test for issue 44
+        self.assertGreaterEqual(Version(tuf.__version__), Version('2'))