Skip to content

Commit

Permalink
change ci to use uv
Browse files Browse the repository at this point in the history
  • Loading branch information
adfaure committed Nov 25, 2024
1 parent 46cad77 commit a99d46d
Show file tree
Hide file tree
Showing 3 changed files with 1,039 additions and 15 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ on:
- "docs/**"
- "*.md"
branches:
- main
- uv
pull_request:
branches:
- main
workflow_dispatch:

# https://github.com/python-poetry/poetry/issues/8623
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring

jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -34,22 +30,18 @@ jobs:
with:
python-version: "${{ matrix.python-version }}"

- name: Setup Environment
env:
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring
run: |
python3 -m pip install -U pip setuptools
python3 -m pip install poetry==1.7.1
poetry install --with=dev
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Version info
run: |
poetry run python main.py --version
uv run python main.py --version
- name: Test with pytest
run: |
poetry run pytest
uv run python -m pytest tests
- name: Check with MyPy
run: |
poetry run mypy .
uv run mypy .
48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachSystem ["x86_64-linux"] (
system: let
pkgs = import nixpkgs {inherit system;};
in {
formatter = pkgs.alejandra;
packages = {
organize = pkgs.python3Packages.buildPythonPackage {
name = "simplerest";
pyproject = true;
src = ./simplerest;

propagatedBuildInputs = [
pkgs.python3Packages.fastapi
];

buildInputs = [
pkgs.python3
pkgs.python3Packages.setuptools
pkgs.python3Packages.wheel
pkgs.python3Packages.uvicorn
];
};
};

devShells = let
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
# Python deps
uv
ruff
];
};
};
}
);
}
Loading

0 comments on commit a99d46d

Please sign in to comment.