diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 47e5958..63e2090 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,39 +1,35 @@ -name: PyCaseStyle Package Build +name: Publish Python 🐍 distributions 📦 to PyPI on: push: - branches: - - main - pull_request: - branches: - - main + tags: + - '*' jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }} - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + steps: + - uses: actions/checkout@master + - name: Set up Python 3.10 + uses: actions/setup-python@v3 with: - python-version: 3.8 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Test with pytest - run: | - pytest - - - name: Build and Publish to PyPI - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | + python-version: '3.10' + - name: Install pypa/setuptools + run: >- + python -m + pip install wheel + - name: Extract tag name + id: tag + run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) + - name: Update version in setup.py + run: >- + sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py + - name: Build a binary wheel + run: >- python setup.py sdist bdist_wheel - pip install twine - twine upload dist/* \ No newline at end of file + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/README.rst b/README.rst index 1d1cfc7..5bd3164 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,6 @@ Installation To install pycasestyle, you can use pip: .. code-block:: bash - pip install pycasestyle Usage @@ -24,7 +23,6 @@ Usage You can import the text formatting styles directly from the pycasestyle module and use them in your code. Here's an example of how to use the text formatting styles: .. code-block:: python - import pycasestyle # Converting to camelcase from text @@ -68,7 +66,6 @@ You need to migrate information from Postgres to Elasticsearch, however, the map .. code-block:: python - import pycasestyle postgres_contract = { diff --git a/pycasestyle/camelcase.py b/pycasestyle/camelcase.py index d1c9920..461cce3 100644 --- a/pycasestyle/camelcase.py +++ b/pycasestyle/camelcase.py @@ -39,5 +39,7 @@ def from_dict(self, __dict: dict) -> dict: camel_case_dict = {} for key, value in __dict.items(): camel_case_key = self.from_string(key) + if isinstance(value, dict): + value = self.from_dict(value) camel_case_dict[camel_case_key] = value return camel_case_dict diff --git a/pycasestyle/kebabcase.py b/pycasestyle/kebabcase.py index cd98248..867c2a9 100644 --- a/pycasestyle/kebabcase.py +++ b/pycasestyle/kebabcase.py @@ -38,5 +38,7 @@ def from_dict(self, __dict: dict) -> dict: kebab_case_dict = {} for key, value in __dict.items(): kebab_case_key = self.from_string(key) + if isinstance(value, dict): + value = self.from_dict(value) kebab_case_dict[kebab_case_key] = value return kebab_case_dict diff --git a/pycasestyle/pascalcase.py b/pycasestyle/pascalcase.py index 65e95a3..6b834b9 100644 --- a/pycasestyle/pascalcase.py +++ b/pycasestyle/pascalcase.py @@ -39,5 +39,7 @@ def from_dict(self, __dict: dict) -> dict: pascal_case_dict = {} for key, value in __dict.items(): pascal_case_key = self.from_string(key) + if isinstance(value, dict): + value = self.from_dict(value) pascal_case_dict[pascal_case_key] = value return pascal_case_dict diff --git a/pycasestyle/snakecase.py b/pycasestyle/snakecase.py index 701536f..c4b4492 100644 --- a/pycasestyle/snakecase.py +++ b/pycasestyle/snakecase.py @@ -38,5 +38,7 @@ def from_dict(self, __dict: dict) -> dict: snake_case_dict = {} for key, value in __dict.items(): snake_case_key = self.from_string(key) + if isinstance(value, dict): + value = self.from_dict(value) snake_case_dict[snake_case_key] = value return snake_case_dict diff --git a/setup.py b/setup.py index 6809a78..6d1dc28 100644 --- a/setup.py +++ b/setup.py @@ -8,10 +8,11 @@ setup( name='pycasestyle', - version='0.0.1', + version='{{VERSION_PLACEHOLDER}}', keywords=['pycasestyle', 'camelcase', 'snakecase', 'pascal case', 'kebab case', 'dict key case', 'string case'], description='A simple python lib to convert string and dict keys to camelcase, pascal case, kebab case and snake case.', long_description=readme, + long_description_content_type="text/markdown", author='Pedro Rodrigues', author_email='pedrota.rodrigues@gmail.com', url='https://github.com/preduus/pycasestyle',