Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating code to python 3.12 #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
14 changes: 14 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Test

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: tox
run: |
python -m pip install --upgrade pip
python -m pip install tox
tox
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/internap/python-config-probe.svg?branch=master)](https://travis-ci.org/internap/python-config-probe)
[![PyPI version](https://badge.fury.io/py/config-probe.svg)](http://badge.fury.io/py/config-probe)
![Build Status](https://github.com/stephanerobert/config-mixin/actions/workflows/tox.yml/badge.svg?branch=master)
[![PyPI version](https://badge.fury.io/py/config-mixin.svg)](http://badge.fury.io/py/config-mixin)


Mission
Expand All @@ -25,7 +25,7 @@ Use it:

- **path**

Initial path to probe. Patterns will be tested against the file structure underneath the path
Initial path to probe. Patterns will be tested against the file structure underneath the path,
and it will be ignored in determining the namespacing.

- **patterns**
Expand Down Expand Up @@ -58,7 +58,7 @@ Use it:

## Mocking the probing

Your unit test can have your code use fake_probe instead to which to give a dict and it will appear as if it
Your unit test can have your code use fake_probe instead to which to give a dict, and it will appear as if it
was just probed. Example:

config = fake_probe({
Expand Down
9 changes: 9 additions & 0 deletions config-mixin.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
8 changes: 4 additions & 4 deletions config_probe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

import yaml
from munch import Munch, iteritems
from munch import Munch

from config_probe.exceptions import ConfigNotFound

Expand Down Expand Up @@ -46,7 +46,7 @@ def _deduce_namespaces(path_matchers, path_parts):
namespaces = []
path_parts, current_part = os.path.split(path_parts)
path_matchers, matcher = os.path.split(path_matchers)
while current_part is not "":
while current_part != "":
if matcher == NAMESPACE_PLACEHOLDER:
namespaces.append(current_part)

Expand All @@ -67,7 +67,7 @@ def _add_to_configuration(config, namespaces, new_values):

def _update(config, values):
for k, v in values.items():
if k in config and isinstance(v, collections.Mapping):
if k in config and isinstance(v, collections.abc.Mapping):
_update(config[k], v)
else:
config[k] = v
Expand All @@ -83,7 +83,7 @@ def __getattr__(self, k):

def _munchify(x):
if isinstance(x, dict):
return _Munch((k, _munchify(v)) for k,v in iteritems(x))
return _Munch((k, _munchify(v)) for k,v in x.items())
elif isinstance(x, (list, tuple)):
return type(x)(_munchify(v) for v in x)
else:
Expand Down
20 changes: 7 additions & 13 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
[metadata]
name = config-probe
url = https://github.com/internap/python-config-probe
author = Internap Hosting
author-email = opensource@internap.com
name = config-mixin
url = https://github.com/stephanerobert/config-mixin
author = Stephane Robert
author-email = stephane.robert@gmail.com
summary = Auto-discovery of configurations for easy inline use
description-file =
README.md
classifier =
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: System Administrators
Intended Audience :: Telecommunications Industry
License :: OSI Approved :: Apache Software License
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.12

[files]
packages =
config_probe
config_mixin

[bdist_wheel]
universal = 1

[nosetests]
no-path-adjustment = 1
logging-level = DEBUG
26 changes: 25 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
#!/usr/bin/env python

from setuptools import setup


def readme():
with open('README.md') as readme:
return readme.read()


setup(
setup_requires=['pbr'],
pbr=True,
name='Config Mixin',
description='Python Configuration File Helper',
long_description=readme(),
long_description_content_type='text/markdown',
classifiers=[
'Framework :: tox',
'Framework :: Pytest',
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.12',
'Topic :: Software Development',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology'
],
author='Stephane Robert',
author_email='[email protected]',
url='https://github.com/stephanerobert/config-mixin',
version='1.0.0'
)
3 changes: 2 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
nose
pytest
pytest-cov
pyhamcrest
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist = py27,py34
envlist = py34,p312

[testenv]
deps = -r{toxinidir}/test-requirements.txt
commands = nosetests
commands = pytest --cov --cov-report term-missing