Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
# This workflow will install Python dependencies and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

# Based on https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
name: Code Style

# trigger on every push and pull-request
on: [push, pull_request]
# trigger on PRs and main branches
on:
pull_request:
push:
branches:
- master
- develop

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
runs-on: ubuntu-24.04

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

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
run: uv sync --dev

- name: Lint with flake8
- name: Lint
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
uv run ruff check --output-format=github
43 changes: 24 additions & 19 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
# Based on https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
name: Publish to PyPI

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

environment:
name: pypi

permissions:
id-token: write
contents: read

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

- name: Set up Python
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: '3.x'
version: "0.9.5"

- name: Set up Python
run: uv python install

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: uv build

- name: Build and publish
- name: Publish
# TODO(shamrin) switch to trusted publishing and remove secrets https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_USERNAME }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: uv publish
34 changes: 19 additions & 15 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
# This workflow will install Python dependencies and run unit tests with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

# Based on https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
name: Unit Tests

# trigger on every push and pull-request
on: [push, pull_request]
# trigger on PRs and main branches
on:
pull_request:
push:
branches:
- master
- develop

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
python-version: ['3.11', '3.12', '3.13', '3.14']

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

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

- name: Set up Python
run: uv python install

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pytest pytest-cov pytest-responses responses python-dotenv
run: uv sync --dev

- name: Test with pytest and coverage
run: |
pytest --cov=datacrunch
uv run pytest --cov=datacrunch

- name: 'Upload coverage to Codecov'
uses: codecov/codecov-action@v1
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Migrated to `uv`
- Removed `datacrunch.__version__.VERSION`. Use standard [importlib.metadata.version()](https://docs.python.org/3/library/importlib.metadata.html#importlib.metadata.version) instead:
```python
from importlib.metadata import version
print(version('datacrunch'))
```
- Migrated to Ruff for linting
- Upgraded pytest

If you are working on the library itself, do a fresh clone or upgrade your local development environment in-place:
```bash
# remove old environment
rm -rf datacrunch.egg-info/ .venv/ datacrunch_env/

# create new environment and install dependencies
uv sync

# run example
uv run python examples/simple_create_instance.py
```

## [1.15.0] - 2025-10-23

### Added
Expand Down
49 changes: 27 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ You can open pull requests by following the steps:

## Code Contribution

Prerequisite: install [`uv`](https://docs.astral.sh/uv/).

1. Fork the `datacrunch-python` repo on GitHub.

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

3. Create virtual environment & install this local copy into the virtual environment:
3. Set up local environment and install dependencies:

```bash
python3 -m venv datacrunch_env && source ./datacrunch_env/bin/activate
python3 setup.py develop
uv sync
```

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

5. Make your local changes

6. Install dependencies for test:
6. Run tests:

```bash
pip3 install -e .[test]
pip3 install -U pytest
uv run pytest
```

7. Run tests:
7. Commit and push:

```bash
pytest
```

8. Commit and push:

```bash
git commit .am "Detailed commit message"
git commit -am "Detailed commit message"
git push origin {branch-name}
```

9. Submit a pull request in GitHub.
8. Submit a pull request in GitHub.

## Pull Request Guidelines

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

To release a new version:

1. Update the version in `__version__.py`
2. Add an entry to the `CHANGELOG.md` file
3. `git tag v{major}.{minor}.{patch}`
4. `git push origin master`
5. `git push --tags`
6. [Draft and publish](https://github.com/DataCrunch-io/datacrunch-python/releases) a new release.
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).
1. Bump version:
```bash
uv version --bump minor # also `major` or `patch`
```

2. Update `CHANGELOG.md`

3. Commit and push:
```bash
git commit -m v$(uv version --short) CHANGELOG.md pyproject.toml uv.lock
git tag v$(uv version --short)
git push origin master
git push --tags
```

4. [Draft and publish](https://github.com/DataCrunch-io/datacrunch-python/releases) a new release.

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).
Loading