Skip to content

Commit

Permalink
Get a recent build with pyproject.toml and tests running (#15)
Browse files Browse the repository at this point in the history
* Get a recent build with pyproject.toml

* Github action for pelecanus.

* Add poetry cache.
  • Loading branch information
erewok authored Aug 16, 2022
1 parent 4637ce3 commit 705f882
Show file tree
Hide file tree
Showing 8 changed files with 415 additions and 78 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
env:
CODECOV_UPLOAD: false
PIPX_VERSION: "0.16.4"
POETRY_VERSION: "1.1.14"
PYPI_PUBLISH: false

strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: Set up Poetry cache for Python dependencies
uses: actions/cache@v3
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: "Install poetry"
run: "pip install poetry"
- name: "Run poetry update"
run: "poetry update"
- name: "Run tests"
run: "poetry run pytest"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ __pycache__/
build/
dist/
htmlcov/
.venv/
.vscode/
2 changes: 1 addition & 1 deletion pelecanus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"""
from .pelicanjson import PelicanJson # noqa

__version__ = '0.5.2'
__version__ = '0.5.3'
322 changes: 322 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[tool.poetry]
name = "pelecanus"
version = "0.5.3"
description = "Python3 application for navigating and editing nested JSON"
readme = "./README.md"
authors = ["Erik Aker <[email protected]>"]
license = "GNU General Public License v2"
homepage = "https://github.com/erewok/pelecanus"
repository = "https://github.com/erewok/pelecanus"
documentation = "https://pelecanus.readthedocs.io/en/latest/"
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries"
]

[tool.poetry.dependencies]
python = "^3.7"

[tool.poetry.dev-dependencies]
coverage="^6.4.4"
pytest="^7.1.2"
pytest-cov="^3.0.0"
pytest-pycodestyle="^2.3.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
pythonpath = "."
addopts = "--no-cov-on-fail --showlocals --strict-markers --cov=pelecanus --pycodestyle"
testpaths = ["test"]
19 changes: 3 additions & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
[tool:pytest]
addopts = --pep8 --cov=./pelecanus
pep8ignore =
setup.py ALL
docs/conf.py ALL

[flake8]
[pycodestyle]
ignore = D203
exclude =
.git,
__pycache__,
docs/conf.py
setup.py
old,
build,
dist
max-complexity = 10
max-line-length = 110
exclude = docs/conf.py,setup.py

[build_sphinx]
source-dir = doc/source
Expand Down
55 changes: 2 additions & 53 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,59 +19,8 @@
More Info
---
See github project for more detailed usage instructions.
See github project or docs for more detailed usage instructions.
"""

from setuptools import setup
import os
import codecs
import re

here = os.path.abspath(os.path.dirname(__file__))


def read(*parts):
# intentionally *not* adding an encoding option to open
return codecs.open(os.path.join(here, *parts), 'r').read()


def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


setup(
name='pelecanus',
packages=['pelecanus'],
version=find_version('pelecanus', '__init__.py'),
description='Python3 application for navigating and editing nested JSON',
author='Erik Aker',
author_email="[email protected]",
url="https://github.com/pellagic-puffbomb/pelecanus",
license="GNU General Public License v2",
download_url="https://github.com/pellagic-puffbomb/pelecanus.git",
keywords=["json", "hateoas"],
tests_require=['pytest',
'coverage',
"flake8",
"pytest_cov",
"pytest-pep8"],
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries"
],
install_requires=[],
long_description=__doc__
)
setup()
12 changes: 4 additions & 8 deletions testing-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
coverage==4.4.1
flake8==3.3.0
py==1.10.0
pyflakes==1.5.0
pytest==3.1.0
pytest-cache==1.0
pytest-cov==2.5.1
pytest-pep8==1.0.6
coverage==6.4.4
pytest==7.1.2
pytest-cov==3.0.0
pytest-pycodestyle==2.3.0

0 comments on commit 705f882

Please sign in to comment.