Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Commit 2ee0858

Browse files
authored
Fix use of importlib.metadata and unify requirements.txt (#8)
* Fix importlib usage and unify requirements.txt * Remove requirements-37.txt * Add a test matrix to additionally test against 3.7
1 parent da792c2 commit 2ee0858

File tree

6 files changed

+67
-340
lines changed

6 files changed

+67
-340
lines changed

.github/workflows/test.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ on: [push, pull_request]
2121
jobs:
2222
test:
2323
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
python-version:
28+
- "3.7"
29+
- "3.10"
2430
steps:
2531
- uses: actions/checkout@v2
2632
- name: Setup Rust toolchain
@@ -40,13 +46,14 @@ jobs:
4046
key: target-maturin-cache-
4147
- uses: actions/setup-python@v2
4248
with:
43-
python-version: "3.10"
49+
python-version: ${{ matrix.python-version }}
4450
- name: Create Virtualenv
4551
run: |
4652
python -m venv venv
4753
source venv/bin/activate
4854
pip install -r requirements.txt
4955
- name: Run Linters
56+
if: ${{ matrix.python-version == '3.10' }}
5057
run: |
5158
source venv/bin/activate
5259
flake8 --exclude venv --ignore=E501

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ python3 -m venv venv
140140
source venv/bin/activate
141141
# update pip itself if necessary
142142
python -m pip install -U pip
143-
# if python -V gives python 3.7
144-
python -m pip install -r requirements-37.txt
145-
# if python -V gives python 3.8/3.9/3.10
143+
# install dependencies
146144
python -m pip install -r requirements.txt
147145
```
148146

@@ -161,9 +159,6 @@ To change test dependencies, change the `requirements.in` and run
161159
```bash
162160
# install pip-tools (this can be done only once), also consider running in venv
163161
python -m pip install pip-tools
164-
165-
# change requirements.in and then run
166-
python -m piptools compile --generate-hashes -o requirements-37.txt
167162
# or run this is you are on python 3.8/3.9/3.10
168163
python -m piptools compile --generate-hashes -o requirements.txt
169164
```

datafusion/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
from abc import ABCMeta, abstractmethod
1919
from typing import List
2020

21-
import importlib.metadata
21+
try:
22+
import importlib.metadata as importlib_metadata
23+
except ImportError:
24+
import importlib_metadata
25+
26+
2227
import pyarrow as pa
2328

2429
from ._internal import (
@@ -30,7 +35,7 @@
3035
)
3136

3237

33-
__version__ = importlib.metadata.version("datafusion")
38+
__version__ = importlib_metadata.version(__name__)
3439

3540

3641
__all__ = [

0 commit comments

Comments
 (0)