Skip to content

Commit

Permalink
use the distconfig3 fork of distconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Ferland committed Nov 12, 2020
1 parent da4d101 commit 35b7c5f
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 36 deletions.
23 changes: 16 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.PHONY: help build clean update test lint
.PHONY: help dev clean update test lint

VENV_NAME?=venv
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate
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"
Expand All @@ -17,7 +17,7 @@ help:
@echo "make lint"
@echo " run black"

build:
dev:
make venv

venv: $(VENV_NAME)/bin/activate
Expand Down
10 changes: 5 additions & 5 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/consul_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ $ python app.py
If everything worked, you should see the following in the terminal:
```
Hello from consul!
```
```
2 changes: 1 addition & 1 deletion examples/flask_config_reload_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
],
)
13 changes: 11 additions & 2 deletions tests/test_vyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]},
Expand Down Expand Up @@ -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")
Expand Down
9 changes: 3 additions & 6 deletions vyper/vyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 35b7c5f

Please sign in to comment.