Skip to content

Commit ae163a3

Browse files
committed
feat: add nix
1 parent 8529bcc commit ae163a3

7 files changed

Lines changed: 306 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
56+
python-version: ["3.11", "3.12", "3.13"]
5757
steps:
5858
- uses: actions/checkout@v4
5959

@@ -68,3 +68,37 @@ jobs:
6868

6969
- name: Run tests with coverage
7070
run: pytest --cov --cov-report=term-missing
71+
72+
nix-check:
73+
name: Nix Check
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v4
77+
78+
- name: Install Nix
79+
uses: DeterminateSystems/nix-installer-action@main
80+
81+
- name: Setup Nix cache
82+
uses: DeterminateSystems/magic-nix-cache-action@main
83+
84+
- name: Check flake
85+
run: nix flake check
86+
87+
nix-build:
88+
name: Nix Build (Python ${{ matrix.python-version }})
89+
runs-on: ubuntu-latest
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
python-version: ["311", "312", "313"]
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- name: Install Nix
98+
uses: DeterminateSystems/nix-installer-action@main
99+
100+
- name: Setup Nix cache
101+
uses: DeterminateSystems/magic-nix-cache-action@main
102+
103+
- name: Build package
104+
run: nix build .#finwise-python${{ matrix.python-version }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,7 @@ dmypy.json
7878
.DS_Store
7979
Thumbs.db
8080
site/
81+
82+
# Nix
83+
result
84+
.direnv/

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ Thanks for your interest in contributing to finwise-python!
44

55
## Development Setup
66

