Commit graph

55 commits

Author SHA1 Message Date
Jussi Kukkonen
0b85ed570d Add a conformance test workflow
* The conformance test suite is likely to still change quite a bit so
  the workflow is not enabled on PRs yet
* The actual conformance client is copied from the tuf-conformance project
* This is mostly a test to see how things should work out, and a
  demonstration of how the tuf-conformance project should be used

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-07-10 16:15:36 +03:00
Jussi Kukkonen
419bfe34ec linting: Enable all Ruff rulesets by default
The goal here is to have ruff enable new rulesets when new releases are
made without us having to o anything: we can then decide if we disable
or not.

* Enable a couple more rulesets (ERA, INP, T )
* Add a few individual ignores to tests and examples
* Default to enable all, disable the rulesets we don't want

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-07 15:39:53 +03:00
Jussi Kukkonen
80882dbe7d lint: Enable flake8-annotations
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
dc5194e9e9 lint: Enable flake8-self
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
9a61be1bf4 lint: Enable flake8-executable
* Remove exectuable flag from a couple of files
* Half of the test files have a shebang (but are
  still not executable): remove the shebang

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
d6c1a22be1 lint: Enable flake8-unused-arguments
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
4244632a2f lint: Enable pygrep-hooks
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
460424a620 lint: Enable flake8-raise
I'm not sure I agree with not using the parens in
   raise SomeError
but being consistent is definitely better than not being consistent.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
7e52190bf0 lint: Enable flake8-pyi
"object" is slightly more informative than "Any" as annotation

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
981788bca2 lint: Enable flake8-pie
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-06 09:19:19 +03:00
Jussi Kukkonen
a7b832b88f Use securesystemslib 1.0.0
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-05-02 14:05:41 +03:00
E3E
52601e2bd8 add RUF and BLE rulesets; ignore some broad exceptions (BLE001) and RUF012
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-04-21 01:37:40 -04:00
Lukas Puehringer
bc3ebd8e1e Constrain securesystemslib dependency to <0.32.0
There are several breaking changes coming up in securesystemslib on its
way to 1.0.

To not disrupt tuf users this patch constrains securesystemslib to not
update the current minor version..

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2024-04-03 17:46:57 +02:00
Jussi Kukkonen
009e1ddbf4 lint: Enable more ruff ulesets
Minor fixes were needed, the only possibly interesting one is
the one in RequestsFetcher (use "yield from").

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-04-02 11:02:48 +03:00
Jussi Kukkonen
1512653995 linter: Enable more rules
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-03-19 16:30:52 +02:00
Jussi Kukkonen
d95cff9a70 lint: Enable flake8-bugbear and flake8-datetimez
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-03-08 15:02:45 +02:00
Jussi Kukkonen
009566aa23 lint: Start using ruff ruleset "flake8-bandit"
* Remove bandit
* Add ruff ruleset "flake8-bandit"
* verify_release is now checked by bandit
  * Avoid some asserts as suggested
  * ignore a subprocess.run lint: it seems dumb
* ignore all bandit rules for tests and examples (just like before)

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-02-23 18:27:29 +02:00
Jussi Kukkonen
56b362ab78 lint: Enable pycodestyle in tests
Only leave E501 (line-too-long) disabled: There is a lot of embedded
test data that is not formatted according to the rules.

Fixes #2568

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2024-02-21 22:08:43 +02:00
E3E
f156e21537 remove pylint and suppressed inline errors from pylint
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-20 22:57:53 -05:00
E3E
da38b473bd add pylint ruleset to ruff
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-20 16:04:06 -05:00
E3E
73842c97b8 reformat docstrings and supress small errors inline
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-20 15:19:33 -05:00
E3E
206c9424f1 Add to linting Configuration:
- adpot changes in dependabot.yml and remove --diff from ruff check.
- select pydocstyle, isort, pyflakes, pep8-naming, pycodestyle for ruff and ignore some small issues / add inline comments.
- adjust docstring length to 80 in various files

Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-20 00:34:47 -05:00
E3E
4a53013548 use correct ruff command and add ignore unused imports
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-18 00:17:33 -05:00
E3E
e379507e63 replace black and isort for ruff. I still haven't replaced ruff with pylint
Signed-off-by: E3E <ntanzill@purdue.edu>
2024-02-16 23:56:08 -05:00
Lukas Puehringer
dd9b5e0da2 build: add workaround to auto-update build system
Dependabot does not support `build-system.requires`. To get
reproducibility and auto-updates, we pin the version in a regular
requirements file and use it as constraint during build.

