diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..d4517dd --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [master,dev] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install devDependence + run: | + python -m pip install --upgrade pip + pip install mypy pycodestyle coverage lxml + - name: Install dependencies + run: | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with pep8 + run: | + pycodestyle --max-line-length=140 --ignore=E501 --first --statistics pyloggerhelper + + - name: Type Hint Check + run: | + mypy --ignore-missing-imports --show-column-numbers --follow-imports=silent --check-untyped-defs --disallow-untyped-defs --no-implicit-optional --warn-unused-ignores pyloggerhelper + diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..0a9db66 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,38 @@ +# This workflows 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 + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + run: | + python setup.py sdist bdist_wheel bdist_egg + - name: 'Upload dist' + uses: 'actions/upload-artifact@v2' + with: + name: packages + path: dist/* + - name: Publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: + twine upload dist/* diff --git a/example.py b/example.py new file mode 100644 index 0000000..340a680 --- /dev/null +++ b/example.py @@ -0,0 +1,10 @@ +from pyloggerhelper import log + + +def testrun(): + log.info("test") + + +if __name__ == "__main__": + log.initialize_for_app("testapp") + testrun() \ No newline at end of file diff --git a/ppmrc.json b/ppmrc.json index acc869a..ee2b090 100644 --- a/ppmrc.json +++ b/ppmrc.json @@ -1 +1,9 @@ -{"env": ["venv"], "project_name": "pyloggerhelper", "version": "0.0.0", "author": "hsz12", "author_email": "", "description": "", "keywords": null} \ No newline at end of file +{ + "env": ["venv"], + "project_name": "pyloggerhelper", + "version": "0.0.0", + "author": "hsz12", + "author_email": "hsz1273327@gmail.com", + "description": "json logger helper", + "keywords": ["logger", "proxy"] +} \ No newline at end of file diff --git a/pyloggerhelper/__init__.py b/pyloggerhelper/__init__.py index e69de29..85f9fcf 100644 --- a/pyloggerhelper/__init__.py +++ b/pyloggerhelper/__init__.py @@ -0,0 +1 @@ +from .proxy import StructlogProxy,log \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e69de29..3e2d5ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,2 @@ +pyproxypattern == 0.0.1 +structlog == 20.2.0 \ No newline at end of file diff --git a/setup.cfg_ b/setup.cfg similarity index 88% rename from setup.cfg_ rename to setup.cfg index 7cf9ad2..3c54baf 100644 --- a/setup.cfg_ +++ b/setup.cfg @@ -3,7 +3,7 @@ name = pyloggerhelper version = 0.0.0 author = hsz author_email = hsz1273327@gmail.com -description = json格式结构化logger的帮助程序 +description = json logger helper long_description = file: README.md, CHANGELOG.md, LICENSE long_description_content_type = text/markdown keywords = logger, proxy @@ -22,9 +22,10 @@ include_package_data = True packages = find: install_requires = pyproxypattern >= 0.0.1 + structlog >= 20.2.0 [options.packages.find] include = pyloggerhelper -exclude = tests +exclude = tests, example.py