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
2 changes: 2 additions & 0 deletions .github/workflows/cd-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
uses: actions/checkout@v4
- name: "[INIT] Install uv"
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
- name: "[EXEC] Build project"
run: uv build
- name: "[EXEC] Publish package"
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/ci-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ jobs:
defaults:
run:
shell: bash
strategy:
matrix:
python: ["3.10"]
steps:
- name: "[INIT] Checkout repository"
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "[INIT] Install uv"
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
enable-cache: true
- name: "[INIT] Install dependencies"
run: uv sync --locked --all-extras --dev
Expand All @@ -37,10 +35,11 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: "[INIT] Checkout repository"
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "[INIT] Install uv"
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python }}
enable-cache: true
- name: "[INIT] Install dependencies"
run: uv sync --locked --all-extras --dev --group test
Expand Down
64 changes: 8 additions & 56 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 51 additions & 31 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# TODO: use uv2nix
{
inputs = {
utils.url = "github:numtide/flake-utils";
hooks.url = "github:cachix/git-hooks.nix";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -13,53 +15,71 @@
outputs = {
self,
hooks,
utils,
nixpkgs,
pyproject,
...
}:
utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
}: let
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system: function system nixpkgs.legacyPackages.${system});
project = pyproject.lib.project.loadPyproject {projectRoot = ./.;};
in {
devShells = forAllSystems (system: pkgs: let
python = pkgs.python312;
project = pyproject.lib.project.loadPyproject {projectRoot = ./.;};
arg = project.renderers.withPackages {inherit python;};
pyenv = python.withPackages arg;
check = self.checks.${system}.pre-commit-check;
in {
devShells.default = let
arg = project.renderers.withPackages {inherit python;};
pyenv = python.withPackages arg;
check = self.checks.${system}.pre-commit-check;
in
pkgs.mkShell {
inherit (check) shellHook;
default = pkgs.mkShell {
inherit (check) shellHook;

packages = check.enabledPackages ++ [
packages =
check.enabledPackages
++ [
pyenv
pkgs.uv
pkgs.pyright
pkgs.hyperfine
];
};
};
});

packages.default = let
attrs = project.renderers.buildPythonPackage {inherit python;};
in
python.pkgs.buildPythonPackage attrs;
packages = forAllSystems (system: pkgs: let
python = pkgs.python312;
attrs = project.renderers.buildPythonPackage {inherit python;};
in {
default = python.pkgs.buildPythonPackage attrs;
});

apps.default = {
apps = forAllSystems (system: _: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/proselint";
};
});

checks = {
pre-commit-check = hooks.lib.${system}.run {
src = ./.;
hooks = {
trim-trailing-whitespace.enable = true;
end-of-file-fixer.enable = true;
mixed-line-endings.enable = true;
markdownlint.enable = true;
ruff.enable = true;
pyright.enable = true;
checks = forAllSystems (system: _: {
pre-commit-check = hooks.lib.${system}.run {
src = ./.;
hooks = {
trim-trailing-whitespace.enable = true;
end-of-file-fixer.enable = true;
mixed-line-endings.enable = true;
markdownlint.enable = true;
ruff.enable = true;
pyright.enable = true;
convco.enable = true;
alejandra.enable = true;
statix = {
enable = true;
settings.ignore = ["/.direnv"];
};
};
};
});
};
}
Loading