diff --git a/.github/workflows/tox_runner.yml b/.github/workflows/tox_runner.yml index 8c53649..883d92e 100644 --- a/.github/workflows/tox_runner.yml +++ b/.github/workflows/tox_runner.yml @@ -1,4 +1,4 @@ -name: Run tox (tests & linting) +name: Test workflow on: push: @@ -9,35 +9,12 @@ on: - '**' jobs: - tox: - name: Run tox + test: + name: Check connection runs-on: ubuntu-24.04 - timeout-minutes: 10 - steps: - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Checkout latest version from the repo. - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.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') }} + - name: Checkout code + uses: actions/checkout@v3 - - name: Run tox on the repo - run: | - tox + - name: Echo hello + run: echo "Hello, world!" diff --git a/.travis.yml b/.travis.yml index 5895d95..2635831 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ python: - "3.8" - "3.9" 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..0348781 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. @@ -34,4 +63,4 @@ flow = Flow( flow.run() 35 -``` \ No newline at end of file +``` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4380d32 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,61 @@ +[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" +dependencies = [] + +[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 = ["py39", "py310", "py311", "py312", "lint", "isort"] +isolated_build = true +skip_missing_interpreters = true + +[tool.tox.env.default] +recreate = false +alwayscopy = true +extras = ["dev"] +setenv = {PYTHONPATH = "{toxinidir}"} +commands = ["py.test -v"] + +[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.txt b/requirements-dev.txt similarity index 52% rename from requirements.txt rename to requirements-dev.txt index e9b6f1b..94bac0a 100644 --- a/requirements.txt +++ b/requirements-dev.txt @@ -2,4 +2,7 @@ pytest==8.3.5 pytest-cov==6.0.0 pytest-mock==3.14.0 -tox==4.15.0 +tox==4.26.0 +flake8-pyproject==1.2.3 +flake8==7.2.0 +isort==5.13.2 \ No newline at end of file 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 index 7a87670..e69de29 100644 --- a/setup.py +++ b/setup.py @@ -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