7+
### Option 1: Using Nix (Recommended)
8+
9+
If you have [Nix](https://nixos.org/) installed with flakes enabled:
10+
11+
```bash
12+
git clone https://github.com/rameezk/finwise-python.git
13+
cd finwise-python
14+
15+
# Enter development shell
16+
nix develop
17+
18+
# Install package in editable mode
19+
pip install -e .
20+
```
21+
22+
Available dev shells:
23+
- `nix develop` - Default (Python 3.11)
24+
- `nix develop .#python312` - Python 3.12
25+
- `nix develop .#python313` - Python 3.13
26+
- `nix develop .#docs` - Documentation environment
27+
28+
### Option 2: Using virtualenv
29+
730
1. Clone the repository:
831
```bash
932
git clone https://github.com/rameezk/finwise-python.git

docs/getting-started/installation.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Installation
22

3+
## Requirements
4+
5+
- Python 3.11 or higher
6+
37
## From PyPI
48

59
Install the SDK using pip:
@@ -8,6 +12,20 @@ Install the SDK using pip:
812
pip install finwise-python
913
```
1014

15+
## Using Nix
16+
17+
If you have [Nix](https://nixos.org/) installed with flakes enabled, you can use this package directly:
18+
19+
```bash
20+
# Build the package
21+
nix build github:rameezk/finwise-python
22+
23+
# Or use in your flake.nix
24+
{
25+
inputs.finwise-python.url = "github:rameezk/finwise-python";
26+
}
27+
```
28+
1129
## For Development
1230

1331
If you want to contribute or modify the SDK:
@@ -16,10 +34,26 @@ If you want to contribute or modify the SDK:
1634
pip install finwise-python[dev]
1735
```
1836

37+
Or with Nix:
38+
39+
```bash
40+
git clone https://github.com/rameezk/finwise-python.git
41+
cd finwise-python
42+
nix develop
43+
pip install -e .
44+
```
45+
1946
## For Documentation
2047

2148
To build the documentation locally:
2249

2350
```bash
2451
pip install finwise-python[docs]
2552
```
53+
54+
Or with Nix:
55+
56+
```bash
57+
nix develop .#docs
58+
mkdocs serve
59+
```

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
description = "Unofficial Python SDK for the FinWise API";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
14+
pythonVersions = {
15+
python311 = pkgs.python311;
16+
python312 = pkgs.python312;
17+
python313 = pkgs.python313;
18+
};
19+
20+
defaultPython = pythonVersions.python311;
21+
22+
mkFinwise = python: python.pkgs.buildPythonPackage rec {
23+
pname = "finwise-python";
24+
version = "1.2.0";
25+
pyproject = true;
26+
27+
src = pkgs.lib.cleanSourceWith {
28+
filter = name: type:
29+
let baseName = baseNameOf (toString name);
30+
in !(
31+
baseName == ".git" ||
32+
baseName == ".github" ||
33+
baseName == ".venv" ||
34+
baseName == ".mypy_cache" ||
35+
baseName == ".pytest_cache" ||
36+
baseName == ".ruff_cache" ||
37+
baseName == "site" ||
38+
baseName == "__pycache__" ||
39+
baseName == "result" ||
40+
baseName == ".direnv" ||
41+
pkgs.lib.hasSuffix ".egg-info" baseName
42+
);
43+
src = ./.;
44+
};
45+
46+
build-system = with python.pkgs; [
47+
hatchling
48+
];
49+
50+
dependencies = with python.pkgs; [
51+
httpx
52+
pydantic
53+
];
54+
55+
nativeCheckInputs = with python.pkgs; [
56+
pytestCheckHook
57+
pytest-cov
58+
respx
59+
];
60+
61+
pythonImportsCheck = [ "finwise" ];
62+
63+
meta = with pkgs.lib; {
64+
description = "Unofficial Python SDK for the FinWise API";
65+
homepage = "https://github.com/rameezk/finwise-python";
66+
license = licenses.mit;
67+
maintainers = [ ];
68+
platforms = platforms.unix;
69+
};
70+
};
71+
72+
mkDevShell = python: pkgs.mkShell {
73+
packages = [
74+
(python.withPackages (ps: with ps; [
75+
httpx
76+
pydantic
77+
pytest
78+
pytest-cov
79+
respx
80+
mypy
81+
ruff
82+
hatchling
83+
pip
84+
build
85+
]))
86+
];
87+
88+
shellHook = ''
89+
echo "FinWise Python SDK development environment"
90+
echo "Python version: $(python --version)"
91+
'';
92+
};
93+
94+
docsShell = pkgs.mkShell {
95+
packages = [
96+
(defaultPython.withPackages (ps: with ps; [
97+
mkdocs
98+
mkdocs-material
99+
]))
100+
];
101+
102+
shellHook = ''
103+
echo "FinWise Python SDK documentation environment"
104+
echo "Run 'mkdocs serve' to preview docs locally"
105+
'';
106+
};
107+
108+
in {
109+
packages = {
110+
default = mkFinwise defaultPython;
111+
finwise-python311 = mkFinwise pythonVersions.python311;
112+
finwise-python312 = mkFinwise pythonVersions.python312;
113+
finwise-python313 = mkFinwise pythonVersions.python313;
114+
};
115+
116+
devShells = {
117+
default = mkDevShell defaultPython;
118+
python311 = mkDevShell pythonVersions.python311;
119+
python312 = mkDevShell pythonVersions.python312;
120+
python313 = mkDevShell pythonVersions.python313;
121+
docs = docsShell;
122+
};
123+
124+
apps = {
125+
docs-serve = {
126+
type = "app";
127+
program = toString (pkgs.writeShellScript "docs-serve" ''
128+
cd ${./.}
129+
${defaultPython.withPackages (ps: with ps; [ mkdocs mkdocs-material ])}/bin/mkdocs serve
130+
'');
131+
};
132+
docs-build = {
133+
type = "app";
134+
program = toString (pkgs.writeShellScript "docs-build" ''
135+
cd ${./.}
136+
${defaultPython.withPackages (ps: with ps; [ mkdocs mkdocs-material ])}/bin/mkdocs build
137+
'');
138+
};
139+
};
140+
141+
checks = {
142+
default = mkFinwise defaultPython;
143+
};
144+
}
145+
);
146+
}

pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "finwise-python"
77
version = "1.3.0"
88
description = "Unofficial Python SDK for the FinWise API"
99
readme = "README.md"
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.11"
1111
license = "MIT"
1212
authors = [{ name = "Rameez Khan" }]
1313
keywords = ["finwise", "api", "sdk", "finance", "banking", "budgeting"]
@@ -17,8 +17,6 @@ classifiers = [
1717
"License :: OSI Approved :: MIT License",
1818
"Operating System :: OS Independent",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.9",
21-
"Programming Language :: Python :: 3.10",
2220
"Programming Language :: Python :: 3.11",
2321
"Programming Language :: Python :: 3.12",
2422
"Programming Language :: Python :: 3.13",
@@ -55,7 +53,7 @@ packages = ["src/finwise"]
5553

5654
[tool.ruff]
5755
line-length = 88
58-
target-version = "py39"
56+
target-version = "py311"
5957
src = ["src", "tests"]
6058

6159
[tool.ruff.lint]
@@ -66,7 +64,7 @@ ignore = ["E501", "UP045"]
6664
known-first-party = ["finwise"]
6765

6866
[tool.mypy]
69-
python_version = "3.9"
67+
python_version = "3.11"
7068
strict = true
7169
warn_return_any = true
7270
warn_unused_configs = true

0 commit comments

Comments
 (0)