Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

export DIRENV_WARN_TIMEOUT=20s

eval "$(devenv direnvrc)"

# `use devenv` supports the same options as the `devenv shell` command.
#
# To silence all output, use `--quiet`.
#
# Example usage: use devenv --quiet --impure --option services.postgres.enable:bool true
use devenv
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Test

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Run tests
run: make test
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
/.cache
/.tox
/venv
/.venv
__pycache__/

# Devenv
.devenv*
devenv.local.nix
devenv.local.yaml

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ repos:
rev: 3.7.7
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.4.4
hooks:
- id: autopep8
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.4.0
hooks:
Expand Down
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
BIN := venv/bin
BIN := .venv/bin
PYTHON := $(BIN)/python

.PHONY: test
test: venv
test: .venv
$(BIN)/py.test -v tests/
$(BIN)/pre-commit run --all-files

venv: requirements.txt
python ./vendor/venv-update venv= venv -ppython3 install= -r requirements.txt -r requirements-dev.txt
.venv: pyproject.toml uv.lock
uv sync --group dev

.PHONY: install-hooks
install-hooks: venv
install-hooks: .venv
$(BIN)/pre-commit install -f --install-hooks

.PHONY: clean
clean:
rm -rf venv
rm -rf .venv

.PHONY: update-requirements
update-requirements: venv
$(BIN)/upgrade-requirements
sed -i 's/^ocflib==.*/ocflib/' requirements.txt
update-requirements:
uv lock --upgrade
2 changes: 1 addition & 1 deletion configs/vhost-mail.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ heartstrings heartstrings.studentorg.berkeley.edu
mcbusa mcbusa.studentorg.berkeley.edu

# in-person by sbwilliams
priorit priorit.studentorg.berkeley.edu
priorit priorit.studentorg.berkeley.edu

# rt#15345 by sbwilliams
emb surge.studentorg.berkeley.edu
Expand Down
123 changes: 123 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1777837414,
"owner": "cachix",
"repo": "devenv",
"rev": "9708ea1ebc52d6189cff09b837067daefb0bf0e7",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1776796298,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762808025,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
},
"locked": {
"lastModified": 1776852779,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "ec3063523dcd911aeadb50faa589f237cdab5853",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-src": {
"flake": false,
"locked": {
"lastModified": 1776329215,
"narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b86751bc4085f48661017fa226dee99fab6c651b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
}
}
},
"root": "root",
"version": 7
}
40 changes: 40 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ pkgs, lib, config, inputs, ... }:

{
cachix.enable = false;

packages = [
pkgs.git
pkgs.cracklib
];

# https://devenv.sh/languages/
# languages.rust.enable = true;
languages.python = {
enable = true;
package = pkgs.python312;
uv.enable = true;
};

enterShell = ''
echo successfully entered ocf/etc devenv
python --version
'';

# https://devenv.sh/tasks/
# tasks = {
# "myproj:setup".exec = "mytool build";
# "devenv:enterShell".after = [ "myproj:setup" ];
# };

# https://devenv.sh/tests/
enterTest = ''
echo "Running tests"
git --version | grep --color=auto "${pkgs.git.version}"
'';

# https://devenv.sh/git-hooks/
# git-hooks.hooks.shellcheck.enable = true;

# See full reference at https://devenv.sh/reference/options/
}
15 changes: 15 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling

# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true

# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"

# If you have more than one devenv you can merge them
#imports:
# - ./backend
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "ocf-etc"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = []

[dependency-groups]
dev = [
"jinja2>=3",
"jsonschema",
"ocflib",
"pre-commit>=3",
"pyfakefs>=5",
"pytest",
"pyyaml",
"requests>=2.28",
"setuptools>=65",
"urllib3>=2",
"virtualenv>=20.14",
]
6 changes: 0 additions & 6 deletions requirements-dev-minimal.txt

This file was deleted.

55 changes: 0 additions & 55 deletions requirements-dev.txt

This file was deleted.

Empty file removed requirements-minimal.txt
Empty file.
Empty file removed requirements.txt
Empty file.
Loading
Loading