project structure and license+setup.py

This commit is contained in:
Valentin Boettcher 2021-12-07 13:28:32 +01:00
parent 2edce57fe0
commit 533e3a8731
10 changed files with 120 additions and 38 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Valentin Boettcher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,31 +1,85 @@
{
description = "Calculating open system bath energy changes with HOPS and analytically. ";
description = "Calculating open system bath energy changes with HOPS and analytically.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
mach-nix.url = "github:DavHau/mach-nix";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
python = "python39";
pkgs = nixpkgs.legacyPackages.${system};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
let
python = "python39";
pypiDataRev = "master";
pypiDataSha256 = "041rpjrwwa43hap167jy8blnxvpvbfil0ail4y4mar1q5f0q57xx";
devShell = pkgs:
pkgs.mkShell {
buildInputs = [
(pkgs.${python}.withPackages
(ps: with ps; [ black mypy ]))
pkgs.nodePackages.pyright
];
};
mach-nix-wrapper = import mach-nix { inherit pkgs python; };
requirements = builtins.readFile ./requirements.txt;
pythonBuild = mach-nix-wrapper.mkPython { inherit requirements; };
in {
devShell = pkgs.mkShell {
buildInputs = [
# dev packages
(pkgs.${python}.withPackages
(ps: with ps; [ black mypy sphinx-autodoc-typehints sphinx pydata-sphinx-theme ])) # <--- change here
pkgs.nodePackages.pyright
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mach-nix-wrapper = import mach-nix { inherit pkgs python pypiDataRev pypiDataSha256; };
# app packages
pythonBuild
];
};
});
fcSpline = (mach-nix-wrapper.buildPythonPackage
{src = builtins.fetchTarball {
url = "https://github.com/cimatosa/fcSpline/archive/4312b2c63d52711bff1bfe282d92f98a3e5073fb.tar.gz";
sha256 = "0l38q5avcbiyqlmmhznw9sg02y54fia6r7x2f9w6h3kqf2xh05yc";
};
pname="fcSpline";
version="0.1";
requirements=''
numpy
cython
setuptools
scipy
'';
});
stocproc = (mach-nix-wrapper.buildPythonPackage
{src = builtins.fetchTarball {
url = "https://github.com/vale981/stocproc/archive/c81eead1b86d8da0caa5ec013b5fb65e9d3c3b79.tar.gz";
sha256 = "00fvfmdcpkm9lp2zn8kzzn6msq7cypqhf87ihrf63ci5z4hg2jpl";
};
pname="stocproc";
version = "1.0.1";
requirements = ''
numpy
cython
setuptools
mpmath
scipy
'';
});
requirements = builtins.readFile ./requirements.txt;
pythonShell = mach-nix-wrapper.mkPythonShell {
requirements = requirements + ''
sphinx
pydata-sphinx-theme
sphinx-autodoc-typehints
data-science-types
'';
packagesExtra = [fcSpline stocproc];
_.stocproc.buildInputs.add = [fcSpline];
};
pythonPackage = mach-nix-wrapper.buildPythonPackage ./setup.py;
mergeEnvs = envs:
pkgs.mkShell (builtins.foldl' (a: v: {
buildInputs = a.buildInputs ++ v.buildInputs;
nativeBuildInputs = a.nativeBuildInputs ++ v.nativeBuildInputs;
}) (pkgs.mkShell { }) envs);
in {
devShell = mergeEnvs [ (devShell pkgs) pythonShell ];
defaultPackage = pythonPackage;
});
}

11
hopsflow/setup.py Normal file
View file

@ -0,0 +1,11 @@
from distutils.core import setup
setup(
name="Distutils",
version="1.0",
description="Python Distribution Utilities",
author="Greg Ward",
author_email="gward@python.net",
url="https://www.python.org/sigs/distutils-sig/",
packages=["distutils", "distutils.command"],
)

View file

@ -1,6 +1,5 @@
numpy >= 1.20
data-science-types
scipy >= 1.6
h5py
sqlitedict
tqdm
lmfit

View file

@ -1,15 +0,0 @@
[flake8]
ignore = E501
max-line-length = 120
[mypy]
exclude = docs
[mypy-stocproc.*]
ignore_missing_imports = True
[mypy-scipy.*]
ignore_missing_imports = True
[mypy-lmfit.*]
ignore_missing_imports = True

12
setup.py Normal file
View file

@ -0,0 +1,12 @@
from distutils.core import setup
setup(
name="hopsflow",
version="1.0",
description="Calculating open system bath energy changes with HOPS and analytically.",
author="Valentin Boettcher",
author_email="hiro@protagon.space",
url="https://github.com/vale981/hopsflow",
packages=["hopsflow"],
install_requires=["numpy >= 1.20", "scipy >= 1.6", "h5py", "tqdm", "lmfit"],
)