Skip to content

Commit 992c01b

Browse files
authored
Merge pull request #49 from DataCrunch-io/uv
uv and pyproject.toml
2 parents 3ce5810 + bd6333a commit 992c01b

23 files changed

Lines changed: 639 additions & 202 deletions

.github/workflows/code_style.yml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,29 @@
1-
# This workflow will install Python dependencies and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
1+
# Based on https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
42
name: Code Style
53

6-
# trigger on every push and pull-request
7-
on: [push, pull_request]
4+
# trigger on PRs and main branches
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- master
10+
- develop
811

912
jobs:
1013
build:
11-
runs-on: ubuntu-22.04
12-
strategy:
13-
matrix:
14-
python-version: ['3.10', '3.11', '3.12', '3.13']
14+
runs-on: ubuntu-24.04
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v5
1818

19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v2
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v6
2121
with:
22-
python-version: ${{ matrix.python-version }}
22+
version: "0.9.5"
2323

2424
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
python -m pip install flake8
25+
run: uv sync --dev
2826

29-
- name: Lint with flake8
27+
- name: Lint
3028
run: |
31-
# stop the build if there are Python syntax errors or undefined names
32-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
29+
uv run ruff check --output-format=github
Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
name: Upload Python Package
1+
# Based on https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
2+
name: Publish to PyPI
53

64
on:
75
release:
86
types: [published]
97

108
jobs:
119
deploy:
12-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-24.04
11+
12+
environment:
13+
name: pypi
14+
15+
permissions:
16+
id-token: write
17+
contents: read
1318

1419
steps:
15-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v5
1621

17-
- name: Set up Python
18-
uses: actions/setup-python@v2
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v6
1924
with:
20-
python-version: '3.x'
25+
version: "0.9.5"
26+
27+
- name: Set up Python
28+
run: uv python install
2129

22-
- name: Install dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install setuptools wheel twine
30+
- name: Build
31+
run: uv build
2632

27-
- name: Build and publish
33+
- name: Publish
34+
# TODO(shamrin) switch to trusted publishing and remove secrets https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
2835
env:
29-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
30-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
31-
run: |
32-
python setup.py sdist bdist_wheel
33-
twine upload dist/*
36+
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_USERNAME }}
37+
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
38+
run: uv publish

.github/workflows/unit_tests.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
1-
# This workflow will install Python dependencies and run unit tests with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
1+
# Based on https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
42
name: Unit Tests
53

6-
# trigger on every push and pull-request
7-
on: [push, pull_request]
4+
# trigger on PRs and main branches
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- master
10+
- develop
811

912
jobs:
1013
build:
11-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1215
strategy:
1316
matrix:
14-
python-version: ['3.10', '3.11', '3.12', '3.13']
17+
python-version: ['3.11', '3.12', '3.13', '3.14']
1518

1619
steps:
17-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v5
1821

19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v2
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v6
2124
with:
25+
version: "0.9.5"
2226
python-version: ${{ matrix.python-version }}
2327

28+
- name: Set up Python
29+
run: uv python install
30+
2431
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
python -m pip install -r requirements.txt
28-
python -m pip install pytest pytest-cov pytest-responses responses python-dotenv
32+
run: uv sync --dev
2933

3034
- name: Test with pytest and coverage
3135
run: |
32-
pytest --cov=datacrunch
36+
uv run pytest --cov=datacrunch
3337
3438
- name: 'Upload coverage to Codecov'
3539
uses: codecov/codecov-action@v1

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Migrated to `uv`
13+
- Removed `datacrunch.__version__.VERSION`. Use standard [importlib.metadata.version()](https://docs.python.org/3/library/importlib.metadata.html#importlib.metadata.version) instead:
14+
```python
15+
from importlib.metadata import version
16+
print(version('datacrunch'))
17+
```
18+
- Migrated to Ruff for linting
19+
- Upgraded pytest
20+
21+
If you are working on the library itself, do a fresh clone or upgrade your local development environment in-place:
22+
```bash
23+
# remove old environment
24+
rm -rf datacrunch.egg-info/ .venv/ datacrunch_env/
25+
26+
# create new environment and install dependencies
27+
uv sync
28+
29+
# run example
30+
uv run python examples/simple_create_instance.py
31+
```
32+
1033
## [1.15.0] - 2025-10-23
1134

1235
### Added

CONTRIBUTING.md

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ You can open pull requests by following the steps:
88

99
## Code Contribution
1010

11+
Prerequisite: install [`uv`](https://docs.astral.sh/uv/).
12+
1113
1. Fork the `datacrunch-python` repo on GitHub.
1214

1315
2. Clone your fork locally:
@@ -17,11 +19,10 @@ You can open pull requests by following the steps:
1719
cd datacrunch-python
1820
```
1921

20-
3. Create virtual environment & install this local copy into the virtual environment:
22+
3. Set up local environment and install dependencies:
2123

2224
```bash
23-
python3 -m venv datacrunch_env && source ./datacrunch_env/bin/activate
24-
python3 setup.py develop
25+
uv sync
2526
```
2627

2728
4. Create a new branch:
@@ -40,27 +41,20 @@ You can open pull requests by following the steps:
4041

4142
5. Make your local changes
4243

43-
6. Install dependencies for test:
44+
6. Run tests:
4445

4546
```bash
46-
pip3 install -e .[test]
47-
pip3 install -U pytest
47+
uv run pytest
4848
```
4949

50-
7. Run tests:
50+
7. Commit and push:
5151

5252
```bash
53-
pytest
54-
```
55-
56-
8. Commit and push:
57-
58-
```bash
59-
git commit .am "Detailed commit message"
53+
git commit -am "Detailed commit message"
6054
git push origin {branch-name}
6155
```
6256

63-
9. Submit a pull request in GitHub.
57+
8. Submit a pull request in GitHub.
6458

6559
## Pull Request Guidelines
6660

@@ -71,10 +65,21 @@ You can open pull requests by following the steps:
7165

7266
To release a new version:
7367

74-
1. Update the version in `__version__.py`
75-
2. Add an entry to the `CHANGELOG.md` file
76-
3. `git tag v{major}.{minor}.{patch}`
77-
4. `git push origin master`
78-
5. `git push --tags`
79-
6. [Draft and publish](https://github.com/DataCrunch-io/datacrunch-python/releases) a new release.
80-
7. Check that package is automatically published to [PyPI](https://pypi.org/project/datacrunch/) via [GitHub action](https://github.com/DataCrunch-io/datacrunch-python/actions/workflows/publish_package.yml).
68+
1. Bump version:
69+
```bash
70+
uv version --bump minor # also `major` or `patch`
71+
```
72+
73+
2. Update `CHANGELOG.md`
74+
75+
3. Commit and push:
76+
```bash
77+
git commit -m v$(uv version --short) CHANGELOG.md pyproject.toml uv.lock
78+
git tag v$(uv version --short)
79+
git push origin master
80+
git push --tags
81+
```
82+
83+
4. [Draft and publish](https://github.com/DataCrunch-io/datacrunch-python/releases) a new release.
84+
85+
5. Check that package is automatically published to [PyPI](https://pypi.org/project/datacrunch/) via [GitHub action](https://github.com/DataCrunch-io/datacrunch-python/actions/workflows/publish_package.yml).

0 commit comments

Comments
 (0)