fixes: #2529
upstream issue: dependabot/dependabot-core#8465
h/t @jku

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2023-12-13 12:32:00 +01:00
Lukas Puehringer
7c5f5d2517 build: Upgrade hatchling to 1.20.0
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2023-12-13 09:49:15 +01:00
Lukas Puehringer
00be49b6b5 build: Upgrade hatchling to 1.19.1
Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2023-12-12 11:20:09 +01:00
Jussi Kukkonen
e989c14ee9
Merge pull request #2518 from NicholasTanz/enable_python3.12
build: Enable python 3.12
2023-12-04 09:02:09 +01:00
E3E
4e1d8a7ad3 enable python 3.12
Signed-off-by: E3E <ntanzill@purdue.edu>
2023-12-02 23:28:34 -05:00
Lukas Puehringer
a61172a155 build: Upgrade hatchling to latest release
This is not tracked by dependabot so needs manual updates.

Manually tested by building with previous and new hatchling version
and diffing unzipped/untared wheel and sdist.

There were no unexpected changes.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2023-11-30 10:25:23 +01:00
Jussi Kukkonen
e37769e252 Drop support for Python 3.7
* Python 3.7 is EOL.
* Our runtime dependencies are still ok with 3.7
* Testing dependencies have started requiring 3.8

Stop supporting and testing Python 3.7.

We could just stop testing Python 3.7 (while claiming to still support
it) but that seems like it'll lead to trouble: we will inevitably use
some 3.8 feature and then won't notice because we don't test 3.7 any
more.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2023-09-07 15:52:36 +03:00
Jussi Kukkonen
9684fc6340 build: Upgrade hatchling to latest release
This is not tracked by dependabot so needs manual updates.
Manually tested: no unexpected changes in the release artifacts.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2023-02-15 10:40:37 +02:00
Jussi Kukkonen
33829fdbab build: Move requirements file to a directory
We already have 6 files and I'm planning to add another one: maybe it's
time to move these out of the top level directory.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2023-02-06 14:50:47 +02:00
Fridolin Pokorny
0cca1d6a96
Install pydocstyle for checking docstrings
Signed-off-by: Fridolin Pokorny <fridolin.pokorny@datadoghq.com>
2023-02-06 13:19:51 +01:00
Jussi Kukkonen
8278f3f805 packaging: Depend on securesystemslib 0.26
We need signer.Key which was added in 0.26.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2023-01-27 20:45:29 +02:00
Jussi Kukkonen
49488530cb pyproject: Stop disabling urllib3 import checks in mypy
Double reasoning for this one:
* urllib3 now does have annotations
* since we don't import requests annotations (to avoid depending on typeshed)
  urllib3 annotations are never needed: we don't use urllib3 directly

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2022-11-21 11:59:36 +02:00
Lukas Puehringer
1980ca1f11 doc: update PyPI Development Status classifier
Since v1.0.0 python-tuf is no longer beta software.

