Skip to content

Commit f4b7311

Browse files
committed
chore: switch to devenv
1 parent e0fc357 commit f4b7311

File tree

9 files changed

+176
-72
lines changed

9 files changed

+176
-72
lines changed

.envrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
use nix
1+
export DIRENV_WARN_TIMEOUT=20s
2+
3+
eval "$(devenv direnvrc)"
4+
5+
# The use_devenv function supports passing flags to the devenv command
6+
# For example: use devenv --impure --option services.postgres.enable:bool true
7+
use devenv

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ virtualenv
3333
/.stfolder
3434
.direnv/
3535
examples/react-spa/docker-compose.override.yml
36+
37+
# Devenv
38+
.devenv*
39+
devenv.local.nix
40+
41+
# direnv
42+
.direnv
43+
44+
# pre-commit
45+
.pre-commit-config.yaml

CONTRIBUTING.rst

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Setting Up Your Development Environment
1919
There are two primary ways to set up your development environment:
2020

2121
Option 1: Standard Python Virtual Environment (Recommended for Beginners)
22-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2323

2424
1. **Install system dependencies**
2525

@@ -64,29 +64,24 @@ Option 1: Standard Python Virtual Environment (Recommended for Beginners)
6464
# Install development dependencies
6565
pip install -r requirements-dev.txt
6666
67-
Option 2: Using Nix (Recommended for Advanced Users)
68-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67+
Option 2: Using devenv/Nix (Recommended for Advanced Users)
68+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6969

70-
If you prefer a more isolated and reproducible development environment, you can use Nix:
70+
If you prefer a more isolated and reproducible development environment, you can use Nix-based `devenv <https://devenv.sh>`_:
7171

