Skip to content
Draft
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
23 changes: 16 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,28 @@ jobs:
run: |
echo "Active Python: $(python --version)"
python --version | grep -q "^Python ${{ matrix.python-version }}" || (echo "ERROR: Expected Python ${{ matrix.python-version }}" && exit 1)
- name: Install dependencies
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pyright pyflakes pytest setuptools wheel
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
python -m pip install uv setuptools wheel
- name: Set python version file for uv
run: |
echo "${{ matrix.python-version }}" > .python-version
- name: Install dependencies
run: |
uv lock --check
uv sync
- name: Lint with flake8
run: python -m flake8 . --exclude=.venv --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
run: uv run flake8 . --exclude=.venv --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
- name: Lint with pyright (type checking)
run: python -m pyright cf_remote
run: uv run pyright cf_remote
- name: Lint with pyflakes
run: python -m pyflakes cf_remote
run: uv run pyflakes cf_remote
- name: Test with pytest
run: python -m pytest
run: uv run pytest
- name: Reset python version file
run: |
git restore .python-version
- name: Install
run: |
python setup.py sdist bdist_wheel
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
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: default format lint install check venv

default: check

venv:
uv venv --clear
uv sync

format: venv
uv run black cf_remote/ tests/

lint: venv
uv run black --check cf_remote/ tests/ --fast
uv run flake8 cf_remote/ tests/ --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
uv run pyflakes cf_remote/
uv run pyright cf_remote/

install:
pipx install --force --editable .

check: venv format lint
uv run pytest
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,17 @@ You can also pick up an existing task or file an issue in [our bug tracker](http

## Development

This project uses [uv](https://docs.astral.sh/uv/) for managing the virtual environment, dependencies, building, etc.
To set up a virtual environment with all dependencies and run all formatters, linters, and tests, use:

```
$ make check
```

To install `cf-remote` so that it reflects any changes in this source directory use:

```
$ pip install --editable .
$ pipx install --force --editable .
```

## cloud_data.py tips
Expand Down
42 changes: 42 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
# Note on backwards compatibility: cf-remote must stay installable on
# Python 3.5 (pip <= 20.3.4, setuptools <= 50.x). Old setuptools does not
# read the [project] table and uses setup.py, so all package metadata
# lives in setup.py and is declared "dynamic" here. Do not add a
# [build-system] table - the PEP 518 default (setuptools + wheel,
# unpinned) is what allows old environments to build with old setuptools.
# The [project] table below exists so that modern tooling (uv) can lock,
# sync, and build the project.

[project]
name = "cf-remote"
requires-python = ">=3.5"
dynamic = [
"version",
"description",
"readme",
"authors",
"classifiers",
"urls",
"scripts",
"dependencies",
]

[tool.uv]
# Install the project into the venv even though there is no [build-system]
# table (see note above) - uv falls back to the default setuptools backend.
package = true
# Development environments and uv.lock only cover modern Python versions
# (3.8.1 is the minimum for flake8), published packages still support
# Python >= 3.5 (see note above).
environments = ["python_full_version >= '3.8.1'"]

[tool.pyright]
include = ["cf_remote"]
venvPath = "."
venv = ".venv"

[dependency-groups]
dev = [
"black>=24.8.0",
"coverage>=7.6.1",
"flake8>=7.1.2",
"pyflakes>=3.2.0",
"pyright>=1.1.390",
"pytest>=8.3.4",
]
10 changes: 5 additions & 5 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
set -e
set -x
black --check cf_remote/*.py || true
black --check tests/*.py || true
uv run black --check cf_remote/*.py || true
uv run black --check tests/*.py || true
if [ -z "$1" ]; then
python3 -m coverage run -m pytest
python3 -m coverage html
uv run coverage run -m pytest
uv run coverage html
else
# for debugging, getting all output, and running a single test method:
python3 -m pytest -k "$1" --show-capture=all -vv
uv run pytest -k "$1" --show-capture=all -vv
fi
Loading
Loading