Unverified Commit 53879a32 authored by Yt's avatar Yt Committed by GitHub
Browse files

python313Packages.litestar: refactor (#440778)

parents 4ef81833 f922c3c1
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  cargo,
  fetchFromGitHub,
  poetry-core,
  pytestCheckHook,
  rustc,
  rustPlatform,
}:

buildPythonPackage rec {
  pname = "fast-query-parsers";
  version = "1.0.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "litestar-org";
    repo = "fast-query-parsers";
    tag = "v${version}";
    hash = "sha256-08xL0sOmUzsZYtM1thYUV93bj9ERr3LaVrW46zBrzeE=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit src;
    name = "${pname}-${version}";
    hash = "sha256-kp5bCmHYMS/e8eM6HrRw0JlVaxwPscFGDLQ0PX4ZIC4=";
  };

  build-system = [
    cargo
    poetry-core
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
    rustc
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "fast_query_parsers" ];

  meta = {
    description = "Ultra-fast query string and url-encoded form-data parsers";
    homepage = "https://github.com/litestar-org/fast-query-parsers";
    changelog = "https://github.com/litestar-org/fast-query-parsers/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}
+82 −25
Original line number Diff line number Diff line
@@ -7,37 +7,55 @@
  hatchling,

  # dependencies
  annotated-types,
  anyio,
  asyncpg,
  attrs,
  brotli,
  click,
  cryptography,
  fsspec,
  httpx,
  jinja2,
  jsbeautifier,
  litestar-htmx,
  mako,
  minijinja,
  fast-query-parsers,
  msgspec,
  multidict,
  multipart,
  picologging,
  polyfactory,
  piccolo,
  prometheus-client,
  psutil,
  opentelemetry-instrumentation-asgi,
  psycopg,
  pydantic-extra-types,
  pydantic,
  email-validator,
  pyjwt,
  pyyaml,
  redis,
  rich,
  rich-click,
  rich,
  structlog,
  time-machine,
  trio,
  typing-extensions,
  uvicorn,
  valkey,

  # tests
  pytestCheckHook,
  httpx-sse,
  pytest-asyncio,
  pytest-lazy-fixtures,
  pytest-xdist,
  pytest-mock,
  pytest-asyncio,
  pytest-timeout,
  pytest-rerunfailures,
  pytest-timeout,
  pytest-xdist,
  pytestCheckHook,
  trio,
  versionCheckHook,
}:

@@ -53,61 +71,100 @@ buildPythonPackage rec {
    hash = "sha256-67O/NxPBBLa1QfH1o9laOAQEin8jRA8SkcV7QEzCjI0=";
  };

  build-system = [
    hatchling
  ];
  build-system = [ hatchling ];

  dependencies = [
    anyio
    asyncpg
    click
    cryptography
    fast-query-parsers
    fsspec
    httpx
    jinja2
    litestar-htmx
    mako
    msgspec
    multidict
    picologging
    multipart
    polyfactory
    psutil
    psycopg
    pyyaml
    redis
    rich
    rich-click
    time-machine
    trio
    typing-extensions
  ];

  optional-dependencies = {
    annotated-types = [ annotated-types ];
    attrs = [ attrs ];
    brotli = [ brotli ];
    cli = [
      jsbeautifier
      uvicorn
    ];
    cryptography = [ cryptography ];
    htmx = [ litestar-htmx ];
    jinja = [ jinja2 ];
    jwt = [
      cryptography
      pyjwt
    ];
    mako = [ mako ];
    minijinja = [ minijinja ];
    opentelemetry = [ opentelemetry-instrumentation-asgi ];
    piccolo = [ piccolo ];
    picologging = [ picologging ];
    polyfactory = [ polyfactory ];
    prometheus = [ prometheus-client ];
    pydantic = [
      pydantic
      email-validator
      pydantic-extra-types
    ];
    redis = [ redis ] ++ redis.optional-dependencies.hiredis;
    # sqlalchemy = [ advanced-alchemy ];
    structlog = [ structlog ];
    valkey = [ valkey ] ++ valkey.optional-dependencies.libvalkey;
    yaml = [ pyyaml ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    httpx-sse
    pytest-asyncio
    pytest-lazy-fixtures
    pytest-xdist
    pytest-mock
    pytest-asyncio
    pytest-timeout
    pytest-rerunfailures
    pytest-timeout
    pytest-xdist
    pytestCheckHook
    time-machine
    trio
    versionCheckHook
  ];

  versionCheckProgramArg = "version";

  __darwinAllowLocalNetworking = true;

  preCheck = ''
    export PATH=$out/bin:$PATH
  '';

  enabledTestPaths = [
    # Follow github CI
    # Follow GitHub CI
    "docs/examples/"
  ];

  disabledTests = [
    # StartupError
    "test_subprocess_async_client"
  ];

  meta = {
    description = "Production-ready, Light, Flexible and Extensible ASGI API framework";
    homepage = "https://litestar.dev/";
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ bot-wxt1221 ];
    changelog = "https://github.com/litestar-org/litestar/releases/tag/${src.tag}";
    description = "Production-ready, Light, Flexible and Extensible ASGI API framework";
    license = lib.licenses.mit;
    mainProgram = "litestar";
    maintainers = with lib.maintainers; [ bot-wxt1221 ];
    platforms = lib.platforms.unix;
  };
}
+106 −0
Original line number Diff line number Diff line
{
  lib,
  aiosqlite,
  asyncpg,
  black,
  buildPythonPackage,
  colorama,
  email-validator,
  fetchFromGitHub,
  httpx,
  inflection,
  jinja2,
  orjson,
  postgresql,
  postgresqlTestHook,
  pydantic,
  pytestCheckHook,
  python-dateutil,
  setuptools,
  targ,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "piccolo";
  version = "1.28.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "piccolo-orm";
    repo = "piccolo";
    tag = version;
    hash = "sha256-5VzcMLPf12E+IEOaTUrxHl0W9r7NPUY542qOanrjG4w=";
  };

  build-system = [ setuptools ];

  dependencies = [
    black
    colorama
    inflection
    jinja2
    pydantic
    targ
    typing-extensions
  ];

  optional-dependencies = {
    orjson = [ orjson ];
    postgres = [ asyncpg ];
    sqlite = [ aiosqlite ];
  };

  nativeCheckInputs = [
    email-validator
    httpx
    postgresql
    postgresqlTestHook
    pytestCheckHook
    python-dateutil
  ]
  ++ lib.flatten (builtins.attrValues optional-dependencies);

  pythonImportsCheck = [ "piccolo" ];

  disabledTests = [
    # Timing issues
    "TestMigrations"
    "TestForwardsBackwards"
    "TestMigrationManager"
    "TestTableStorage"
    "TestGraph"
    "TestDumpLoad"
    "test_add_column"
    "test_altering_table_in_schema"
    "test_auto_all"
    "test_auto"
    "test_clean"
    "test_column_name_correct"
    "test_create_table"
    "test_get_table_classes"
    "test_integer_to_bigint"
    "test_integer_to_varchar"
    "test_lazy_reference_to_app"
    "test_lazy_table_reference"
    "test_new"
    "test_on_conflict"
    "test_psql"
    "test_run"
    "test_set_digits"
    "test_set_length"
    "test_set_null"
    "test_shared"
    "test_show_all"
    "test_warn_if_are_conflicting_objects"
    "test_warn_if_is_conflicting"
  ];

  meta = {
    description = "ORM and query builder which supports asyncio";
    homepage = "https://github.com/piccolo-orm/piccolo";
    changelog = "https://github.com/piccolo-orm/piccolo/blob/${src.tag}/CHANGES.rst";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}
