This commit is contained in:
2025-10-28 11:08:30 +01:00
commit d4ae65bb30
6 changed files with 176 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
result
.direnv/*

31
README.md Normal file
View File

@@ -0,0 +1,31 @@
# Test the build of packages
```sh
nix build .#entsoe-apy.src
nix build .#entsoe-apy
```
# Enter a development shell
```sh
nix develop
pip show entsoe-apy
Name: entsoe-apy
Version: 0.4.0
Summary: A Python library for accessing ENTSO-E Transparency Platform API endpoints
```
# Inspect flake
```sh
nix flake show
warning: Git tree '/home/jonathan/git/NIX/packaging' is dirty
git+file:///home/jonathan/git/NIX/packaging
├───devShells
│ └───x86_64-linux
│ └───default: development environment 'Python-ENTSOE-Dev'
└───packages
└───x86_64-linux
├───entsoe-apy: package 'python3.13-entsoe-apy-0.4.0'
└───xsdata-pydantic: package 'python3.13-xsdata-pydantic-24.5'
```

45
entsoe-apy.nix Normal file
View File

@@ -0,0 +1,45 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
pytestCheckHook,
httpx,
loguru,
xsdata-pydantic,
}:
buildPythonPackage rec {
pname = "entsoe-apy";
version = "0.4.0";
src = fetchFromGitHub {
owner = "berrij";
repo = "entsoe-apy";
rev = "cb4ebd4ed401268e605b5267347e0e934d048883";
hash = "sha256-M0W0r7ApJKG0wMczC0kp/jNOa+PcgVGadvEOSQ2hRkU=";
};
pyproject = true;
build-system = [ setuptools ];
dependencies = [
httpx
loguru
xsdata-pydantic
];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [
"entsoe"
];
meta = {
description = "Python Package to Query the ENTSO-E API";
homepage = "https://github.com/berrij/entsoe-apy";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ berrij ];
platforms = lib.platforms.all;
};
}

27
flake.lock generated Normal file
View File

@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1759632233,
"narHash": "sha256-krgZxGAIIIKFJS+UB0l8do3sYUDWJc75M72tepmVMzE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View File

@@ -0,0 +1,31 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux"; # Adjust if necessary
pkgs = import nixpkgs {
inherit system;
};
in
{
packages.${system} = {
xsdata-pydantic = pkgs.python313Packages.callPackage ./xsdata-pydantic.nix { };
entsoe-apy = pkgs.python313Packages.callPackage ./entsoe-apy.nix {
xsdata-pydantic = self.packages.${system}.xsdata-pydantic;
};
};
devShells.${system} = {
default = pkgs.mkShell {
name = "packaging";
venvDir = "./.venv";
buildInputs = [ pkgs.python313Packages.pip ] ++ builtins.attrValues self.packages.${system};
};
};
};
}

40
xsdata-pydantic.nix Normal file
View File

@@ -0,0 +1,40 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
xsdata,
pydantic,
}:
buildPythonPackage rec {
pname = "xsdata-pydantic";
version = "24.5";
pyproject = true;
src = fetchFromGitHub {
owner = "tefra";
repo = "xsdata-pydantic";
tag = "v${version}";
hash = "sha256-ExgAXQRNfGQRSZdMuWc8ldJPqz+3c4Imgu75KXLXHNk=";
};
build-system = [ setuptools ];
dependencies = [
xsdata
pydantic
];
pythonImportsCheck = [
"xsdata_pydantic"
];
meta = {
description = "Naive XML & JSON Bindings for python pydantic classes!";
homepage = "https://github.com/tefra/xsdata-pydantic";
maintainers = with lib.maintainers; [ berrij ];
license = lib.licenses.mit;
platforms = lib.platforms.all;
};
}