diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c9b7981b..6a56b47e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,15 +15,15 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.11 - - name: Install ruff + - name: Install pre-commit shell: bash run: | python -V - python -m pip install ruff - - name: Run ruff + python -m pip install pre-commit + - name: Run pre-commit linters shell: bash run: | - ruff . + pre-commit run --files * build: strategy: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..d07f8329 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.292 + hooks: + - id: ruff + args: ["--fix", "--show-source"] diff --git a/dev-requirements.txt b/dev-requirements.txt index aa5db950..933e6909 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,7 @@ -# Dependencies for running the tests with pytest +# Linting tools ruff +pre-commit +# Dependencies for running the tests with pytest pytest pytest-cov psutil diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..8bf56a9f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[build-system] +requires = ["flit_core"] +build-backend = "flit_core.buildapi" + +[tool.flit.metadata] +module = "cloudpickle" +author = "The cloudpickle developer team" +author-email='cloudpipe@googlegroups.com' +home-page = "https://github.com/cloudpipe/cloudpickle" +description-file = "README.md" +requires-python = ">=3.8" +license = "BSD-3-Clause" +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: MacOS :: MacOS X', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Scientific/Engineering', + 'Topic :: System :: Distributed Computing', +] + +[tool.black] +line-length = 88 +target_version = ['py38', 'py39', 'py310', 'py311', 'py312'] +preview = true + +[tool.ruff] +line-length = 88 +target-version = "py38" diff --git a/setup.py b/setup.py deleted file mode 100644 index 8b1021ae..00000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -import os -import re - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - - -# Function to parse __version__ in `cloudpickle/__init__.py` -def find_version(): - here = os.path.abspath(os.path.dirname(__file__)) - with open(os.path.join(here, 'cloudpickle', '__init__.py')) as fp: - version_file = fp.read() - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - - -setup( - name='cloudpickle', - version=find_version(), - description='Extended pickling support for Python objects', - author='Cloudpipe', - author_email='cloudpipe@googlegroups.com', - url='https://github.com/cloudpipe/cloudpickle', - license='BSD-3-Clause', - packages=['cloudpickle'], - long_description=open('README.md').read(), - long_description_content_type="text/markdown", - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: POSIX', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: MacOS :: MacOS X', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Scientific/Engineering', - 'Topic :: System :: Distributed Computing', - ], - test_suite='tests', - python_requires='>=3.8', -)