72-
1. **Install Nix** (If you don't have it already)
72+
1. **Install devenv** (If you don't have it already)
7373

74-
Follow the `official installation instructions <https://nixos.org/download.html>`_.
74+
Follow the `official installation instructions <https://devenv.sh/getting-started/>`_.
7575

76-
2. **Launch the Nix shell**
76+
2. **Activate the developer environment**
7777

7878
.. code-block:: bash
7979
8080
# This will create an isolated environment with all required dependencies
81-
nix-shell
81+
devenv shell
8282
8383
Note: The first time you run this command, it may take a significant amount of time as it builds all dependencies. Subsequent launches will be much faster.
8484

85-
For faster startup, you can use:
86-
87-
.. code-block:: bash
88-
89-
nix-shell --arg doCheck false
9085

9186
Running Tests
9287
-------------

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mo:
1414

1515
.PHONY: isort
1616
isort:
17-
isort --check-only --diff .
17+
isort --check-only --diff allauth/ tests/
1818

1919
.PHONY: bandit
2020
bandit:

devenv.lock

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"nodes": {
3+
"devenv": {
4+
"locked": {
5+
"dir": "src/modules",
6+
"lastModified": 1747543288,
7+
"owner": "cachix",
8+
"repo": "devenv",
9+
"rev": "3a8a52386bde1cf14fc2f4c4df80f91417348480",
10+
"type": "github"
11+
},
12+
"original": {
13+
"dir": "src/modules",
14+
"owner": "cachix",
15+
"repo": "devenv",
16+
"type": "github"
17+
}
18+
},
19+
"flake-compat": {
20+
"flake": false,
21+
"locked": {
22+
"lastModified": 1747046372,
23+
"owner": "edolstra",
24+
"repo": "flake-compat",
25+
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
26+
"type": "github"
27+
},
28+
"original": {
29+
"owner": "edolstra",
30+
"repo": "flake-compat",
31+
"type": "github"
32+
}
33+
},
34+
"git-hooks": {
35+
"inputs": {
36+
"flake-compat": "flake-compat",
37+
"gitignore": "gitignore",
38+
"nixpkgs": [
39+
"nixpkgs"
40+
]
41+
},
42+
"locked": {
43+
"lastModified": 1747372754,
44+
"owner": "cachix",
45+
"repo": "git-hooks.nix",
46+
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46",
47+
"type": "github"
48+
},
49+
"original": {
50+
"owner": "cachix",
51+
"repo": "git-hooks.nix",
52+
"type": "github"
53+
}
54+
},
55+
"gitignore": {
56+
"inputs": {
57+
"nixpkgs": [
58+
"git-hooks",
59+
"nixpkgs"
60+
]
61+
},
62+
"locked": {
63+
"lastModified": 1709087332,
64+
"owner": "hercules-ci",
65+
"repo": "gitignore.nix",
66+
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
67+
"type": "github"
68+
},
69+
"original": {
70+
"owner": "hercules-ci",
71+
"repo": "gitignore.nix",
72+
"type": "github"
73+
}
74+
},
75+
"nixpkgs": {
76+
"locked": {
77+
"lastModified": 1746807397,
78+
"owner": "cachix",
79+
"repo": "devenv-nixpkgs",
80+
"rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90",
81+
"type": "github"
82+
},
83+
"original": {
84+
"owner": "cachix",
85+
"ref": "rolling",
86+
"repo": "devenv-nixpkgs",
87+
"type": "github"
88+
}
89+
},
90+
"root": {
91+
"inputs": {
92+
"devenv": "devenv",
93+
"git-hooks": "git-hooks",
94+
"nixpkgs": "nixpkgs",
95+
"pre-commit-hooks": [
96+
"git-hooks"
97+
]
98+
}
99+
}
100+
},
101+
"root": "root",
102+
"version": 7
103+
}

devenv.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{ pkgs, lib, config, inputs, ... }:
2+
3+
{
4+
packages = [
5+
pkgs.git
6+
pkgs.swagger-cli
7+
pkgs.twine
8+
pkgs.woodpecker-cli
9+
pkgs.xmlsec
10+
11+
pkgs.python312Packages.pyls-flake8
12+
pkgs.python312Packages.pylsp-rope
13+
pkgs.python312Packages.python-lsp-server
14+
pkgs.python312Packages.xmlsec
15+
];
16+
17+
# https://devenv.sh/languages/
18+
languages.python = {
19+
enable = true;
20+
package = pkgs.python312;
21+
venv.enable = true;
22+
venv.requirements = ''
23+
-r ${./.}/requirements-dev.txt
24+
'';
25+
};
26+
27+
enterShell = ''
28+
source $VIRTUAL_ENV/bin/activate
29+
'';
30+
}

devenv.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
2+
inputs:
3+
nixpkgs:
4+
url: github:cachix/devenv-nixpkgs/rolling
5+
6+
# If you're using non-OSS software, you can set allowUnfree to true.
7+
# allowUnfree: true
8+
9+
# If you're willing to use a package that's vulnerable
10+
# permittedInsecurePackages:
11+
# - "openssl-1.1.1w"
12+
13+
# If you have more than one devenv you can merge them
14+
#imports:
15+
# - ./backend

requirements-dev.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Install the package itself with all extras
2-
-e ".[mfa,openid,steam,socialaccount]"
2+
-e ".[socialaccount,mfa,idp-oidc,openid,steam,saml]"
33

4-
# Core packages
5-
Django>=4.2.16
64
Sphinx
75
sphinx_rtd_theme
86

@@ -23,8 +21,7 @@ mypy==1.10.0
2321
# Type stubs
2422
django-stubs==5.0.2
2523
types-requests==2.32.0.20240602
26-
27-
# Additional dependencies
24+
git+https://github.com/oauthlib/oauthlib@dab6a5ae1830ddd8a79c1e9687f63508eae60b57
2825
Pillow>=9.0
2926
psycopg2-binary>=2.9.10,<3
3027
djangorestframework>=3.15.2,<4

shell.nix

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)