Skip to content

Commit

Permalink
switch to pyproject.toml from setup.py (#195)
Browse files Browse the repository at this point in the history
* switch to pyproject.toml from setup.py

* add missing dep

* fix release job
  • Loading branch information
epwalsh authored Oct 3, 2023
1 parent 62f2eab commit 7ecffc0
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 173 deletions.
20 changes: 0 additions & 20 deletions .flake8

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- python: '3.10'
task:
name: Lint
run: flake8 .
run: ruff check .

- python: '3.10'
task:
Expand All @@ -49,8 +49,7 @@ jobs:
task:
name: Build
run: |
python setup.py check
python setup.py bdist_wheel sdist
python -m build
- python: '3.10'
task:
Expand All @@ -63,10 +62,10 @@ jobs:
run: cd docs && make html

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

Expand All @@ -87,7 +86,7 @@ jobs:
id: virtualenv-cache
with:
path: .venv
key: ${{ env.CACHE_PREFIX }}-${{ env.WEEK_NUMBER }}-${{ runner.os }}-${{ env.RUNNER_ARCH }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }}
key: ${{ env.CACHE_PREFIX }}-${{ env.WEEK_NUMBER }}-${{ runner.os }}-${{ env.RUNNER_ARCH }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}

- name: Setup virtual environment (no cache hit)
if: steps.virtualenv-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -138,13 +137,14 @@ jobs:
- uses: actions/checkout@v1

- name: Setup Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install requirements
run: |
pip install -r dev-requirements.txt
pip install --upgrade pip setuptools wheel build
pip install -e .[dev]
- name: Prepare environment
run: |
Expand Down
54 changes: 0 additions & 54 deletions dev-requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions mypy.ini

This file was deleted.

111 changes: 108 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "cached_path"
dynamic = ["version"]
readme = "README.md"
description = "A file utility for accessing both local and remote files through a unified interface"
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
authors = [
{ name = "Allen Institute for Artificial Intelligence", email = "[email protected]" },
]
license = {file = "LICENSE"}
requires-python = ">3.7"
dependencies = [
"requests>=2.0,<3.0",
"rich>=12.1,<14.0",
"filelock>=3.4,<3.13",
"boto3>=1.0,<2.0",
"google-cloud-storage>=1.32.0,<3.0",
"huggingface-hub>=0.8.1,<0.17.0",
]

[project.optional-dependencies]
dev = [
"beaker-py>=1.13.2,<2.0",
"ruff",
"mypy==1.2.0",
"black==22.12.0",
"isort==5.11.4",
"pytest",
"flaky",
"twine>=1.11.0",
"setuptools",
"wheel",
"build",
"responses==0.21.0",
"Sphinx==5.3.0",
"furo==2023.3.27",
"myst-parser==0.18.1",
"sphinx-copybutton==0.5.2",
"sphinx-autobuild==2021.3.14",
"sphinx-autodoc-typehints",
"packaging",
]

[project.urls]
Homepage = "https://github.com/allenai/cached_path"
Repository = "https://github.com/allenai/cached_path"
Changelog = "https://github.com/allenai/cached_path/blob/main/CHANGELOG.md"
Documentation = "https://cached-path.readthedocs.io/"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
exclude = [
"tests*",
"docs*",
"scripts*",
"examples*",
"integration_tests*",
]

[tool.setuptools.package-data]
cached_path = ["py.typed"]

[tool.setuptools.dynamic]
version = {attr = "cached_path.version.VERSION"}

[tool.black]
line-length = 100

Expand All @@ -20,6 +96,35 @@ exclude = '''
profile = "black"
multi_line_output = 3

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[tool.ruff]
line-length = 115
ignore = ["E501", "F403", "F405"]

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]

[tool.mypy]
ignore_missing_imports = true
no_site_packages = true
check_untyped_defs = true

[[tool.mypy.overrides]]
module = "tests.*"
strict_optional = false

[tool.pytest.ini_options]
testpaths = [
"tests/",
"integration_tests/",
]
python_classes = [
"Test*",
"*Test",
]
log_format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
log_level = "DEBUG"
filterwarnings = [
'ignore:.*distutils Version classes are deprecated.*:DeprecationWarning:docker\.utils\.utils',
'ignore::DeprecationWarning:google\.rpc',
'ignore::DeprecationWarning:pkg_resources',
]
9 changes: 0 additions & 9 deletions pytest.ini

This file was deleted.

7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

66 changes: 0 additions & 66 deletions setup.py

This file was deleted.

0 comments on commit 7ecffc0

Please sign in to comment.