+41 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  colorama,
  docstring-parser,
  fetchFromGitHub,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "targ";
  version = "0.6.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "piccolo-orm";
    repo = "targ";
    tag = version;
    hash = "sha256-myQe8Gpnx5CqKnYNK0PZ2P7o+eVWKLInjyTaZd30WxU=";
  };

  build-system = [ setuptools ];

  dependencies = [
    colorama
    docstring-parser
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "targ" ];

  meta = {
    description = "Python CLI using type hints and docstrings";
    homepage = "https://github.com/piccolo-orm/targ/";
    changelog = "https://github.com/piccolo-orm/targ/blob/${src.tag}/CHANGES.rst";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}
+24 −18
Original line number Diff line number Diff line
@@ -2,26 +2,27 @@
  lib,
  authlib,
  buildPythonPackage,
  deprecation,
  fastapi,
  fetchFromGitHub,
  grpcio,
  flask,
  grpcio-health-checking,
  grpcio-tools,
  grpcio,
  h5py,
  httpx,
  litestar,
  numpy,
  pandas,
  polars,
  pydantic,
  pytest-asyncio,
  pytest-httpserver,
  pytestCheckHook,
  pythonOlder,
  requests,
  setuptools-scm,
  validators,
  pytestCheckHook,
  numpy,
  pytest-httpserver,
  pandas,
  polars,
  h5py,
  litestar,
  pytest-asyncio,
  flask,
  fastapi,
}:

buildPythonPackage rec {
@@ -48,19 +49,20 @@ buildPythonPackage rec {

  dependencies = [
    authlib
    grpcio
    deprecation
    fastapi
    flask
    grpcio
    grpcio-health-checking
    grpcio-tools
    h5py
    httpx
    pydantic
    numpy
    litestar
    fastapi
    numpy
    pandas
    polars
    pydantic
    requests
    pandas
    validators
  ];

@@ -80,11 +82,15 @@ buildPythonPackage rec {

  disabledTests = [
    # Need network
    "test_bearer_token"
    "test_auth_header_with_catchall_proxy"
    "test_bearer_token"
    "test_client_with_extra_options"
    "test_integration_config"
    "test_refresh_async"
    "test_refresh_of_refresh_async"
    "test_refresh_of_refresh"
    "test_token_refresh_timeout"
    "test_with_simple_auth_no_oidc_via_api_key"
    "test_client_with_extra_options"
  ];

  enabledTestPaths = [
Loading