See https://pypi.org/classifiers/ for available classifiers.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-11-18 14:23:37 +01:00
Jussi Kukkonen
0c07a84441
Merge pull request #2157 from jku/enable-py-3.11
build: Enable Python 3.11 in test matrix
2022-11-03 13:19:38 +02:00
UDITBALUJA
37313fbfc4 updated hatchling to current latest 1.11.1
Signed-off-by: UDITBALUJA <uditbaluja1000@gmail.com>
2022-10-29 19:27:53 +05:30
Jussi Kukkonen
5b59e7cfe6 build: Enable Python 3.11 in test matrix
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
2022-10-27 17:35:00 +03:00
Joshua Lock
ff6ec11b3b
Fix pyproject.toml license field (#2065)
Per PEP 621 this should be a table, not a string. This resolves failures
installing on systems with newer setuptools (v61.3.0 or newer:
https://setuptools.pypa.io/en/latest/history.html#v61-3-0).

Signed-off-by: Joshua Lock <jlock@vmware.com>
2022-07-26 12:00:18 -04:00
Jussi Kukkonen
eb23fff3af lint: Stop using requests annotations
requests project does not maintain annotations: typeshed project tries
to do it for them, and releases the annotations as "types-requests".

There's two main problems:
* typeshed releases constantly: this means a lot of test dependency
  updates
* typeshed releases are not tagged in git: updates are impossible to
  review

The benefit we get from types-requests is minimal as there is very
little requests-related code and it does not change often.

Remove annotations to lower the test dependency update churn.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-04-29 15:27:50 +03:00
Jussi Kukkonen
48a6b76299 build: Pin hatchling version
Building a specific release with specific build tools feels like correct
choice for reproducibility in general. It's also practically required
as the hatchling version is embedded in the WHEEL file: this means
updating the build tool modifies the resulting build artifact.

Pin hatchling version. This version should be kept up-to-date: my
working assumption is that Dependabot will handle it.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-04-28 12:17:45 +03:00
Lukas Puehringer
f4165fff3c Update build config to include examples dir
Explicitly include `examples` dir in sdist.

The same would be achieved, by removing explicit includes, which
currently would also add these files/dirs:

```
/gitattributes
/github
/mypy_cache
/readthedocs.yaml
/verify_release
```

Maybe we should instead of defining includes, explicitly exclude
(some of) these files? The advantage of a blacklist approach is
that it becomes less likely to forget including files that should
be in included.

See hatch docs for:
- what files should be in sdist
https://ofek.dev/hatch/latest/plugins/builder/#source-distribution

- what files get into sdist by default:
https://ofek.dev/hatch/latest/plugins/builder/#default-file-selection_1

- how to configure what files get into sdist:
https://ofek.dev/hatch/latest/config/build/#file-selection

Fixes #1901

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-04-21 14:06:11 +02:00
Ofek Lev
98db711cca Update package metadata
Signed-off-by: Ofek Lev <ofekmeister@gmail.com>
2022-03-18 11:30:07 -04:00
Jussi Kukkonen
5155ba7431 build: Single source version number
As of setuptools 46.4.0, one can accomplish single source version
number with
    version = attr: package.__version__
in setup.cfg: As long as setuptools simplified AST parser is able to
read the file, this works without actually importing anything.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
2022-03-03 15:30:13 +02:00
Lukas Puehringer
ad6d2cad8a Update misc repo metadata after legacy code drop
- Update linter config to no longer distinguish between legacy
and new implementation. This requires addressing a linter warning
in an until now not linted module (tuf/__init__.py).

- Remove obsolete rules in MANIFEST.in (source distribution) and
tests/.coveragerc (test coverage).

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2022-01-26 15:25:40 +01:00
Martin Vrachev
811fa2756f Mypy: disable attr-defined warning
Mypy warns us when we assign a not defined variable to an object, but
that is something that we are warned for from pylint (seach for
"pylint: disable=no-member" in test_updater_key_rotations.py
and you will find an example where we have to disable it).
We don't want to have two linters checking for the same thing
as we can end up disabling two warnings that are actually the same
on a single line.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2021-12-09 16:44:25 +02:00
Martin Vrachev
2f689e70fb Start linting test files testing the new code
Exclude regexs/globs are needed to exclude the test files testing
the old code.
After we remove those files we will be able to remove the exclude
regex/globs.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2021-12-09 16:44:25 +02:00
Martin Vrachev
d697f73da2 Linting in tox.ini: use variable for target dirs
Instead of providing a target directory for linting by each of the
tools use one variable which will be the source of truth about which
directories do we lint.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
2021-12-02 14:12:05 +02:00