Skip to content

Commit ab1ccc2

Browse files
[ENH] Use hatch (#1553)
Co-authored-by: Martin Durant <[email protected]>
1 parent e748c6b commit ab1ccc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+296
-3372
lines changed

.github/workflows/codespell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414

1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
- name: Codespell
1919
uses: codespell-project/actions-codespell@v1

.github/workflows/main.yaml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: "*"
5+
branches: ["*"]
66
pull_request:
7-
branches: master
7+
branches: [master]
88

99
jobs:
1010
linux:
@@ -13,14 +13,14 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
PY: ["3.8", "3.9", "3.10", "3.11"]
16+
PY: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1717

1818
env:
1919
CIRUN: true
2020

2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 0
2626

@@ -34,20 +34,22 @@ jobs:
3434
- name: Run Tests
3535
shell: bash -l {0}
3636
run: |
37+
pip install s3fs
38+
pip uninstall s3fs
39+
pip install -e .[test_full]
40+
pip install s3fs --no-deps
3741
pytest -v
3842
3943
win:
4044
name: pytest-win
4145
runs-on: windows-2019
42-
strategy:
43-
fail-fast: false
4446

4547
env:
4648
CIRUN: true
4749

4850
steps:
4951
- name: Checkout
50-
uses: actions/checkout@v3
52+
uses: actions/checkout@v4
5153
with:
5254
fetch-depth: 0
5355

@@ -59,6 +61,10 @@ jobs:
5961
- name: Run Tests
6062
shell: bash -l {0}
6163
run: |
64+
pip install s3fs
65+
pip uninstall s3fs
66+
pip install -e .[test]
67+
pip install s3fs --no-deps
6268
pytest -v
6369
6470
lint:
@@ -75,7 +81,7 @@ jobs:
7581
# runs-on: ubuntu-latest
7682
# steps:
7783
# - name: Checkout
78-
# uses: actions/checkout@v3
84+
# uses: actions/checkout@v4
7985
#
8086
# - name: Setup conda
8187
# uses: mamba-org/setup-micromamba@v1
@@ -93,7 +99,7 @@ jobs:
9399

94100
steps:
95101
- name: Checkout
96-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
97103
with:
98104
fetch-depth: 0
99105

@@ -105,35 +111,20 @@ jobs:
105111
- name: Local install
106112
shell: bash -l {0}
107113
run: |
108-
git config --global user.email "[email protected]"
109-
git config --global user.name "Your Name"
110-
git tag -a 3000 -m "fake"
111-
pip install -e .
112-
113-
- name: Clone s3fs
114-
shell: bash -l {0}
115-
run: git clone https://github.com/fsspec/s3fs
116-
117-
- name: Install s3fs
118-
shell: bash -l {0}
119-
run: |
120-
pip install -e ./s3fs --no-deps
114+
sh install_s3fs.sh
115+
pip install -e .[test,test_downstream]
116+
pip list
121117
122118
- name: Run fsspec tests
123119
shell: bash -l {0}
124120
run: |
125121
pytest -v fsspec/tests/test_downstream.py
126122
127-
- name: clone dask
128-
shell: bash -l {0}
129-
run: |
130-
git clone https://github.com/dask/dask
131-
pip install -e ./dask
132-
133123
- name: Run dask tests
134124
shell: bash -l {0}
135125
run: |
136-
pytest -v dask/dask/bytes
126+
dask_test_path=$(python -c "import dask.bytes;print(dask.bytes.__path__[0])")
127+
pytest -v $dask_test_path
137128
138129
fsspec_friends:
139130
name: ${{ matrix.FRIEND }}-pytest
@@ -151,7 +142,7 @@ jobs:
151142

152143
steps:
153144
- name: Checkout
154-
uses: actions/checkout@v3
145+
uses: actions/checkout@v4
155146

156147
- name: Setup conda
157148
uses: mamba-org/setup-micromamba@v1

.github/workflows/pypipublish.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: Set up Python
1313
uses: actions/setup-python@v4
1414
with:
1515
python-version: "3.x"
1616
- name: Install dependencies
1717
run: |
1818
python -m pip install --upgrade pip
19-
pip install setuptools setuptools-scm wheel twine
19+
pip install hatch twine
2020
- name: Build and publish
2121
env:
2222
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2323
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2424
run: |
25-
python setup.py sdist bdist_wheel
25+
hatch build
2626
twine upload dist/*

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ wheels/
2828
.installed.cfg
2929
*.egg
3030
pip-wheel-metadata/
31-
31+
_version.py
3232
# PyInstaller
3333
# Usually these files are written by a python script from a template
3434
# before PyInstaller builds the exe, so as to inject date/other infos into it.
@@ -121,3 +121,4 @@ ENV/
121121
*.swp
122122

123123
build/
124+
downstream/*

.pre-commit-config.yaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,19 @@ exclude: >
55
repos:
66

77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v3.4.0
8+
rev: v4.5.0
99
hooks:
1010
- id: trailing-whitespace
1111
- id: end-of-file-fixer
1212
- id: check-docstring-first
1313
- id: check-json
1414
- id: check-yaml
15-
- repo: https://github.com/ambv/black
16-
rev: 22.3.0
17-
hooks:
18-
- id: black
1915
- repo: https://github.com/astral-sh/ruff-pre-commit
2016
# Ruff version.
21-
rev: v0.2.1
17+
rev: v0.3.4
2218
hooks:
2319
# Run the linter.
2420
- id: ruff
25-
args: [ --fix ]
26-
- repo: https://github.com/PyCQA/flake8
27-
rev: 5.0.4
28-
hooks:
29-
- id: flake8
30-
- repo: https://github.com/asottile/seed-isort-config
31-
rev: v2.2.0
32-
hooks:
33-
- id: seed-isort-config
34-
- repo: https://github.com/pre-commit/mirrors-isort
35-
rev: v5.7.0
36-
hooks:
37-
- id: isort
21+
args: [ --fix, "--show-fixes"]
22+
- id: ruff-format
23+
types_or: [python]

MANIFEST.in

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

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ in the "ci/" directory. Note that the main environment is called "py38",
4646
but it is expected that the version of python installed be adjustable at
4747
CI runtime. For local use, pick a version suitable for you.
4848

49+
```bash
50+
# For a new environment (mamba / conda).
51+
mamba create -n fsspec -c conda-forge python=3.9 -y
52+
conda activate fsspec
53+
54+
# Standard dev test install.
55+
pip install -e ".[dev,test]"
56+
57+
# Full tests except for downstream
58+
pip install s3fs
59+
pip uninstall s3fs
60+
pip install -e .[dev,test_full]
61+
pip install s3fs --no-deps
62+
pytest -v
63+
64+
# Downstream tests.
65+
sh install_s3fs.sh
66+
# Windows powershell.
67+
install_s3fs.sh
68+
```
69+
4970
### Testing
5071

5172
Tests can be run in the dev environment, if activated, via ``pytest fsspec``.

ci/environment-downstream.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,5 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.9
6-
- dask
7-
- pandas
8-
- xarray
9-
- zarr
10-
- pytest<8
11-
- pytest-cov
12-
- pytest-rerunfailures
13-
- pytest-timeout
14-
- pytest-xdist
15-
- s3fs
16-
- requests
17-
- moto <5
18-
- sqlalchemy<2
19-
- flask
20-
- dask-expr
6+
- pip:
7+
- git+https://github.com/dask/dask

ci/environment-friends.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies:
88
- pytest-benchmark
99
- pytest-cov
1010
- pytest-mock
11-
- pytest-vcr
1211
- pip
1312
- pytest<8
1413
- ujson

ci/environment-py38.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,9 @@ name: test_env
22
channels:
33
- conda-forge
44
dependencies:
5-
# - python=3.8 # set by env
65
- pip
7-
- paramiko
8-
- requests
9-
- zstandard
10-
- python-snappy
11-
- aiohttp
12-
- lz4
13-
- distributed
14-
- dask
15-
- pyarrow
16-
- panel
17-
- notebook
18-
- pygit2
196
- git
20-
- s3fs
21-
- pyftpdlib
22-
- cloudpickle
23-
- pytest <8
24-
- pytest-asyncio !=0.22.0
25-
- pytest-benchmark
26-
- pytest-cov
27-
- pytest-mock
28-
- pytest-vcr
297
- py
30-
- fusepy
31-
- fastparquet
32-
- tomli < 2
33-
- msgpack-python
34-
- python-libarchive-c
35-
- numpy
36-
- nomkl
37-
- jinja2
38-
- tqdm
39-
- urllib3 <=1.26.18
408
- pip:
419
- hadoop-test-cluster
4210
- smbprotocol

ci/environment-win.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,3 @@ channels:
33
- conda-forge
44
dependencies:
55
- python=3.9
6-
- aiohttp
7-
- pip
8-
- requests
9-
- zstandard
10-
- python-snappy
11-
- lz4<3.1.3
12-
- pyftpdlib
13-
- cloudpickle
14-
- fastparquet
15-
- pandas
16-
- pytest <8
17-
- pytest-asyncio !=0.22.0
18-
- pytest-benchmark
19-
- pytest-cov
20-
- pytest-mock
21-
- pytest-vcr
22-
- python-libarchive-c
23-
- py
24-
- numpy
25-
- nomkl
26-
- s3fs
27-
- tqdm

fsspec/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from importlib.metadata import entry_points
22

3-
from . import _version, caching
3+
from . import caching
4+
from ._version import __version__ # noqa: F401
45
from .callbacks import Callback
56
from .compression import available_compressions
67
from .core import get_fs_token_paths, open, open_files, open_local, url_to_fs
@@ -15,8 +16,6 @@
1516
)
1617
from .spec import AbstractFileSystem
1718

18-
__version__ = _version.get_versions()["version"]
19-
2019
__all__ = [
2120
"AbstractFileSystem",
2221
"FSTimeoutError",

0 commit comments

Comments
 (0)