diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-26 17:07:28 -0600 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2020-01-26 17:07:28 -0600 |
| commit | 0bd9c725727b1e4a6d551b23dd67ab5615c7b52e (patch) | |
| tree | 78efebe231dce10b9ebbc47995b38972c3e9de84 | |
| parent | Test base parse function (diff) | |
| parent | Bump version: 0.5.0 → 0.6.0 (diff) | |
| download | config-file-0bd9c725727b1e4a6d551b23dd67ab5615c7b52e.zip | |
Merge branch 'master' of github.com:eugenetriguba/config_file
| -rw-r--r-- | .bumpversion.cfg | 2 | ||||
| -rw-r--r-- | .travis.yml | 20 | ||||
| -rw-r--r-- | CHANGELOG.md | 14 | ||||
| -rw-r--r-- | CODE_OF_CONDUCT.md | 76 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | config_file/__init__.py | 2 | ||||
| -rw-r--r-- | config_file/config_file.py | 6 | ||||
| -rw-r--r-- | poetry.lock | 69 | ||||
| -rw-r--r-- | pyproject.toml | 6 | ||||
| -rw-r--r-- | tox.ini | 9 |
10 files changed, 181 insertions, 25 deletions
diff --git a/.bumpversion.cfg b/.bumpversion.cfg index cb0cd7f..d359899 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.5.0 +current_version = 0.6.0 commit = True tag = True diff --git a/.travis.yml b/.travis.yml index 21aebf9..507c5e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ language: python +os: linux -stages: - - test +python: + - "3.6" + - "3.7" + - "3.8" -matrix: - include: - - stage: test - python: 3.8 - install: pip install --upgrade pip tox poetry codecov - script: tox - env: - TOXENV: py38
\ No newline at end of file +install: + - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python + - source $HOME/.poetry/env + - pip install --upgrade pip tox-travis codecov +script: tox
\ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f3bbd..0005a05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.6.0 - 2020-01-24 + +Changed + + - Bumped down python version requirement to 3.6 and now test 3.6, 3.7, and 3.8 on CI. + ## 0.5.0 - 2020-01-19 - - Add support for retrieving entire sections as a `dict` with `get()`. +Added + + - Support for retrieving entire sections as a `dict` with `get()`. ## 0.4.0 - 2020-01-19 - - Add `reset()` and `save()` methods to `ConfigFile`. This allows you to reset your +Added + + - `reset()` and `save()` methods to `ConfigFile`. This allows you to reset your configuration file to an "original state," given the original config file path. However, say you have a `config/config.json` file. Then it will automatically try to look for `config/config.original.json` if no file path is specified. The `save()` diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..82358df --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at eugenetriguba@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq @@ -2,7 +2,7 @@ > Manage and manipulate your configuration files -[](https://www.python.org/downloads/release/python-380/) + [](https://pypi.org/project/config-file/) [](https://pypi.org/project/black/) [](https://travis-ci.com/eugenetriguba/config_file) diff --git a/config_file/__init__.py b/config_file/__init__.py index 22164c1..5917edd 100644 --- a/config_file/__init__.py +++ b/config_file/__init__.py @@ -1,7 +1,7 @@ from config_file.config_file import ConfigFile from config_file.parsers.base_parser import BaseParser, ParsingError -__version__ = "0.5.0" +__version__ = "0.6.0" __all__ = [ "ConfigFile", diff --git a/config_file/config_file.py b/config_file/config_file.py index b090ace..5827d08 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -118,7 +118,11 @@ class ConfigFile: if not Path(original_file_path).exists(): raise OSError(f"The {original_file_path} file to reset to does not exist.") - Path(self.path).expanduser().unlink(missing_ok=True) + try: + Path(self.path).expanduser().unlink() + except OSError: + pass + copyfile(original_file_path, self.path) self.contents = self.__read_config_file() diff --git a/poetry.lock b/poetry.lock index 17c2ec5..af4cd16 100644 --- a/poetry.lock +++ b/poetry.lock @@ -176,6 +176,31 @@ license = ["editdistance"] [[package]] category = "dev" +description = "Read metadata from Python packages" +marker = "python_version < \"3.8\"" +name = "importlib-metadata" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +version = "1.4.0" + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +docs = ["sphinx", "rst.linker"] +testing = ["packaging", "importlib-resources"] + +[[package]] +category = "dev" +description = "Read resources from Python packages" +marker = "python_version < \"3.7\"" +name = "importlib-resources" +optional = false +python-versions = ">=2.7,!=3.0,!=3.1,!=3.2,!=3.3" +version = "1.0.2" + +[[package]] +category = "dev" description = "A Python utility / library to sort Python imports." name = "isort" optional = false @@ -220,6 +245,11 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "0.13.1" +[package.dependencies] +[package.dependencies.importlib-metadata] +python = "<3.8" +version = ">=0.12" + [package.extras] dev = ["pre-commit", "tox"] @@ -241,6 +271,14 @@ six = "*" toml = "*" virtualenv = ">=15.2" +[package.dependencies.importlib-metadata] +python = "<3.8" +version = "*" + +[package.dependencies.importlib-resources] +python = "<3.7" +version = "*" + [[package]] category = "dev" description = "library with cross-python path, ini-parsing, io, code, log facilities" @@ -386,9 +424,24 @@ version = "16.7.9" docs = ["sphinx (>=1.8.0,<2)", "towncrier (>=18.5.0)", "sphinx-rtd-theme (>=0.4.2,<1)"] testing = ["pytest (>=4.0.0,<5)", "coverage (>=4.5.0,<5)", "pytest-timeout (>=1.3.0,<2)", "six (>=1.10.0,<2)", "pytest-xdist", "pytest-localserver", "pypiserver", "mock", "xonsh"] +[[package]] +category = "dev" +description = "Backport of pathlib-compatible object wrapper for zip files" +marker = "python_version < \"3.8\"" +name = "zipp" +optional = false +python-versions = ">=3.6" +version = "2.0.1" + +[package.dependencies] +more-itertools = "*" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] + [metadata] -content-hash = "ddf19a9d0619bc0bf76ebb1425acbcab5058f59f1f29f36e1f24748006db6ed3" -python-versions = "^3.8" +content-hash = "b85256d1b940200e79b69f7af58bd0c8137a2942f8ff6772b5ac60dcf7555441" +python-versions = "^3.6" [metadata.files] appdirs = [ @@ -486,6 +539,14 @@ identify = [ {file = "identify-1.4.11-py2.py3-none-any.whl", hash = "sha256:1222b648251bdcb8deb240b294f450fbf704c7984e08baa92507e4ea10b436d5"}, {file = "identify-1.4.11.tar.gz", hash = "sha256:d824ebe21f38325c771c41b08a95a761db1982f1fc0eee37c6c97df3f1636b96"}, ] +importlib-metadata = [ + {file = "importlib_metadata-1.4.0-py2.py3-none-any.whl", hash = "sha256:bdd9b7c397c273bcc9a11d6629a38487cd07154fa255a467bf704cd2c258e359"}, + {file = "importlib_metadata-1.4.0.tar.gz", hash = "sha256:f17c015735e1a88296994c0697ecea7e11db24290941983b08c9feb30921e6d8"}, +] +importlib-resources = [ + {file = "importlib_resources-1.0.2-py2.py3-none-any.whl", hash = "sha256:6e2783b2538bd5a14678284a3962b0660c715e5a0f10243fd5e00a4b5974f50b"}, + {file = "importlib_resources-1.0.2.tar.gz", hash = "sha256:d3279fd0f6f847cced9f7acc19bd3e5df54d34f93a2e7bb5f238f81545787078"}, +] isort = [ {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, @@ -572,3 +633,7 @@ virtualenv = [ {file = "virtualenv-16.7.9-py2.py3-none-any.whl", hash = "sha256:55059a7a676e4e19498f1aad09b8313a38fcc0cdbe4fdddc0e9b06946d21b4bb"}, {file = "virtualenv-16.7.9.tar.gz", hash = "sha256:0d62c70883c0342d59c11d0ddac0d954d0431321a41ab20851facf2b222598f3"}, ] +zipp = [ + {file = "zipp-2.0.1-py3-none-any.whl", hash = "sha256:e013e7800f60ec4dde789ebf4e9f7a54236e4bbf5df2a1a4e20ce9e1d9609d67"}, + {file = "zipp-2.0.1.tar.gz", hash = "sha256:b338014b9bc7102ca69e0fb96ed07215a8954d2989bc5d83658494ab2ba634af"}, +] diff --git a/pyproject.toml b/pyproject.toml index 2f38381..21d60b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "config_file" -version = "0.5.0" +version = "0.6.0" description = "Manage your configuration files." authors = ["Eugene Triguba <eugenetriguba@gmail.com>"] readme = "README.md" @@ -11,13 +11,13 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", ] [tool.poetry.dependencies] -python = "^3.8" +python = "^3.6" toml = "^0.10.0" pyyaml = "^5.2" @@ -1,12 +1,13 @@ [tox] isolated_build = true -envlist = py38 +envlist = py{36, 37, 38} +recreate = True [testenv] -passenv = CI TRAVIS TRAVIS_* -deps = codecov +passenv = TOXENV CI TRAVIS TRAVIS_* CODECOV_* +deps = codecov>=1.4.0 whitelist_externals = poetry commands = poetry install -v poetry run pytest --cov=config_file/ tests/ - codecov
\ No newline at end of file + codecov -e TOXENV
\ No newline at end of file |