Comments (1)
How far do you want to go documenting this, other than suggesting using virtualenv, suggest virtualenvwrapper, and running 'pip install prospector' ?
My integration scheme usually works somewhat like this, though it changes in complexity per project:
-
README.rst
that suggests a Developing section, specifying that virtualenv and pip are required and instructs the developer to use prepare an existing virtualenv environment for testing using, -
python setup.py develop
, achieved by a custom SetupDevelop command class in setup.py, that derives therun()
method to assert thatos.getenv('VIRTUAL_ENV')
is defined (to remind you not to pollute your environment accidentally), run the baseclasssetuptools.command.develop.develop.run()
, which installs the egg link to allow rapidly editing without re-installing, and then callself.spawn(('pip', 'install', '--upgrade', '--requirement', 'requirements-dev.txt'))
. -
setup.py file contains:
from setuptools.command.develop import develop class SetupDevelop(develop): """ 'setup.py develop' is augmented to install development tools. """ # pylint: disable=R0904 # Too many public methods (43/20) def run(self): """ Execute command pip for development requirements. """ # pylint: disable=E1101 # Instance of 'SetupDevelop' has no 'spawn' member (col 8) assert os.getenv('VIRTUAL_ENV'), 'You should be in a virtualenv' develop.run(self) self.spawn(('pip', 'install', '--upgrade', '--requirement', 'requirements-dev.txt')) setup( name=PACKAGE_NAME, version=VERSION, (...) cmdclass={ 'develop': SetupDevelop, }, )
-
requirements-dev.txt file contains:
# This file contains dependencies required for running tests, and any other # miscellaneous developer tools tox IPython
-
tox.ini file contains:
[tox] envlist = prospector, py27, py34, [testenv] # for any python, run simple pytest with coverage deps = -r{toxinidir}/requirements-testing.txt commands = {envbindir}/py.test --strict --cov {envsitepackagesdir}/PACKAGENAME \ PACKAGE/TESTS {posargs} [testenv:prospector] # run static analysis using prospector deps = -r{toxinidir}/requirements-analysis.txt commands = prospector \ --die-on-tool-error \ --test-warnings \ --doc-warnings \ {toxinidir}
-
requirements-testing.txt file containing:
# This file contains python dependencies required by tox when running tests webtest==2.0.6 pytest==2.6.4 pytest-cov==1.6
-
requirements-analysis.txt file containing:
prospector[with_dodgy,with_frosted,with_mccabe,with_pep257,with_pep8,with_pyroma,with_vulture]
-
and a sample .prospector.yaml file containing:
inherits: - strictness_veryhigh ignore: - (^|/)\..+ - ^docs/ - ^build/ test-warnings: true output-format: grouped dodgy: # Looks at Python code to search for things which look "dodgy" # such as passwords or git conflict artifacts run: true frosted: # static analysis run: true mccabe: # complexity checking. run: true pep257: # docstring checking run: true pep8: # style checking run: true options: max-line-length: 100 pyflakes: # preferring 'frosted' instead (a fork of) run: false pylint: # static analysis and then some run: true options: max-line-length: 100 # allow 'log' as global constant const-rgx: "(([A-Z_][A-Z0-9_]*)|(__.*__)|log)$" const-hint: "(([A-Z_][A-Z0-9_]*)|(__.*__)|log)$" # pytest module has dynamically assigned functions, # raising errors such as: E1101: Module 'pytest' has # no 'mark' member ignored-classes: pytest disable: # Too many lines in module - C0302 # Used * or ** magic - W0142 # Used builtin function 'filter'. # (For maintainability, one should prefer list comprehension.) - W0141 pyroma: # checks setup.py run: true vulture: # this tool does a good job of finding unused code. run: true
The workflow then simply becomes:
- create or active a virtualenv (mkvirtualenv, workon, etc.)
- run
./setup.py develop
- run
tox
, or optionally justtox -eprospector
for static analysis
Feel free to use the idea if you like.
from prospector.
Related Issues (20)
- [BUG] Mypy is described as experimental when it's now stable HOT 1
- [BUG] prospector2 won't install on Windows apparently since using forward slash instead of os.path.join HOT 1
- Prospector 1.10.2 does not support `with_mypy` optional tool [in conda] HOT 5
- [BUG] prospector fails when pyproject.toml contain multiple constraints dependencies
- [FEATURE REQUEST] MyPy check-untyped-defs option.
- [BUG] Incorrect additional_dependencies documentation to run prospector as a pre-commit hook with mypy support HOT 2
- [BUG] toml support is incomplete HOT 1
- [PKG SUPPORT] `pylint <3` and Python 3.12 HOT 11
- [PKG SUPPORT] changes for support of `flake >=6.0.0` (and Python 3.12, implicit) HOT 3
- [BUG] pre-commit hook fails on Python 3.12 because of deprecated pkg_resources HOT 3
- [BUG] False positive E231 error in pycodestyle HOT 3
- [BUG] Fatal error pylint: astroid-error HOT 1
- [FEATURE REQUEST] How to use `prospector` on a string
- [BUG] missing dependency: setuptools HOT 1
- [BUG] Crash with ValueError HOT 1
- [BUG] prospector fails with UnicodeDecodeError on requirements.txt having DOS (CRLF) line endings HOT 2
- [BUG] `prospector[with_pyroma]` not appearing to install pyroma when creating conda environments
- [FEATURE REQUEST] Baseline generation
- [BUG] Strange errors with python version 3.12.3
- [BUG] Python 3.12.2/4 - ModuleNotFoundError: No module named 'pkg_resources' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prospector.