Commit Graph

30 Commits

Author SHA1 Message Date
Calum Lind 0548bdb655 [Lint] Add pre-commit config
- Added a pre-commit config for code linting and formatting. It will
  auto-format python, javascript, CSS, YAML and markdown files to save
  manually doing so. To install:

      pip install pre-commit
      pre-commit install

- Added a default virtual environment directory to gitignore.
2018-10-05 09:45:42 +01:00
Calum Lind 36606fc448 [Docs] Add markdown support
- Use recommonmark to enable use of markdown files in docs.
- Fix theme not specified
- Remove unused spelling module.
- Cleanup mocking modules in conf so building docs requires only Sphinx.
- Simplify tox section, including use of requirements-docs file. Added
  slimit dependency for sdist-ing deluge package.
2018-10-04 15:53:42 +01:00
Calum Lind b1cdc32f73 [Lint] Use Black to auto-format code
The move to using auto-formatter makes it easier to read, submit and
speeds up development time. https://github.com/ambv/black/

Although I would prefer 79 chars, the default line length of 88 chars
used by black suffices. The flake8 line length remains at 120 chars
since black does not touch comments or docstrings and this will require
another round of fixes.

The only black setting that is not standard is the use of double-quotes
for strings so disabled any formatting of these. Note however that
flake8 will still flag usage of double-quotes. I may change my mind on
double vs single quotes but for now leave them.

A new pyproject.toml file has been created for black configuration.
2018-10-03 15:21:53 +01:00
Calum Lind 3fc97672de Fix the docs run failing on Travis
Likely that the deprecation warning from cryptography is causing the
setup.py sphinx build command to return an error so the tox/travis job
is marked as failing. Changing to calling the sphinx-build command
directly solves this.

Also updated the sphinx config for built-in napoleon and faster builds
using jobs option.
2018-07-28 10:26:02 +01:00
Calum Lind fe80703f95 [Packaging] Fix py2app build 2017-06-27 09:16:51 +01:00
Calum Lind 989137ddc3 [OSX] Default to 64-bit builds 2017-06-07 11:47:58 +01:00
Calum Lind 481f779349 [Python3] Fixes to make code backward compatible
* Continuation of updating code to Python 3 with Python 2 fallback.
 * Using io.open allows files to be encoded and decoded automatically on write and read. This
 maintains the python boundaries of unicode in code and bytes for output/files so less
 explicit encoding or decoding.
 * io.StringIO is the replacement for StringIO and will only accept unicode strings.
 * io.BytesIO is used where bytes output is required by the enclosing method.
 * Update bencode for full compatibility.
2017-06-05 22:25:29 +01:00
Calum Lind eb38e0ffff [Py2to3] Large set of changes for Python 3 compat
- Preparation work for using six or future module for Py2/3 compat. The
   code will be written in Python 3 with Python 2 fallbacks.
 - Added some Py3 imports with Py2 fallbacks to make it easier to remove
   Py2 code in future.
 - Replace xrange with range (sort out import as top of files in future).
 - Workaround Py2to3 basestring issue with inline if in instances. This means
   every usage of basestring is more considered.
 - Replace iteritems and itervalues for items and values. There might be a
   performance penalty on Py2 so might need to revisit this change.
2017-03-16 23:20:56 +00:00
Calum Lind 874249655d [Tests] Replace isort test with flake8-isort
* Move the known_third_party back to setup.cfg with comments.
2016-11-25 12:43:50 +00:00
bendikro 2f4cb0156c [Tests] Fix for isort config package handling
* Force gtk modules to be third_party for tox/travis testing.
2016-11-01 14:04:14 +00:00
Calum Lind 6bf906a849 [Lint] Use a shorter line length for isort 2016-05-18 10:55:01 +01:00
bendikro d58960d723 [Tests] [Web] Make JSON independent of Web component
* Implement JSONTestCase in test_json_api.py
* Implement WebAPITestCase test case in test_web_api.py
2016-04-10 00:10:53 +02:00
Calum Lind ebc00f3d7c Fix config for isort 4.2 2015-10-21 01:17:08 +01:00
bendikro 9d662bf059 [Tests] Fix code for isort 4.0.0 2015-08-14 16:45:23 +01:00
bendikro 8334bf9477 [Tests] Various fixes for unit tests and tox
* Added custom trial reporter for TODO with test example in test_torrentmanager.py
* Set Stats plugin tests as todo
* Disable new_release_check when running unit tests
* Added pytest.mark.slow to test_core.test_test_listen_port
* Get rid of unit test warnings (Caused by bad names in test classes)
* Removed warnings.filterwarnings in test files.
* Added separate tox target for generating test coverage HTML report.
2014-12-01 10:52:16 +00:00
Calum Lind dd8e37a6ce Workaround for the isort Travis issue by using order-by-type
See isort issue: https://github.com/timothycrosley/isort/issues/185
2014-09-26 13:06:11 +01:00
Calum Lind 3d4ea71dcf Fix isort config 2014-09-25 16:12:43 +01:00
Calum Lind 7e86b41f92 Add isort thirdparty config for Travis 2014-09-25 15:55:32 +01:00
bendikro 66f2739be7 Added .travis.yml (for travis-ci) and tox.ini files
Targets:

* Runs the unit-tests for python 2.7
* Tests unit-test coverage
* Try to build docs
* Code style checks:
  * flake8
  * isort

Codes changes:
* Fixed tests for httpdownloader (using tmp dir)
* Implemented a couple of tests for Stats plugin but they fail to run on travis

Issues:
* Can't get py26 to work because of installing libtorrent through apt and
  the option system_site_packages fails for 2.6.
2014-09-25 14:11:51 +01:00
Calum Lind 2f68092740 Flake8 add global __request__ to config 2014-09-22 12:46:17 +01:00
Calum Lind 30a0f3c9ed Flake8 pass of entire codebase
* Use the inline '# NOQA' to supress N802 lower-case warnings
2014-09-19 19:10:14 +01:00
Calum Lind d0b8e17873 Add workarounds for isort
* Add workaround for unicodedata issue
 * Change line length to 120
 * Skip gtkui.py to stop it moving local imports above the install reactor line
2014-09-19 15:58:43 +01:00
Calum Lind 5167e93d12 Flake8 core and common files
* Added N802 to flake8 ignore as certain inherited funcs cannot be changed
   to lowercase and this unresolved warning hides other errors/warnings.
 * Include new header
2014-09-03 23:48:34 +01:00
Calum Lind 7dd276631a Add flake8 to setup.cfg and add missed change to #2303 fix 2013-05-22 23:33:06 +01:00
Calum Lind 4dd6308db9 Add get_version script to automate release versions (PEP386 naming) 2013-05-01 05:24:36 +01:00
Calum Lind 31ec8830f4 Update osx build and packaging scripts 2013-03-17 18:16:23 +00:00
Calum Lind a7c5b9f568 Add OSX packaging and GTK support 2013-02-14 00:36:46 +00:00
Andrew Resch ead063e279 Add a 'build_docs' command to build the documentation 2009-07-22 23:04:48 +00:00
Damien Churchill ae5011ec92 setup the build_spinx command 2009-07-20 09:00:47 +00:00
Damien Churchill 248eb7341c use the setup.cfg file to tag the build as -dev 2009-04-06 14:54:20 +00:00