From 816ec7a06e997b2426f1422160adbc1f79ba240f Mon Sep 17 00:00:00 2001 From: SamDanielThangarajan <12202554+SamDanielThangarajan@users.noreply.github.com> Date: Sat, 6 Jan 2024 09:25:32 +0100 Subject: [PATCH] tox: initial tox setup --- .github/workflows/python-package.yml | 0 .pylintrc | 1 + LICENSE => docs/LICENSE.rst | 1 + docs/conf.py | 1 - docs/developer_guide.rst | 31 +++++++++++++++++++++++ docs/index.rst | 2 ++ pyproject.toml | 7 ++++-- tox.ini | 37 ++++++++++++++++++++++++++++ 8 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/python-package.yml rename LICENSE => docs/LICENSE.rst (98%) create mode 100644 docs/developer_guide.rst create mode 100644 tox.ini diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..e69de29 diff --git a/.pylintrc b/.pylintrc index 3545e18..68511ab 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,6 +2,7 @@ max-line-length=180 [MASTER] +ignore-paths=src/nasdaq_protocols/_version.py disable= C0114, #missing-module-docstring C0115, #missing-class-docstring diff --git a/LICENSE b/docs/LICENSE.rst similarity index 98% rename from LICENSE rename to docs/LICENSE.rst index 0c0d8e6..4626aff 100644 --- a/LICENSE +++ b/docs/LICENSE.rst @@ -1,4 +1,5 @@ MIT License +=========== Copyright (c) 2024 Nasdaq diff --git a/docs/conf.py b/docs/conf.py index a9342c1..449c724 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -35,4 +35,3 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output # https://www.sphinx-doc.org/en/master/usage/theming.html [themes] html_theme = 'agogo' -html_static_path = ['_static'] diff --git a/docs/developer_guide.rst b/docs/developer_guide.rst new file mode 100644 index 0000000..2776536 --- /dev/null +++ b/docs/developer_guide.rst @@ -0,0 +1,31 @@ +Developer's Guide +================= + +This guide is intended for developers who want to contribute to the +development of the `nasdaq-protocols` library. + + +Guidelines +---------- +Before merging to main, please ensure that the following guidelines are met: + +- All existing tests are passing. +- New tests are added when needed. +- Pylint reports no errors, 10/10 +- Code is documented and docstrings are added when needed. +- Documentation is included in the rst files. + + +Building +________ +.. code-block:: console + + $ tox r + +`tox r` will execute all of the following. + +- `tox -e lint` - Runs linter and validates the code +- `tox -e test` - Runs the pytest test cases +- `tox -e build` - Builds the package sdist and wheel +- `tox -e doc` - Builds the documentation + diff --git a/docs/index.rst b/docs/index.rst index bf4d367..33fc5bf 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,6 +15,8 @@ Welcome to nasdaq-protocols's documentation! install api_reference user_guide + developer_guide + LICENSE Indices and tables diff --git a/pyproject.toml b/pyproject.toml index b593fa3..5019ff3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,10 +12,13 @@ classifiers = [ 'Topic :: Software Development :: Libraries :: Python Modules' ] -dynamic = ["version", "dependencies"] +dependencies = [ + 'attrs>=23.1' +] + +dynamic = ["version"] [tool.setuptools.dynamic] -dependencies = {file = ["requirements.txt"]} version = {attr = "nasdaq_protocols/_version.version"} [tool.setuptools_scm] diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..e96f472 --- /dev/null +++ b/tox.ini @@ -0,0 +1,37 @@ +[tox] +requires = + tox>4 + virtualenv>20.2 +env_list = + lint + test + build + doc + +[testenv:lint] +description = Run pylint +deps = pylint +commands = pylint --fail-under=10.0 "--ignore-patterns=.*egg-info.*,.*test.*" src/* + + +[testenv:test] +description = Run pytest +deps = + pytest + pytest-asyncio + pytest-sugar +commands = pytest + + +[testenv:build] +description = Build package +deps = build +commands = python -m build + + +[testenv:doc] +description = Build documenation +deps = sphinx +commands = make html +change_dir = docs +allowlist_externals = make