From d29ead9903594d44c904b8d2d66c9fa7014eec27 Mon Sep 17 00:00:00 2001 From: Louis MARTIN Date: Thu, 7 Apr 2022 15:51:38 +0200 Subject: [PATCH 1/3] package in pip --- .gitignore | 2 ++ checkers/__init__.py | 0 checkers/cnes_checker/__init__.py | 4 +++ checkers/{ => cnes_checker}/cnes_checker.py | 0 setup.py | 27 +++++++++++++++++++++ 5 files changed, 33 insertions(+) create mode 100644 .gitignore delete mode 100644 checkers/__init__.py create mode 100644 checkers/cnes_checker/__init__.py rename checkers/{ => cnes_checker}/cnes_checker.py (100%) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e91184b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.egg-info/ +dist/ \ No newline at end of file diff --git a/checkers/__init__.py b/checkers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/checkers/cnes_checker/__init__.py b/checkers/cnes_checker/__init__.py new file mode 100644 index 0000000..f2dd4b9 --- /dev/null +++ b/checkers/cnes_checker/__init__.py @@ -0,0 +1,4 @@ +from .cnes_checker import register + +def register(linter): + cnes_checker.register(linter) \ No newline at end of file diff --git a/checkers/cnes_checker.py b/checkers/cnes_checker/cnes_checker.py similarity index 100% rename from checkers/cnes_checker.py rename to checkers/cnes_checker/cnes_checker.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..75b81cc --- /dev/null +++ b/setup.py @@ -0,0 +1,27 @@ +import setuptools + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name="cnes-pylint-extension", + version="5.0.0", + author="CNES CatLab", + description="A PyLint plugin that can output to SonarQube-importable JSON", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/cnescatlab/cnes-pylint-extension", + packages=setuptools.find_packages(where='checkers'), + package_dir={'': 'checkers'}, + license_file='LICENSE', + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", + "Operating System :: OS Independent", + ], + python_requires='>=3.6', + install_requires=[ + "pylint-plugin-utils==0.7", + "pylint==2.5.0" + ], +) \ No newline at end of file From 14a65b914f114a3d133f188afb450da9a552512b Mon Sep 17 00:00:00 2001 From: Louis MARTIN Date: Thu, 7 Apr 2022 16:26:12 +0200 Subject: [PATCH 2/3] Publish to pypi with GitHub Action --- .github/workflows/python-publish.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..ec70354 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,39 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#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@v3 + - 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 }} From a106031834e2ba5ab474d8e6fd3795b6daa704b6 Mon Sep 17 00:00:00 2001 From: Louis MARTIN Date: Wed, 13 Apr 2022 16:10:34 +0200 Subject: [PATCH 3/3] General fixes on documentation --- README.md | 13 ++++++++++--- setup.py | 7 +++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f924428..9a17c8e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ cnes-pylint-extension checks the following rules : cnes-pylint-extension checks the following metrics : - R5301 - too-high-complexity (default < 25) -- R5302 - too-high-complexity-simplified (defailt < 20) +- R5302 - too-high-complexity-simplified (default < 20) - R5201 - too-few-comments (default > 20%) # Available versions : @@ -30,11 +30,16 @@ cnes-pylint-extension checks the following metrics : # To use these checkers: -## Install Pylint +## Install from PIP +`pip install cnes-pylint-extension` + +## Install from sources + +### Install Pylint `pip install pylint==2.5.0` -## Install CNES Pylint extension checkers +### Install CNES Pylint extension checkers Download the project's code source then add the checkers subdirectory to your PYTHONPATH : @@ -52,6 +57,8 @@ load-plugins=cnes_checker ... ``` +## Usage + Pylint is now able to use the extension. Otherwise, add `--load-plugins=cnes_checker` to your pylint command line in order to activate it. diff --git a/setup.py b/setup.py index 75b81cc..c7aaa01 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ name="cnes-pylint-extension", version="5.0.0", author="CNES CatLab", - description="A PyLint plugin that can output to SonarQube-importable JSON", + description="A PyLint plugin to add coding CNES specific checks", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/cnescatlab/cnes-pylint-extension", @@ -16,7 +16,7 @@ license_file='LICENSE', classifiers=[ "Programming Language :: Python :: 3", - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", ], python_requires='>=3.6', @@ -24,4 +24,7 @@ "pylint-plugin-utils==0.7", "pylint==2.5.0" ], + project_urls={ + 'Bug Reports': 'https://github.com/cnescatlab/cnes-pylint-extension/issues' + } ) \ No newline at end of file