-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
prospector: init and 1.2.0 + dependencies #77424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prospector: init and 1.2.0 + dependencies #77424
Conversation
|
pname = "setoptconf"; | ||
version = "0.2.0"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this package hasn't had an update in almost 6 years.... I don't think it belongs in a rolling release package set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where would you place it? it's needed by prospector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just have it alongside prospector in pkgs/development/tools/prospector/setoptconf.nix.
and just do:
setoptconf = python3.pkgs.callPackage ./setoptconf.nix
pkgs/top-level/python-packages.nix
Outdated
prospector = | ||
let | ||
pep8-naming' = callPackage ../development/python-modules/pep8-naming { }; | ||
in | ||
callPackage ../development/python-modules/prospector { | ||
pep8-naming = pep8-naming'.overrideAttrs(oldAttrs: rec { | ||
pname = "pep8-naming"; | ||
version = "0.4.1"; | ||
src = fetchPypi { | ||
inherit pname version; | ||
sha256 = "0nhf8p37y008shd4f21bkj5pizv8q0l8cpagyyb8gr059d6gvvaf"; | ||
}; | ||
}); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can't override python package versions like this, it will break if a user imports another python package which also imports the normal pep8-naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you just want to use this as an application, then you can do something similar to https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/aws-sam-cli/default.nix in which it's not exported as a python module, thus able to have divergent package versions.
But prospector cannot be in python-packages if it needs a different package set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just force-pushed the branch with this suggestions
kamado:~/Documents/nixpkgs$ nix-review rev HEAD
$ git -c fetch.prune=false fetch --force https://github.com/NixOS/nixpkgs master:refs/nix-review/0
remote: Enumerating objects: 1136, done.
remote: Counting objects: 100% (1136/1136), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 1752 (delta 1128), reused 1126 (delta 1126), pack-reused 616
Receiving objects: 100% (1752/1752), 1.02 MiB | 372.00 KiB/s, done.
Resolving deltas: 100% (1271/1271), completed with 474 local objects.
From https://github.com/NixOS/nixpkgs
ee7d45c638b..484014d1221 master -> refs/nix-review/0
$ git worktree add /home/kamado/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0/nixpkgs 484014d1221bfd490f7c1a17981f45c239d7999c
Preparing worktree (detached HEAD 484014d1221)
HEAD is now at 484014d1221 mako: 1.4 -> 1.4.1 (#77562)
$ nix-env -f /home/kamado/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0/nixpkgs -qaP --xml --out-path --show-trace
$ git merge --no-commit 35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0
Auto-merging pkgs/top-level/python-packages.nix
Auto-merging pkgs/top-level/all-packages.nix
Automatic merge went well; stopped before committing as requested
$ nix-env -f /home/kamado/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0/nixpkgs -qaP --xml --out-path --show-trace --meta
$ nix build --no-link --keep-going --max-jobs 4 --option build-use-sandbox true -f /home/kamado/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0/build.nix
[1 built, 0.0 MiB DL]
12 package were built:
prospector python27Packages.setoptconf python37Packages.pylint-celery python37Packages.pylint-django python37Packages.pylint-flask python37Packages.requirements-detector python37Packages.setoptconf python38Packages.pylint-celery python38Packages.pylint-django python38Packages.pylint-flask python38Packages.requirements-detector python38Packages.setoptconf
$ nix-shell /home/kamado/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0/shell.nix
innovation
[nix-shell:~/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0]$ prospector --help
usage: prospector [-h] [-0] [-A] [-u USES] [-B] [-D] [-T] [-8] [-m] [-F]
[--max-line-length MAX_LINE_LENGTH] [-M] [-S]
[-o OUTPUT_FORMAT] [--absolute-paths] [-t TOOLS]
[-w WITH_TOOLS] [-W WITHOUT_TOOLS] [-P PROFILES]
[--profile-path PROFILE_PATH]
[-s {veryhigh,high,medium,low,verylow}] [--show-profile]
[-E] [--pylint-config-file PYLINT_CONFIG_FILE] [-p PATH]
[-I IGNORE_PATTERNS] [-i IGNORE_PATHS] [-X]
[--include-tool-stdout] [--direct-tool-stdout] [--version]
[PATH [PATH ...]]
Performs static analysis of Python code
positional arguments:
PATH The path to a Python project to inspect. Defaults to
PWD if not specified. If multiple paths are specified,
they must all be files (no directories).
optional arguments:
-h, --help show this help message and exit
-0, --zero-exit Prospector will exit with a code of 1 (one) if any
messages are found. This makes automation easier; if
there are any problems at all, the exit code is non-
zero. However this behaviour is not always desirable,
so if this flag is set, prospector will exit with a
code of 0 if it ran successfully, and non-zero if it
failed to run.
-A, --no-autodetect Turn off auto-detection of frameworks and libraries
used. By default, autodetection will be used. To
specify manually, see the --uses option.
-u USES, --uses USES A list of one or more libraries or frameworks that the
project uses. Possible values are: django, celery,
flask. This will be autodetected by default, but if
autodetection doesn't work, manually specify them
using this flag.
-B, --no-blending Turn off blending of messages. Prospector will merge
together messages from different tools if they
represent the same error. Use this option to see all
unmerged messages.
-D, --doc-warnings Include warnings about documentation.
-T, --test-warnings Also check test modules and packages.
-8, --no-style-warnings
Don't create any warnings about style. This disables
the PEP8 tool and similar checks for formatting.
-m, --member-warnings
Attempt to warn when code tries to access an attribute
of a class or member of a module which does not exist.
This is disabled by default as it tends to be quite
inaccurate.
-F, --full-pep8 Enables every PEP8 warning, so that all PEP8 style
violations will be reported.
--max-line-length MAX_LINE_LENGTH
The maximum line length allowed. This will be set by
the strictness if no value is explicitly specified
-M, --messages-only Only output message information (don't output summary
information about the checks)
-S, --summary-only Only output summary information about the checks
(don'toutput message information)
-o OUTPUT_FORMAT, --output-format OUTPUT_FORMAT
The output format. Valid values are: emacs, grouped,
json, pylint, text, vscode, xunit, yaml. This will
output to stdout by default, however a target file can
be used instead by adding :path-to-output-file, eg, -o
json:output.json
--absolute-paths Whether to output absolute paths when referencing
files in messages. By default, paths will be relative
to the project path
-t TOOLS, --tool TOOLS
A list of tools to run. This lets you set exactly
which tools to run. To add extra tools to the
defaults, see --with-tool. Possible values are:
bandit, dodgy, frosted, mccabe, mypy, pep257, pep8,
profile-validator, pyflakes, pylint, pyroma, vulture.
By default, the following tools will be run: dodgy,
mccabe, pep257, pep8, profile-validator, pyflakes,
pylint
-w WITH_TOOLS, --with-tool WITH_TOOLS
A list of tools to run in addition to the default
tools. To specify all tools explicitly, use the --tool
argument. Possible values are bandit, dodgy, frosted,
mccabe, mypy, pep257, pep8, profile-validator,
pyflakes, pylint, pyroma, vulture.
-W WITHOUT_TOOLS, --without-tool WITHOUT_TOOLS
A list of tools that should not be run. Useful to turn
off only a single tool from the defaults. To specify
all tools explicitly, use the --tool argument.
Possible values are bandit, dodgy, frosted, mccabe,
mypy, pep257, pep8, profile-validator, pyflakes,
pylint, pyroma, vulture.
-P PROFILES, --profile PROFILES
The list of profiles to load. A profile is a certain
'type' of behaviour for prospector, and is represented
by a YAML configuration file. Either a full path to
the YAML file describing the profile must be provided,
or it must be on the profile path (see --profile-path)
--profile-path PROFILE_PATH
Additional paths to search for profile files. By
default this is the path that prospector will check,
and a directory called ".prospector" in the path that
prospector will check.
-s {veryhigh,high,medium,low,verylow}, --strictness {veryhigh,high,medium,low,verylow}
How strict the checker should be. This affects how
harshly the checker will enforce coding guidelines.
The default value is "medium", possible values are
"veryhigh", "high", "medium", "low" and "verylow".
--show-profile Include the computed profile in the summary. This will
show what prospector has decided the overall profile
is once all profiles have been combined and inherited
from. This will produce a large output in most cases
so is only useful when trying to debug why prospector
is not behaving like you expect.
-E, --no-external-config
Determines how prospector should behave when
configuration already exists for a tool. By default,
prospector will use existing configuration. This flag
will cause prospector to ignore existing configuration
and use its own settings for every tool. Note that
prospector will always use its own config for tools
which do not have custom configuration.
--pylint-config-file PYLINT_CONFIG_FILE
The path to a pylintrc file to use to configure
pylint. Prospector will find .pylintrc files in the
root of the project, but you can use this option to
specify manually where it is.
-p PATH, --path PATH The path to a Python project to inspect. Defaults to
PWD if not specified. Note: This command line argument
is deprecated and will be removed in a future update.
Please use the positional PATH argument instead.
-I IGNORE_PATTERNS, --ignore-patterns IGNORE_PATTERNS
A list of paths to ignore, as a list of regular
expressions. Files and folders will be ignored if
their full path contains any of these patterns.
-i IGNORE_PATHS, --ignore-paths IGNORE_PATHS
A list of file or directory names to ignore. If the
complete name matches any of the items in this list,
the file or directory (and all subdirectories) will be
ignored.
-X, --die-on-tool-error
If a tool fails to run, prospector will try to carry
on. Use this flag to cause prospector to die and raise
the exception the tool generated. Mostly useful for
development on prospector.
--include-tool-stdout
--direct-tool-stdout
--version show program's version number and exit
[nix-shell:~/.cache/nix-review/rev-35cfa77e9ffd9bb67a2a64f19fca57e56d0d52a0]$ prospector nixpkgs/
Messages
========
nixpkgs/maintainers/scripts/hydra-eval-failures.py
Line: 10
pylint: import-error / Unable to import 'click'
Line: 11
pylint: import-error / Unable to import 'requests'
Line: 12
pylint: import-error / Unable to import 'pyquery'
Line: 18
pep8: E305 / expected 2 blank lines after class or function definition, found 1 (col 1)
Line: 22
pylint: assignment-from-no-return / Assigning result of a function call, where the function has no return
Line: 27
pep8: E305 / expected 2 blank lines after class or function definition, found 1 (col 1)
Line: 49
pylint: bare-except / No exception type(s) specified (col 4)
Line: 50
pylint: bad-indentation / Bad indentation. Found 7 spaces, expected 8
Line: 110
pylint: no-value-for-parameter / No value for argument 'jobset' in function call (col 8)
Line: 111
pyflakes: F841 / local variable 'e' is assigned to but never used (col 5)
nixpkgs/maintainers/scripts/update.py
Line: 4
pylint: unused-import / Unused import os
Line: 65
... (more lines continue)
also, since prospector was remove from python-modules, the commit message for prospector should be:
|
I just updated the PR with suggested changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM
with py.pkgs; | ||
|
||
let | ||
setoptconf = callPackage ./setoptconf.nix { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make clear which package set is being called
setoptconf = callPackage ./setoptconf.nix { | |
setoptconf = py.pkgs.callPackage ./setoptconf.nix { |
|
||
let | ||
setoptconf = callPackage ./setoptconf.nix { | ||
inherit lib buildPythonPackage fetchPypi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callPackage will know how to find these
inherit lib buildPythonPackage fetchPypi; |
setoptconf | ||
]; | ||
|
||
meta = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personal preference, also consistent with some of the other files
meta = { | |
meta = with lib; { |
meta = { | ||
description = "Tool to analyse Python code and output information about errors, potential problems, convention violations and complexity"; | ||
homepage = "https://github.com/PyCQA/prospector"; | ||
license = lib.licenses.gpl2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license = lib.licenses.gpl2; | |
license = licenses.gpl2; |
description = "Tool to analyse Python code and output information about errors, potential problems, convention violations and complexity"; | ||
homepage = "https://github.com/PyCQA/prospector"; | ||
license = lib.licenses.gpl2; | ||
maintainers = with lib.maintainers; [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maintainers = with lib.maintainers; [ | |
maintainers = with maintainers; [ |
in | ||
|
||
with py.pkgs; | ||
|
||
let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be removed if you do:
let
py = python.override {
packageOverrides = self: super: {
pep8-naming = super.pep8-naming.overridePythonAttrs(oldAttrs: rec {
version = "0.4.1";
src = oldAttrs.src.override {
inherit version;
sha256 = "0nhf8p37y008shd4f21bkj5pizv8q0l8cpagyyb8gr059d6gvvaf";
};
});
};
};
setoptconf = py.pkgs.callPackage ./setoptconf.nix { };
in
with py.pkgs;
....
let bindings are able to refer to other expressions declared in their scope.
- The fetch expression was referencing another package (due to a copy paste error), this commit points that to the right repository
this are the changes made in the last update diff --git a/pkgs/development/tools/prospector/default.nix b/pkgs/development/tools/prospector/default.nix
index b639734f7d7..38472ce86f0 100644
--- a/pkgs/development/tools/prospector/default.nix
+++ b/pkgs/development/tools/prospector/default.nix
@@ -15,16 +15,11 @@ let
});
};
};
+ setoptconf = py.pkgs.callPackage ./setoptconf.nix { };
in
with py.pkgs;
-let
- setoptconf = callPackage ./setoptconf.nix {
- inherit lib buildPythonPackage fetchPypi;
- };
-in
-
buildPythonApplication rec {
pname = "prospector";
version = "1.2.0";
@@ -68,11 +63,11 @@ buildPythonApplication rec {
setoptconf
];
- meta = {
+ meta = with lib; {
description = "Tool to analyse Python code and output information about errors, potential problems, convention violations and complexity";
homepage = "https://github.com/PyCQA/prospector";
- license = lib.licenses.gpl2;
- maintainers = with lib.maintainers; [
+ license = licenses.gpl2;
+ maintainers = with maintainers; [
kamadorueda
];
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff LGTM
commits LGTM
applicable packages have tests
[19 built, 55 copied (67.7 MiB), 10.9 MiB DL]
https://github.com/NixOS/nixpkgs/pull/77424
9 package built:
prospector python37Packages.pylint-celery python37Packages.pylint-django python37Packages.pylint-flask python37Packages.requirements-detector python38Packages.pylint-celery python38Packages.pylint-django python38Packages.pylint-flask python38Packages.requirements-detector
@GrahamcOfBorg build prospector python37Packages.pylint-celery python37Packages.pylint-django python37Packages.pylint-flask python37Packages.requirements-detector python38Packages.pylint-celery python38Packages.pylint-django python38Packages.pylint-flask python38Packages.requirements-detector |
Motivation for this change
Prospector with strictness 'veryhigh' makes python code awesome
Things done
Added prospector + dependencies, many dependencies were not thoroughly tested on its own, but they are tested as part of the prospector tests at least
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @