Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pyproject.toml #1668

Merged
merged 11 commits into from
Aug 1, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
matrix:
derivation:
- default
- docs
- alot.doc
- alot.man

steps:
- name: Install Nix
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ docs/source/configuration/*table.rst
tags
.eggs
__pycache__
result*/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To ensure timely and painless reviews please keep the following in mind.
For new features also update the user manual in `docs/source/usage` accordingly.

* Unit tests: Make sure your changes don't break any existing tests (to check
locally use `./setup.py test`). If you are fixing a bug or adding a new
locally use `python3 -m unittest`). If you are fixing a bug or adding a new
features please provide new tests if possible.

* Keep commits simple. Large individual patches are incredibly painful to review properly.
Expand Down
8 changes: 7 additions & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ On Fedora/Redhat these are packaged as::
To set up and install the latest development version::

git clone https://github.com/pazz/alot
poetry install --no-root
python3 -m venv dev-venv
. dev-venv/bin/activate
pip install -e .

or you can install the development version into :file:`~/.local/bin`::

pip install --user .

Make sure :file:`~/.local/bin` is in your :envvar:`PATH`. For system-wide
installation omit the `--user` flag and call with the respective permissions.
Expand Down
116 changes: 1 addition & 115 deletions flake.lock

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

61 changes: 32 additions & 29 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,56 @@

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, poetry2nix }:
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
# see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
pkgs = nixpkgs.legacyPackages.${system};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication mkPoetryEnv overrides;
defaultArgs = {
projectDir = self;
overrides = overrides.withDefaults (final: prev: {
gpg = prev.gpgme;
notmuch2 = pkgs.python3.pkgs.notmuch2;
});
};
in
{
packages = {
alot = mkPoetryApplication (defaultArgs // {
nativeBuildInputs = [
pkgs.python3.pkgs.cffi
alot = pkgs.python3Packages.buildPythonApplication {
name = "alot";
version = "dev";
src = self;
pyproject = true;
outputs = [
"out"
"doc"
"man"
];
propagatedBuildInputs = with pkgs; [
build-system = with pkgs.python3Packages; [
setuptools
setuptools-scm
];
dependencies = with pkgs.python3Packages; [
configobj
gpgme
pkgs.gpgme.dev
pkgs.python3.pkgs.cffi
notmuch2
python-magic
twisted
urwid
urwidtrees
];

nativeCheckInputs = with pkgs; [ gnupg notmuch procps ];
postInstall = ''
installShellCompletion --zsh --name _alot extra/completion/alot-completion.zsh
'';
checkPhase = ''
# In the nix sandbox stdin is not a terminal but /dev/null so we
# change the shell command only in this specific test.
sed -i '/test_no_spawn_no_stdin_attached/,/^$/s/test -t 0/sh -c "[ $(wc -l) -eq 0 ]"/' tests/commands/test_global.py

python3 -m unittest -v
'';
});
docs = pkgs.runCommand "alot-docs" {
src = self;
nativeBuildInputs = [
(mkPoetryEnv (defaultArgs // { groups = ["doc"]; }))
pkgs.gnumake
nativeCheckInputs = with pkgs; [ gnupg notmuch procps ];
nativeBuildInputs = with pkgs; [
python3Packages.sphinxHook
installShellFiles
];
} ''make -C $src/docs html man BUILDDIR=$out'';
sphinxBuilders = [ "html" "man" ];
};
docs = pkgs.lib.trivial.warn "The docs attribute moved to alot.doc"
self.packages.${system}.alot.doc;
default = self.packages.${system}.alot;
};
});
Expand Down
Loading