Skip to content

Commit

Permalink
Merge pull request #4 from btr1975/feature/move-to-pyproject-toml
Browse files Browse the repository at this point in the history
Feature/move to pyproject toml
  • Loading branch information
btr1975 authored Mar 25, 2023
2 parents 32ea6a0 + 984073e commit 9f992dd
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 735 deletions.
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7.15
python-version: 3.8

- name: Install dependencies
run: |
Expand All @@ -29,5 +29,5 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
make build
twine upload dist/*
21 changes: 10 additions & 11 deletions .github/workflows/test-coverage-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
strategy:
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- '3.10'
Expand All @@ -35,18 +34,18 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies MAIN
- name: Upgrade pip setuptools wheel
run: |
python -m pip install --upgrade pip setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install dependencies TESTS for some reason doing it in one install creates backtracking
- name: Install requirements from requirements-dev.txt
run: |
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Test with pytest and coverage
pip install -r requirements-dev.txt
- name: Run Linting
run: |
coverage erase
coverage run
coverage report
- name: Lint with pylint
make pylint
- name: Run Unit-Testing and Coverage
run: |
pylint ./pyats_genie_command_parse/pyats_genie_command_parse.py
make coverage
- name: Run Build
run: |
make build
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.8"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: requirements-dev.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 - 2022 Benjamin Trachtenberg
Copyright (c) 2020 - 2023 Benjamin Trachtenberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Makefile for project needs
# Author: Ben Trachtenberg
# Version: 1.0.3
#

.PHONY: info app-run coverage pylint pytest gh-pages pdf build

info:
@echo "make options"
@echo " build To build"
@echo " coverage To run coverage and display ASCII and output to htmlcov"
@echo " pylint To run pylint"
@echo " pytest To run pytest with verbose option"
@echo " pdf To create PDF Docs"

build:
@python -m build

coverage:
@pytest --cov --cov-report=html -vvv

pylint:
@pylint pyats_genie_command_parse/

pytest:
@pytest --cov -vvv

pdf:
@sphinx-build -b rinoh ./docs ./docs/_build/pdf
24 changes: 18 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@
#
import os
import sys
import tomli
base_path = os.path.split(os.path.join(os.path.abspath(os.path.dirname(__name__))))[0]
sys.path.append(base_path)
about = {}

# Reads version.py and converts to a dict of keys
version_py = {}
with open(os.path.join(base_path, 'pyats_genie_command_parse', 'version.py'), 'r', encoding='utf-8') as f:
exec(f.read(), about)
exec(f.read(), version_py)

# Reads pyproject.toml and converts to python objects
with open(os.path.join(base_path, 'pyproject.toml'), 'r', encoding='utf-8') as file:
toml = file.read()
pyproject_toml = tomli.loads(toml)

# -- Added for readthedocs.org -----------------------------------------------

Expand All @@ -26,11 +33,16 @@
# -- Project information -----------------------------------------------------

# The full version, including alpha/beta/rc tags
release = about['__version__']
release = version_py['__version__']
project = f"{pyproject_toml['project']['name']} v{release}"
copyright = version_py['__copyright__']

# Reads authors from pyproject.toml and adds name to list
authors = []
for author_name in pyproject_toml['project']['authors']:
authors.append(author_name.get('name'))

project = f'{about["__title__"]} v{release}'
copyright = about['__copyright__']
author = about['__author__']
author = ','.join(authors)

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pyats_genie_command_parse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
init for pyats_genie_command_parse
"""
from .pyats_genie_command_parse import GenieCommandParse
from pyats_genie_command_parse.pyats_genie_command_parse import GenieCommandParse
10 changes: 1 addition & 9 deletions pyats_genie_command_parse/version.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
"""
Holds the version information for the package
"""
__title__ = 'pyats-genie-command-parse'
__description__ = 'Run genie parsers directly.'
__author__ = 'Benjamin P. Trachtenberg, Brett Gianpetro'
__copyright__ = "Copyright (c) 2020 - 2023, Benjamin P. Trachtenberg, Brett Gianpetro"
__credits__ = None
__license__ = 'The MIT License (MIT)'
__status__ = 'prod'
__version_info__ = (1, 3, 4)
__version_info__ = (1, 3, 5)
__version__ = '.'.join(map(str, __version_info__))
__maintainer__ = 'Benjamin P. Trachtenberg'
__email__ = 'e_ben_75-python@yahoo.com'
__url__ = 'https://pyats-genie-command-parse.readthedocs.io'
Loading

0 comments on commit 9f992dd

Please sign in to comment.