init
This commit is contained in:
commit
a82649c2d3
56
flake.nix
Normal file
56
flake.nix
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
description = "A basic flake using pyproject.toml project metadata";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
pyproject-nix = {
|
||||||
|
url = "github:nix-community/pyproject.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs, pyproject-nix, ... }:
|
||||||
|
let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
|
project = pyproject-nix.lib.project.loadPyproject {
|
||||||
|
# Read & unmarshal pyproject.toml relative to this project root.
|
||||||
|
# projectRoot is also used to set `src` for renderers such as buildPythonPackage.
|
||||||
|
projectRoot = ./.;
|
||||||
|
};
|
||||||
|
|
||||||
|
# This example is only using x86_64-linux
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
|
||||||
|
python = pkgs.python3;
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.x86_64-linux.default =
|
||||||
|
let
|
||||||
|
# Returns a function that can be passed to `python.withPackages`
|
||||||
|
arg = project.renderers.withPackages { inherit python; };
|
||||||
|
|
||||||
|
# Returns a wrapped environment (virtualenv like) with all our packages
|
||||||
|
pythonEnv = python.withPackages arg;
|
||||||
|
|
||||||
|
in
|
||||||
|
# Create a devShell like normal.
|
||||||
|
pkgs.mkShell { packages = [ pythonEnv ]; };
|
||||||
|
|
||||||
|
# Build our package using `buildPythonPackage
|
||||||
|
packages.x86_64-linux.default =
|
||||||
|
let
|
||||||
|
# Returns an attribute set that can be passed to `buildPythonPackage`.
|
||||||
|
attrs = project.renderers.buildPythonPackage { inherit python; };
|
||||||
|
in
|
||||||
|
# Pass attributes to buildPythonPackage.
|
||||||
|
# Here is a good spot to add on any missing or custom attributes.
|
||||||
|
python.pkgs.buildPythonPackage (
|
||||||
|
attrs
|
||||||
|
// {
|
||||||
|
env.CUSTOM_ENVVAR = "hello";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
20
pyproject.toml
Normal file
20
pyproject.toml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools", "setuptools-scm"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "stock-script"
|
||||||
|
authors = [
|
||||||
|
{name = "Example Author", email = "author@example.com"}
|
||||||
|
]
|
||||||
|
description = "package description"
|
||||||
|
version = "0.0.1"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.7"
|
||||||
|
dependencies = [
|
||||||
|
"requests > 2.26.0",
|
||||||
|
"pandas"
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
stock = "stock:main"
|
||||||
Loading…
x
Reference in New Issue
Block a user