diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c709a42c..77e78619 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,23 +16,16 @@ jobs: run: shell: bash steps: - - uses: actions/checkout@master + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip-${{ hashFiles('**/requirements-dev.txt') }} - restore-keys: | - pip-${{ secrets.CACHE_VERSION }}- - - name: Install development dependencies - run: pip install -r requirements-dev.txt - - name: Install package & dependencies - run: pip install . + cache: "pip" + - name: Install dependencies + run: python -m pip install -r requirements.txt -r requirements-dev.txt . - name: Test - run: pytest + run: python -m pytest release: name: "Release" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..3376263a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "replicate" +version = "0.7.0" +description = "Python client for Replicate" +readme = "README.md" +license = { file = "LICENSE" } +authors = [{ name = "Replicate, Inc." }] +requires-python = ">=3.8" +dependencies = ["packaging", "pydantic>1", "requests>2"] +optional-dependencies = { dev = ["black", "pytest", "responses"] } + +[project.urls] +homepage = "https://replicate.com" +repository = "https://github.com/replicate/replicate-python" + +[tool.pytest.ini_options] +testpaths = "tests/" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 39baf331..00000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -testpaths = tests/ diff --git a/replicate/__about__.py b/replicate/__about__.py index 49e0fc1e..5f3c0243 100644 --- a/replicate/__about__.py +++ b/replicate/__about__.py @@ -1 +1,3 @@ -__version__ = "0.7.0" +from importlib.metadata import version + +__version__ = version(__package__) diff --git a/replicate/__init__.py b/replicate/__init__.py index 64f6aff6..0d35ad3b 100644 --- a/replicate/__init__.py +++ b/replicate/__init__.py @@ -1,4 +1,3 @@ -from .__about__ import __version__ from .client import Client default_client = Client() diff --git a/requirements-dev.txt b/requirements-dev.txt index b3d9b4fa..f10b82a5 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,53 @@ -packaging==21.3 -pytest==7.1.2 -responses==0.21.0 +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --extra=dev --output-file=requirements-dev.txt pyproject.toml +# +attrs==22.2.0 + # via pytest +black==23.3.0 + # via replicate (pyproject.toml) +certifi==2022.12.7 + # via requests +charset-normalizer==3.1.0 + # via requests +click==8.1.3 + # via black +idna==3.4 + # via requests +iniconfig==2.0.0 + # via pytest +mypy-extensions==1.0.0 + # via black +packaging==23.0 + # via + # black + # pytest + # replicate (pyproject.toml) +pathspec==0.11.1 + # via black +platformdirs==3.2.0 + # via black +pluggy==1.0.0 + # via pytest +pydantic==1.10.7 + # via replicate (pyproject.toml) +pytest==7.2.2 + # via replicate (pyproject.toml) +pyyaml==6.0 + # via responses +requests==2.28.2 + # via + # replicate (pyproject.toml) + # responses +responses==0.23.1 + # via replicate (pyproject.toml) +types-pyyaml==6.0.12.9 + # via responses +typing-extensions==4.5.0 + # via pydantic +urllib3==1.26.15 + # via + # requests + # responses diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..fad6e32b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,22 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --output-file=requirements.txt pyproject.toml +# +certifi==2022.12.7 + # via requests +charset-normalizer==3.1.0 + # via requests +idna==3.4 + # via requests +packaging==23.0 + # via replicate (pyproject.toml) +pydantic==1.10.7 + # via replicate (pyproject.toml) +requests==2.28.2 + # via replicate (pyproject.toml) +typing-extensions==4.5.0 + # via pydantic +urllib3==1.26.15 + # via requests diff --git a/setup.py b/setup.py deleted file mode 100644 index 98794594..00000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -# !/usr/bin/env python - -from pathlib import Path - -from setuptools import setup - -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - -# setup.py cannot safely import files, so read and exec to get the version -__version__ = None -exec(open("replicate/__about__.py").read()) - -setup( - name="replicate", - packages=["replicate"], - version=__version__, - description="Python client for Replicate", - long_description=long_description, - long_description_content_type="text/markdown", - author="Replicate, Inc.", - license="BSD", - url="https://github.com/replicate/replicate-python", - python_requires=">=3.8", - install_requires=["requests", "pydantic", "packaging"], - classifiers=[], -)