Skip to content

Commit

Permalink
Package project pip (#2)
Browse files Browse the repository at this point in the history
* Start the package management

* Create LICENSE

* Add the license

* Change version to rc

* typo

* Add entry point

* Refactor project repositories and remove travis

* RC2 and change path to main in python init

* Troubleshooting entrypoint

* Debug pyproject, change test directory name + doc

* Update main.py

Update help display to new usage

* Update README.md

install automatically dependencies with "pip install ."

* Set v1.0

---------

Co-authored-by: Diego <[email protected]>
  • Loading branch information
diegorodriguez31 and Diego authored Mar 22, 2023
1 parent d2ad9c9 commit 2927e94
Show file tree
Hide file tree
Showing 18 changed files with 906 additions and 156 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish-pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will upload a Python Package using Twine when a release is created

name: Build and 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 }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ TESTCSV/
TESTXLSX.xlsx
export/
export_csv/
export_html/
export_html/
/dist
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ polyspace-report2excel is a python module which adds the possibility
to read a polyspace report and export misra or run-time results in
an excel file for easier analyse.

## Installation
You need to install XlsxWriter, striprtf and html2text, you can use pip for that:
## Package installation

```
pip install XlsxWriter
pip install html2text
pip install striprtf
```
`pip install polyspace-report2excel`

## Usage
Export polyspace data in an HTML report or RTF report then run export-all.py, you can use `--help`.
Expand All @@ -22,11 +17,26 @@ by adding `--poly14` argument.
By default it export all tables to excel and generate one file per Polyspace chapter.
Use arguments to filter what you need.

:warning: by converting RTF file you must precise --runtime or --misra


### Usage example with the pip package
```
p2e input.html output-folder/
p2e input.rtf ouput-folder/ --runtime
```

### Usage example by cloning the repository
If you don't want to install the package `polyspace-report2excel`, first install the dependencies.

`pip install .`

Then, you can run:
```
python export-all.py input.html ouput-folder/
# OR
## WARNING, by converting RTF file you must precise --runtime or --misra
python export-all.py input.rtf ouput-folder/ --runtime
python main.py input.html ouput-folder/
python main.py input.rtf ouput-folder/ --runtime
```
## Arguments
- `--misra` will export misra report only.
Expand Down
119 changes: 0 additions & 119 deletions export-all.py

This file was deleted.

40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[project]
# https://pypi.org/project/polyspace-report2excel/
name = "polyspace-report2excel"
version = "1.0"
description = "read a polyspace report and export misra or run-time results"
readme = "README.md"
requires-python = ">=3"
license = {file = "LICENSE"}
keywords = ["polyspace", "report", "excel", "misra"]
authors = [
{name = "CAT Lab", email = "[email protected]" }
]
maintainers = [
{name = "CAT Lab", email = "[email protected]" }
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Quality Assurance",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3"
]

# https://packaging.python.org/discussions/install-requires-vs-requirements/
dependencies = [
"XlsxWriter",
"html2text",
"striprtf"
]

[project.urls]
"Homepage" = "https://github.com/cnescatlab/polyspace-report2excel"
"Bug Reports" = "https://github.com/cnescatlab/polyspace-report2excel/issues"

[project.scripts]
p2e = "p2e:main"

[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions HTMLReader.py → src/p2e/HTMLReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
""" Nom du module: HTMLReader
Description: Ce module permet la lecture d'un HTML et l'extraction des
tableaux qu'il contient.
Version: 1
Date: 9 avril 2019
Auteur: Louis MARTIN
Methodes et classes publiques:
- HTMLReader
__init__(filename, version=18)
Expand Down
5 changes: 1 addition & 4 deletions RTFReader.py → src/p2e/RTFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
""" Nom du module: RTFReader
Description: Ce module permet la lecture d'un RTF et l'extraction des
tableaux qu'il contient.
Version: 1
Date: 9 avril 2019
Auteur: Louis MARTIN
Methodes et classes publiques:
- HTMLReader
__init__(filename, version=18)
get_all_tables()
"""

# __________________________ IMPORT __________________________
import HTMLReader
from p2e import HTMLReader
from striprtf.striprtf import rtf_to_text

# ________________________ CONSTANTES ________________________
Expand Down
17 changes: 17 additions & 0 deletions src/p2e/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Modules:
exportcsv:
write to csv file
exportxlsx:
write to excel file
HTMLReader:
read HTML file and extract arrays from it
RTFReader:
read RTF file and extract arrays from it
main:
entrypoint for using this module
"""

def main():
import p2e.main
p2e.main.main()
3 changes: 0 additions & 3 deletions exportcsv.py → src/p2e/exportcsv.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
""" Nom du module: exportcsv
Description: Ce module permet l'ecriture vers un fichier csv.
Version: 1
Date: 9 avril 2019
Auteur: Louis MARTIN
Methodes et classes publiques:
- exportxlsx
__init__(filename)
Expand Down
3 changes: 0 additions & 3 deletions exportxlsx.py → src/p2e/exportxlsx.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
""" Nom du module: exportxlsx
Description: Ce module permet l'ecriture vers un fichier excel.
Version: 1
Date: 9 avril 2019
Auteur: Louis MARTIN
Methodes et classes publiques:
- exportxlsx
__init__(filename)
Expand Down
Loading

0 comments on commit 2927e94

Please sign in to comment.