Skip to content

Commit f8dff66

Browse files
committed
modernize project, move to pyproject.toml and use ruff
1 parent 92519d0 commit f8dff66

22 files changed

+187
-277
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Check out the repository
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919

20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v4
20+
- name: Set up Python 3.13
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.10'
23+
python-version: '3.13'
2424

2525
- name: Upgrade pip and nox
2626
run: |

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
os: [ubuntu-20.04, windows-latest, macos-latest]
24-
pyv: ['3.8', '3.9', '3.10', '3.11']
24+
pyv: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
2525

2626
steps:
2727
- name: Check out the repository
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929
with:
3030
fetch-depth: 0
3131

3232
- name: Set up Python ${{ matrix.pyv }}
33-
uses: actions/setup-python@v4
33+
uses: actions/setup-python@v5
3434
with:
3535
python-version: ${{ matrix.pyv }}
3636

@@ -56,7 +56,7 @@ jobs:
5656
run: nox -s tests-${{ matrix.nox_pyv || matrix.pyv }} -- --cov-report=xml
5757

5858
- name: Upload coverage report
59-
uses: codecov/codecov-action@v3.1.1
59+
uses: codecov/codecov-action@v5
6060

6161
- name: Build package
6262
run: nox -s build

.pre-commit-config.yaml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
default_language_version:
22
python: python3
33
repos:
4-
- repo: https://github.com/psf/black
5-
rev: 23.1.0
6-
hooks:
7-
- id: black
84
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.4.0
5+
rev: v5.0.0
106
hooks:
117
- id: check-added-large-files
128
- id: check-case-conflict
@@ -23,32 +19,14 @@ repos:
2319
args: ['--fix=lf']
2420
- id: sort-simple-yaml
2521
- id: trailing-whitespace
22+
- repo: https://github.com/astral-sh/ruff-pre-commit
23+
rev: 'v0.9.3'
24+
hooks:
25+
- id: ruff
26+
args: [--fix, --exit-non-zero-on-fix]
27+
- id: ruff-format
2628
- repo: https://github.com/codespell-project/codespell
27-
rev: v2.2.2
29+
rev: v2.4.1
2830
hooks:
2931
- id: codespell
3032
additional_dependencies: ["tomli"]
31-
- repo: https://github.com/asottile/pyupgrade
32-
rev: v3.3.1
33-
hooks:
34-
- id: pyupgrade
35-
args: [--py38-plus]
36-
- repo: https://github.com/PyCQA/isort
37-
rev: 5.12.0
38-
hooks:
39-
- id: isort
40-
- repo: https://github.com/pycqa/flake8
41-
rev: 6.0.0
42-
hooks:
43-
- id: flake8
44-
additional_dependencies:
45-
- flake8-bugbear==23.1.20
46-
- flake8-comprehensions==3.10.1
47-
- flake8-debugger==4.1.2
48-
- flake8-string-format==0.3.0
49-
- repo: https://github.com/pycqa/bandit
50-
rev: 1.7.4
51-
hooks:
52-
- id: bandit
53-
args: [-c, pyproject.toml]
54-
additional_dependencies: ["toml"]

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Automation using nox."""
2+
23
import glob
34
import os
45

@@ -31,12 +32,11 @@ def lint(session: nox.Session) -> None:
3132
args = *(session.posargs or ("--show-diff-on-failure",)), "--all-files"
3233
session.run("pre-commit", "run", *args)
3334
session.run("python", "-m", "mypy")
34-
session.run("python", "-m", "pylint", *locations)
3535

3636

3737
@nox.session
3838
def build(session: nox.Session) -> None:
39-
session.install("build", "setuptools", "twine")
39+
session.install("build", "twine")
4040
session.run("python", "-m", "build")
4141
dists = glob.glob("dist/*")
4242
session.run("twine", "check", *dists, silent=True)

pyproject.toml

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,45 @@
22
requires = ["setuptools>=48", "setuptools_scm[toml]>=6.3.1"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.setuptools_scm]
5+
[project]
6+
name = "ossfs"
7+
description = "fsspec filesystem for OSS"
8+
readme = "README.rst"
9+
authors = [{ name = "Yanxiang Gao", email = "[email protected]" }]
10+
maintainers = [{ name = "Yanxiang Gao", email = "[email protected]" }]
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Programming Language :: Python :: 3",
14+
"Programming Language :: Python :: 3.8",
15+
"Programming Language :: Python :: 3.9",
16+
"Programming Language :: Python :: 3.10",
17+
"Programming Language :: Python :: 3.11",
18+
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
20+
]
21+
requires-python = ">=3.8"
22+
dependencies = ["aiooss2>=0.2.7", "fsspec>=2023.9.2", "oss2==2.18.1"]
23+
license = { text = "Apache-2.0" }
24+
dynamic = ["version"]
25+
26+
[project.urls]
27+
Homepage = "https://github.com/fsspec/ossfs"
628

7-
[tool.black]
8-
line-length = 88
9-
include = '\.pyi?$'
10-
exclude = '''
11-
/(
12-
\.eggs
13-
| \.git
14-
| \.hg
15-
| \.mypy_cache
16-
| \.tox
17-
| \.venv
18-
| _build
19-
| buck-out
20-
| build
21-
| dist
22-
)/
23-
'''
29+
[project.optional-dependencies]
30+
tests = [
31+
"aliyun-python-sdk-sts==3.1.1",
32+
"pytest-cov>=3,<6",
33+
"pytest-mock>=3.8.2,<4",
34+
"pytest>=7.2.0,<8",
35+
"requests>=2.31.0",
36+
]
37+
dev = ["ossfs[tests]", "mypy==0.971"]
38+
39+
[tool.setuptools.packages.find]
40+
where = ["src"]
41+
namespaces = false
2442

25-
[tool.isort]
26-
profile = "black"
27-
known_first_party = ["ossfs"]
28-
line_length = 88
43+
[tool.setuptools_scm]
2944

3045
[tool.pytest.ini_options]
3146
addopts = "-ra"
@@ -67,19 +82,21 @@ files = ["src", "tests"]
6782
module = ["oss2.*", "fsspec.*", "aliyunsdkcore", "aliyunsdksts.*", "requests"]
6883
ignore_missing_imports = true
6984

70-
[tool.pylint.format]
71-
max-line-length = 88
72-
73-
[tool.pylint.message_control]
74-
enable = ["c-extension-no-member", "no-else-return"]
75-
76-
[tool.pylint.variables]
77-
dummy-variables-rgx = "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_"
78-
ignored-argument-names = "_.*|^ignored_|^unused_|args|kwargs"
79-
8085
[tool.codespell]
8186
ignore-words-list = " "
8287

83-
[tool.bandit]
84-
exclude_dirs = ["tests"]
85-
skips = ["B101"]
88+
[tool.ruff.lint]
89+
select = [
90+
"F", "E", "W", "C90", "I", "N", "UP", "YTT", "ASYNC", "S", "BLE", "B", "A", "C4", "DTZ", "T10",
91+
"EXE", "ISC", "ICN", "LOG", "G", "INP", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET",
92+
"SLOT", "SIM", "TID", "TC", "ARG", "PGH", "PLC", "PLE", "PLR", "PLW", "TRY",
93+
"FLY", "PERF", "FURB", "RUF",
94+
]
95+
ignore = ["D", "FA", "S101", "ANN", "FBT", "PLR2004", "TRY003", "PT011", "SIM117", "TRY300"]
96+
97+
[tool.ruff.lint.flake8-unused-arguments]
98+
ignore-variadic-names = true
99+
100+
[tool.ruff.lint.per-file-ignores]
101+
"docs/**" = ["INP001"]
102+
"tests/**" = ["S", "TRY", "ARG"]

setup.cfg

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/ossfs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
----------------------------------------------------------------
44
A pythonic file-systems interface to OSS (Object Storage Service)
55
"""
6+
67
from .async_oss import AioOSSFileSystem
78
from .core import OSSFileSystem
89
from .file import OSSFile
910

10-
__all__ = ["OSSFile", "OSSFileSystem", "AioOSSFileSystem"]
11+
__all__ = ["AioOSSFileSystem", "OSSFile", "OSSFileSystem"]

0 commit comments

Comments
 (0)