nixpkgs/pkgs/development/python-modules/django_silk/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

65 lines
1.5 KiB
Nix

{ lib, stdenv
, buildPythonPackage
, python
, fetchFromGitHub
, django
, pygments
, simplejson
, dateutil
, requests
, sqlparse
, jinja2
, autopep8
, pytz
, pillow
, mock
, gprof2dot
, freezegun
, contextlib2
, networkx
, pydot
, factory_boy
}:
buildPythonPackage rec {
pname = "django-silk";
version = "4.0.1";
# pypi tarball doesn't include test project
src = fetchFromGitHub {
owner = "jazzband";
repo = "django-silk";
rev = version;
sha256 = "0yy9rzxvwlp2xvnw76r9hnqajlp417snam92xpb6ay0hxwslwqyb";
};
# "test_time_taken" tests aren't suitable for reproducible execution, but django's
# test runner doesn't have an easy way to ignore tests - so instead prevent it from picking
# them up as tests
postPatch = ''
substituteInPlace project/tests/test_silky_profiler.py \
--replace "def test_time_taken" "def _test_time_taken"
substituteInPlace setup.py \
--replace 'use_scm_version=True' 'version="${version}"'
'';
buildInputs = [ mock ];
propagatedBuildInputs = [
django pygments simplejson dateutil requests
sqlparse jinja2 autopep8 pytz pillow gprof2dot
];
checkInputs = [ freezegun contextlib2 networkx pydot factory_boy ];
checkPhase = ''
cd project
DB=sqlite3 DB_NAME=db.sqlite3 ${python.interpreter} manage.py test
'';
meta = with lib; {
description = "Silky smooth profiling for the Django Framework";
homepage = "https://github.com/jazzband/django-silk";
license = licenses.mit;
maintainers = with maintainers; [ ris ];
};
}