From 7521a19b90edd6dbfe6f5686223ff5012f579fe5 Mon Sep 17 00:00:00 2001 From: Casey Ransom Date: Tue, 25 Jun 2024 13:20:55 -0400 Subject: [PATCH] Unlock depends Testing it all still works with unlocked depends, adding a nix definition for reproducibility, adding python >3.8 compatibility. --- default.nix | 73 ++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 10 +++---- setup.py | 11 ++++--- src/zinc/models.py | 7 ++++- 4 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..9adc647 --- /dev/null +++ b/default.nix @@ -0,0 +1,73 @@ +{ lib +, python3 +, fetchPypi +, fetchFromGitHub +}: +let + atomicwrites = python3.pkgs.buildPythonPackage rec { + pname = "atomicwrites"; + version = "1.4.0"; + pyproject = true; + + src = fetchPypi { + inherit pname version; + hash = "sha256-rnA5atGkNPnHBG/S3RlvwEsS+ekf+4WRZBk76LYWino="; + }; + + nativeBuildInputs = [ + python3.pkgs.setuptools + python3.pkgs.wheel + ]; + + pythonImportsCheck = [ "atomicwrites" ]; + + meta = with lib; { + description = "Atomic file writes"; + homepage = "https://pypi.org/project/atomicwrites/"; + license = licenses.mit; + maintainers = with maintainers; [ ]; + mainProgram = "atomicwrites"; + }; + }; +in +python3.pkgs.buildPythonPackage rec { + pname = "zinc"; + version = "unstable-2024-04-09"; + pyproject = true; + + src = ./.; + ################################################################### + # src = fetchFromGitHub { # + # owner = "mindsnacks"; # + # repo = "Zinc"; # + # rev = "8efa92e4d9da30b5eb5c379abf64090f6833aec5"; # + # hash = "sha256-zjkv7SuulaQVWl2N1O/32An3nDMChR3JC+OYfYM58ZA="; # + # }; # + ################################################################### + + nativeBuildInputs = [ + python3.pkgs.setuptools + python3.pkgs.wheel + ]; + + propagatedBuildInputs = with python3.pkgs; [ + setuptools + atomicwrites + boto3 + jsonschema + lockfile + redis + requests + toml + ]; + + pythonImportsCheck = [ "zinc" ]; + + meta = with lib; { + description = "Asset distribution system for mobile clients"; + homepage = "https://github.com/mindsnacks/Zinc"; + license = licenses.mit; + maintainers = with maintainers; [ ]; + mainProgram = "zinc"; + }; +} diff --git a/requirements.txt b/requirements.txt index 659ed81..63a7e75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -lockfile==0.9.1 -boto3==1.26.160 +lockfile +boto3 toml requests -jsonschema==1.3.0 -atomicwrites==1.3.0 -redis==4.4.4 +jsonschema +atomicwrites +redis diff --git a/setup.py b/setup.py index b7e32df..d2be444 100644 --- a/setup.py +++ b/setup.py @@ -11,12 +11,11 @@ # List your project dependencies here. # For more details, see: # http://packages.python.org/distribute/setuptools.html#declaring-dependencies - "toml==0.10.0", - "lockfile==0.9.1", - "boto3==1.26.160", - "atomicwrites==1.3.0", - "redis==4.4.4", - "jsonschema==1.3.0", + "toml", + "lockfile", + "boto3", + "atomicwrites", + "jsonschema", ] diff --git a/src/zinc/models.py b/src/zinc/models.py index bc7b2ae..327d92a 100644 --- a/src/zinc/models.py +++ b/src/zinc/models.py @@ -13,12 +13,17 @@ import json -from collections import MutableMapping +import sys from functools import wraps from pkg_resources import resource_string import jsonschema from typing import Dict +if sys.version_info[:2] >= (3, 8): + from collections.abc import MutableMapping +else: + from collections import MutableMapping + from .defaults import defaults from .pathfilter import PathFilter