Skip to content

Commit

Permalink
tox: tox setup
Browse files Browse the repository at this point in the history
  • Loading branch information
SamDanielThangarajan committed Jan 8, 2024
1 parent 6aa8be4 commit bf82314
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions LICENSE → docs/LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
MIT License
===========

Copyright (c) 2024 Nasdaq

Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
31 changes: 31 additions & 0 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Welcome to nasdaq-protocols's documentation!
install
api_reference
user_guide
developer_guide
LICENSE


Indices and tables
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
addopts = --cov=src --cov-fail-under=95
38 changes: 38 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bf82314

Please sign in to comment.