From bf82314e4f6c84f4631019c31167d7ea23bb5ae7 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: tox setup --- .github/workflows/python-package.yml | 28 ++++++++++++++++++++ .pylintrc | 1 + LICENSE => docs/LICENSE.rst | 1 + docs/conf.py | 1 - docs/developer_guide.rst | 31 +++++++++++++++++++++++ docs/index.rst | 2 ++ pyproject.toml | 10 +++++--- pytest.ini | 2 +- tox.ini | 38 ++++++++++++++++++++++++++++ 9 files changed, 109 insertions(+), 5 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..db91659 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,28 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Run tox + run: | + tox r 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..3e863d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,16 +6,20 @@ build-backend = "setuptools.build_meta" [project] name = "nasdaq-protocols" description = "Nasdaq protocols python library" -license = {file = "LICENSE"} +license = {file = "docs/LICENSE.rst"} +requires-python = ">= 3.10" classifiers = [ 'Development Status :: 3 - Alpha', '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/pytest.ini b/pytest.ini index fe281c1..a129539 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,4 +5,4 @@ log_cli=true log_level=INFO log_format = %(name)-20s: %(message)s log_date_format = %I:%M:%S -#addopts = --cov=src --cov-fail-under=95 \ No newline at end of file +addopts = --cov=src --cov-fail-under=95 \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..9b32469 --- /dev/null +++ b/tox.ini @@ -0,0 +1,38 @@ +[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 + pytest-cov +commands = pytest --cov-fail-under=94.5 # Locking down the current cov percent as baseline + + +[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