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
28 changes: 17 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,46 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies.
- name: Fetch dependencies.
run: uv sync --frozen --dev --all-extras --no-install-project --python=${{ matrix.python-version }}

- name: Lint with ruff.
run: |
make
uv run ruff check .

- name: Test with pytest.
- name: Type-check with mypy.
run: |
make test
uv run ruff check .

- name: Lint with mypy and ruff.
- name: Test with pytest.
run: |
make lint
uv run pytest tests/

package:
runs-on: "${{ matrix.platform }}"
strategy:
matrix:
platform: ["ubuntu-latest"]
python-version: ["3.12"]
python-version: ["3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies.
run: |
pip install --upgrade pip twine
run: uv sync --frozen --dev --all-extras --no-install-project --python=${{ matrix.python-version }}

- name: Build the package.
run: |
make build
uv build . --package disruptive

- name: Check twine.
run: python -m twine check dist/*
run: uv run --with twine twine check dist/*
11 changes: 5 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: |
pip install pytest pytest-mock pytest-cov
pip install -e .[extra]
run: uv sync --frozen --dev --all-extras --no-install-project --python=${{ matrix.python-version }}

# Install coverage dependencies and generate report.
- name: Generate coverage report
run: |
pytest --cov=disruptive --cov-report=xml tests/
run: uv run pytest --cov=disruptive --cov-report=xml tests/

# Using the generated report, upload to codecov.
- name: Upload coverage to Codecov
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
run: uv sync --frozen --dev --no-extras --no-install-project --python=${{ matrix.python-version }}

- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
uv build . --package disruptive
uv run --with twine twine upload dist/*
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ target/
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down Expand Up @@ -150,4 +147,10 @@ notes.md
README.pdf

# macOS metadata
.DS_Store
.DS_Store

# Python Development
.ruff_cache
.mypy_cache
*__marimo__/
.python-version
30 changes: 0 additions & 30 deletions Makefile

This file was deleted.

18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,19 @@ python examples/example_name.py
If a request is unsuccessful or has been provided with invalid parameters, an exception is raised. A list of available exceptions are available in the [API Reference](https://developer.disruptive-technologies.com/api/libraries/python/client/errors.html).

## Development
This repository uses `uv` to manage dependencies.

Set up the development virtualenv environment:
Unit-tests
```
make
uv run --extra extra pytest tests/
```

Run unit-tests against the currently active python version:
Linting
```
make test
uv run ruff check .
```

Lint the package code using MyPy and ruff:
Type-Checking
```
make lint
```

Build the package distribution:
```
make build
uv run mypy disruptive/
```
50 changes: 49 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
[project]
name = "disruptive"
dynamic = ["version"]
description = "Disruptive Technologies Python API."
authors = [
{name = "Disruptive Technologies Research AS", email = "developer-support@disruptive-technologies.com"}
]
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["disruptive", "dt", "rest", "api"]
classifiers = [
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
]
requires-python = ">=3.9"
dependencies = [
"requests>=2.19.0, <3.0.0",
]

[project.urls]
Repository = "https://github.com/disruptive-technologies/disruptive-python"
Documentation = "https://developer.disruptive-technologies.com/api/libraries/python/"

[project.optional-dependencies]
extra = [
"pandas>=2.2.3",
"polars>=1.22.0",
]

[dependency-groups]
dev = [
"mypy>=1.15.0",
"pytest>=8.3.4",
"pytest-cov>=6.0.0",
"pytest-mock>=3.14.0",
"ruff>=0.9.7",
"setuptools>=75.8.0",
"wheel>=0.45.1",
]

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.ruff]
line-length = 79
line-length = 79
59 changes: 0 additions & 59 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_eventhistory.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from unittest import mock
from dataclasses import dataclass
from unittest import mock

import pytest

import disruptive
from disruptive.events.events import Event
import tests.api_responses as dtapiresponses
from disruptive.events.events import Event


class TestEventHistory:
Expand Down
Loading
Loading