From 35b7c5f79ea8b254267a90e7a67b55d8ed6396dd Mon Sep 17 00:00:00 2001 From: Alexandre Ferland Date: Thu, 12 Nov 2020 11:43:39 -0500 Subject: [PATCH] use the distconfig3 fork of distconfig --- .pre-commit-config.yaml | 23 +++++++++++++++------- Makefile | 6 +++--- dev_requirements.txt | 10 +++++----- examples/consul_app/README.md | 2 +- examples/flask_config_reload_app/README.md | 2 +- requirements.txt | 7 +++---- setup.py | 13 ++++++------ tests/test_vyper.py | 13 ++++++++++-- vyper/vyper.py | 9 +++------ 9 files changed, 49 insertions(+), 36 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5e5ca78..f5cbccd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,19 @@ repos: -- repo: local +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-json + - id: check-toml + - id: check-yaml + - id: mixed-line-ending + args: ['--fix=lf'] + description: Forces to replace line ending by the UNIX 'lf' character. + - id: pretty-format-json + args: ['--autofix', '--no-sort-keys', '--no-ensure-ascii'] +- repo: https://github.com/psf/black + rev: 20.8b1 hooks: - id: black - name: black - stages: [commit] - language: system - entry: venv/bin/black -t py37 --exclude venv . - types: [python] - + language_version: python3 diff --git a/Makefile b/Makefile index 7b84315..9b919a3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help build clean update test lint +.PHONY: help dev clean update test lint VENV_NAME?=venv VENV_ACTIVATE=. $(VENV_NAME)/bin/activate @@ -6,7 +6,7 @@ PYTHON=${VENV_NAME}/bin/python3 .DEFAULT: help help: - @echo "make build" + @echo "make dev" @echo " prepare development environment, use only once" @echo "make clean" @echo " delete development environment" @@ -17,7 +17,7 @@ help: @echo "make lint" @echo " run black" -build: +dev: make venv venv: $(VENV_NAME)/bin/activate diff --git a/dev_requirements.txt b/dev_requirements.txt index 4d3a959..59cafd7 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,8 +1,8 @@ -black==19.10b0 -Flask==1.1.1 -kazoo==2.6.1 -pre-commit==2.3.0 -pytest==5.4.1 +black==20.8b1 +Flask==1.1.2 +kazoo==2.8.0 +pre-commit==2.8.2 +pytest==6.1.2 python-consul==1.1.0 python-etcd==0.4.5 diff --git a/examples/consul_app/README.md b/examples/consul_app/README.md index b475636..767e6c9 100644 --- a/examples/consul_app/README.md +++ b/examples/consul_app/README.md @@ -23,4 +23,4 @@ $ python app.py If everything worked, you should see the following in the terminal: ``` Hello from consul! -``` \ No newline at end of file +``` diff --git a/examples/flask_config_reload_app/README.md b/examples/flask_config_reload_app/README.md index 7cdefc7..cf30d1b 100644 --- a/examples/flask_config_reload_app/README.md +++ b/examples/flask_config_reload_app/README.md @@ -20,7 +20,7 @@ If everything worked, you should see the following in the terminal: Hello from flask! ``` To test that the config file is being watched and reloaded, -just change the `hello` key value to `world!` in config.json and if you +just change the `hello` key value to `world!` in config.json and if you `$ curl http://localhost:5000` you should now see the following in the terminal: ``` Hello world! diff --git a/requirements.txt b/requirements.txt index d818031..19dd6f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ -distconfig==0.1.0 -pathlib==1.0.1 +distconfig3==1.0.1 PyYAML==5.3.1 -toml==0.10.0 -watchdog==0.10.2 +toml==0.10.2 +watchdog==0.10.3 diff --git a/setup.py b/setup.py index 9537e51..fa0b485 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="vyper-config", - version="0.6.2", + version="1.0.0", description="Python configuration with (more) fangs", url="http://github.com/admiralobvious/vyper", author="Alexandre Ferland", @@ -11,22 +11,21 @@ packages=["vyper"], zip_safe=False, install_requires=[ - "distconfig>=0.1.0", - 'pathlib>=1.0.1;python_version<"3.4"', + "distconfig3>=1.0.1", "toml>=0.10.0", - "PyYAML>=5.1", - "watchdog>=0.9.0", + "PyYAML>=5.3.1", + "watchdog>=0.10.0", ], setup_requires=["pytest-runner>=5.2"], - tests_require=["pytest>=5.4.1"], + tests_require=["pytest>=6.1.2"], platforms="any", classifiers=[ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Software Development :: Libraries :: Python Modules", ], ) diff --git a/tests/test_vyper.py b/tests/test_vyper.py index e92baf2..54172c8 100644 --- a/tests/test_vyper.py +++ b/tests/test_vyper.py @@ -76,7 +76,10 @@ {"Type": "Devil's Food"}, ], }, - "Prices": ["0.42", "0.82",], + "Prices": [ + "0.42", + "0.82", + ], "Icings": { "Regular": {"Types": ["plain", "glazed"]}, "Premium": {"Types": ["passionfruit", "chocolate"]}, @@ -383,7 +386,13 @@ def test_case_insensitive(self): }, self.v.get("batters"), ) - self.assertEqual(["0.42", "0.82",], self.v.get("prices")) + self.assertEqual( + [ + "0.42", + "0.82", + ], + self.v.get("prices"), + ) def test_aliases_of_aliases(self): self.v.register_alias("Foo", "Bar") diff --git a/vyper/vyper.py b/vyper/vyper.py index 3059004..3ce73ab 100644 --- a/vyper/vyper.py +++ b/vyper/vyper.py @@ -218,8 +218,7 @@ def get_bytes(self, key): return b"{0}".format(self.get(key)) def sub(self, key): - """Returns new Vyper instance representing a sub tree of this instance. - """ + """Returns new Vyper instance representing a sub tree of this instance.""" subv = Vyper() data = self.get(key) if isinstance(data, dict): @@ -436,8 +435,7 @@ def _find(self, key): return None def is_set(self, key): - """Check to see if the key has been set in any of the data locations. - """ + """Check to see if the key has been set in any of the data locations.""" path = key.split(self._key_delimiter) lower_case_key = key.lower() @@ -509,8 +507,7 @@ def _real_key(self, key): return key def in_config(self, key): - """Check to see if the given key (or an alias) is in the config file. - """ + """Check to see if the given key (or an alias) is in the config file.""" # if the requested key is an alias, then return the proper key key = self._real_key(key)