diff --git a/.github/workflows/tox_runner.yml b/.github/workflows/tox_runner.yml index 8c53649..48527b6 100644 --- a/.github/workflows/tox_runner.yml +++ b/.github/workflows/tox_runner.yml @@ -19,6 +19,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.10' + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: @@ -30,14 +31,14 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install `grep 'tox==' < requirements-dev.txt` - name: Cache tox environments uses: actions/cache@v3 with: path: .tox - key: ${{ runner.os }}-tox-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/tox.ini') }}-${{ hashFiles('**/setup.cfg') }} + key: ${{ runner.os }}-tox-${{ hashFiles('**/requirements-dev.txt') }}-${{ hashFiles('**/pyproject.toml') }} - name: Run tox on the repo run: | - tox + tox \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 5895d95..be702b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,8 @@ language: python python: - - "3.6" - - "3.7" - - "3.8" - - "3.9" + - "3.10" + - "3.11" install: - - pip install -r requirements.txt + - pip install -r requirements-dev.txt script: - pytest --cov-report term --cov=taskflow - diff --git a/README.md b/README.md index 1301256..b248682 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,34 @@ # taskflow +## Install +In the project root, run: + +```bash +pip install . +``` +or +```bash +pip install taskflow +``` +or add this to your `requirements.txt` file: + +`taskflow @ git+ssh://git@github.com/Vectorworks/taskflow.git@v{tag}` + +## Development +If you are using a virtual environment, make sure to activate it before running the following commands. + +To run tox locally you need only the dev requirements, which can be installed with: + +```bash +pip install -e .[dev] +``` +or + +```bash +pip install -r requirements-dev.txt +``` + + [![Build Status](https://travis-ci.com/Vectorworks/taskflow.svg?branch=master)](https://travis-ci.com/Vectorworks/taskflow) taskflow is a simple workflow library, designed to be easily extended to support asynchronous distributed execution. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0ea8e24 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,77 @@ +[build-system] +requires = ["setuptools>=80.3.1"] +build-backend = "setuptools.build_meta" + +[project] +name = "taskflow" +dynamic = ["version", "optional-dependencies"] +urls = {"homepage" = "https://git@github.com/Vectorworks/taskflow.git"} +description = "A simple workflow library." +readme = "README.md" +requires-python = ">=3.9" + +[tool.setuptools.dynamic] +version = {attr = "taskflow.__version__"} +optional-dependencies = { dev = { file = ["requirements-dev.txt"] } } + +[tool.setuptools.packages.find] +where = ["."] + +[tool.setuptools.package-data] +taskflow = ["**/*"] + +[tool.pytest.ini_options] +testpaths = ["taskflow/tests"] + +[tool.flake8] +exclude = [".cache", ".git", ".tox", ".vscode"] +max-line-length = 120 + +[tool.isort] +skip = [".cache", ".git", ".tox", ".vscode"] +indent = 4 +line_length = 120 +multi_line_output = 2 +combine_as_imports = true +include_trailing_comma = true +default_section = "THIRDPARTY" +known_libraries = [] +known_first_party = ["taskflow"] +sections = ["FUTURE", "STDLIB", "THIRDPARTY", "LIBRARIES", "FIRSTPARTY", "LOCALFOLDER"] + +[tool.tox] +envlist = ["py310-django32", "py310-django42", "py311-django42", "lint", "isort"] +skip_missing_interpreters = true + +[tool.tox.env.default] +recreate = false +alwayscopy = true +usedevelop = false +setenv = {PYTHONPATH = "{toxinidir}"} +changedir = "{toxinidir}" + +[tool.tox.env.py310-django32] +extras = ["dev"] +deps = ["django>=3.2,<4.0"] +basepython = ["python3.10"] +commands = [["python", "-m", "pytest"]] + +[tool.tox.env.py310-django42] +extras = ["dev"] +deps = ["django>=4.2,<4.3"] +basepython = ["python3.10"] +commands = [["python", "-m", "pytest"]] + +[tool.tox.env.py311-django42] +extras = ["dev"] +deps = ["django>=4.2,<4.3"] +basepython = ["python3.11"] +commands = [["python", "-m", "pytest"]] + +[tool.tox.env.lint] +extras = ["dev"] +commands = [["python", "-m", "flake8", "taskflow"]] + +[tool.tox.env.isort] +extras = ["dev"] +commands = [["python", "-m", "isort", "--check-only", "--diff", "taskflow"]] \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..96c906c --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,11 @@ +# test +pytest==8.3.5 +pytest-cov==6.0.0 +pytest-mock==3.14.0 + +# codestyle +flake8==7.2.0 +flake8-pyproject==1.2.3 +isort==5.13.2 + +tox==4.26.0 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e9b6f1b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -# dev dependencies -pytest==8.3.5 -pytest-cov==6.0.0 -pytest-mock==3.14.0 -tox==4.15.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d2857aa..0000000 --- a/setup.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[tool:pytest] - -[flake8] -exclude = .cache,.git,.tox,.vscode -max-line-length = 120 - -[pylint] -exclude = .cache,.git,.tox,.vscode -max-line-length = 120 - -[pycodestyle] -max-line-length = 120 - -[isort] -skip = .cache,.git,.tox,.vscode -indent = 4 -line_length = 120 -multi_line_output = 2 -combine_as_imports = true -default_section = THIRDPARTY -include_trailing_comma = true -sections = FUTURE,STDLIB,THIRDPARTY,LIBRARIES,FIRSTPARTY,LOCALFOLDER diff --git a/setup.py b/setup.py deleted file mode 100644 index 7a87670..0000000 --- a/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -import os -import re -from io import open - -from setuptools import setup - - -def get_version(package): - """ - Return package version as listed in `__version__` in `init.py`. - """ - init_py = open(os.path.join(package, "__init__.py")).read() - return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) - - -def get_packages(package): - """ - Return root package and all sub-packages. - """ - return [ - dirpath - for dirpath, dirnames, filenames in os.walk(package) - if os.path.exists(os.path.join(dirpath, "__init__.py")) - ] - - -def get_package_data(package): - """ - Return all files under the root package, that are not in a - package themselves. - """ - walk = [ - (dirpath.replace(package + os.sep, "", 1), filenames) - for dirpath, dirnames, filenames in os.walk(package) - if not os.path.exists(os.path.join(dirpath, "__init__.py")) - ] - - filepaths = [] - for base, filenames in walk: - filepaths.extend([os.path.join(base, filename) for filename in filenames]) - return {package: filepaths} - - -version = get_version("taskflow") - - -setup( - name="taskflow", - version=version, - url="https://git@github.com/Vectorworks/taskflow.git", - description="A simple workflow library.", - packages=get_packages("taskflow"), - package_data=get_package_data("taskflow"), - install_requires=[], - dependency_links=[], -) diff --git a/taskflow/__init__.py b/taskflow/__init__.py index 8a8f8c4..e447e1e 100644 --- a/taskflow/__init__.py +++ b/taskflow/__init__.py @@ -1,5 +1,5 @@ __title__ = "Taskflow" -__version__ = "0.2.2" +__version__ = "0.3.0" from .flow import * # noqa from .tasks import * # noqa diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 2f80615..0000000 --- a/tox.ini +++ /dev/null @@ -1,29 +0,0 @@ -[tox] -envlist = - py39, py310, py311, py312 - lint - isort - -[testenv] -recreate = false -alwayscopy = true -deps = - pytest==8.3.5 - pytest-cov==6.0.0 - pytest-mock==3.14.0 -setenv = - PYTHONPATH={toxinidir} -commands = - py.test -v - -[testenv:lint] -deps = - flake8==7.0.0 -commands = - flake8 taskflow - -[testenv:isort] -deps = - isort==5.13.2 -commands = - isort --check-only --diff taskflow