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

Update python derivation template #419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mweinelt
Copy link
Member

@mweinelt mweinelt commented Mar 11, 2024

  • setuptools builds don't actually require specifying wheel, which can be seen in the example¹ in the setuptools documentation.
  • migrate from
    • nativeBuildInputs to build-system
    • propagatedBuildInputs to dependencies
    • passthru.optional-dependencies to optional-dependencies
  • Expand pythonImportsCheck, so the item is on a new line.

[1] https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html

The primary motivation is to save me many review remarks. I don't generally write rust, so feel free to improve the code.

The new pyproject lingo for the inputs has been introduced on master and will be part of NixOS 24.05.

old

{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel
, cryptography
, pycryptodome
}:

buildPythonPackage rec {
  pname = "joserfc";
  version = "0.9.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "authlib";
    repo = "joserfc";
    rev = version;
    hash = "sha256-+NFCveMPzE0hSs2Qe20/MDHApXVtU3cR/GPFKPqfVV4=";
  };

  nativeBuildInputs = [
    setuptools
    wheel
  ];

  propagatedBuildInputs = [
    cryptography
  ];

  passthru.optional-dependencies = {
    drafts = [
      pycryptodome
    ];
  };

  pythonImportsCheck = [ "joserfc" ];

  meta = with lib; {
    description = "Implementations of JOSE RFCs in Python";
    homepage = "https://github.com/authlib/joserfc";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
  };
}

new

{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, cryptography
, pycryptodome
}:

buildPythonPackage rec {
  pname = "joserfc";
  version = "0.9.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "authlib";
    repo = "joserfc";
    rev = version;
    hash = "sha256-+NFCveMPzE0hSs2Qe20/MDHApXVtU3cR/GPFKPqfVV4=";
  };

  build-system = [
    setuptools
  ];

  dependencies = [
    cryptography
  ];

  optional-dependencies = {
    drafts = [
      pycryptodome
    ];
  };

  pythonImportsCheck = [
    "joserfc"
  ];

  meta = with lib; {
    description = "Implementations of JOSE RFCs in Python";
    homepage = "https://github.com/authlib/joserfc";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
  };
}

- setuptools builds don't actually require specifying wheel, which can
  be seen in the example¹ in the setuptools documentation.
- migrate from
  - nativeBuildInputs to build-system
  - propagatedBuildInputs to dependencies
  - passthru.optional-dependencies to optional-dependencies
- Expand pythonImportsCheck, so the item is on a new line.

[1] https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
@mweinelt
Copy link
Member Author

mweinelt commented May 6, 2024

Friendly ping, two months in.

@drupol
Copy link

drupol commented May 10, 2024

@figsoda ^^

matthiasdotsh added a commit to matthiasdotsh/nixpkgs that referenced this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants