Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring new python packaging #118

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .bettercodehub.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .coveragerc

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Python application

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y libemail-outlook-message-perl
pip install ".[dev, test]"
export PERL_MM_USE_DEFAULT=1
sudo cpan -f -i Email::Outlook::Message

- name: Run pre-commit
if: matrix.python-version == '3.10'
run: |
make pre-commit

- name: Run tests
run: |
pytest
python -m mailparser -v
python -m mailparser -h
mail-parser -f tests/mails/mail_malformed_3 -j
cat tests/mails/mail_malformed_3 | mail-parser -k -j

- name: Report to Coveralls
if: matrix.python-version == '3.10'
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
if: matrix.python-version == '3.10'
run: |
python -m build

- name: Upload artifacts
if: matrix.python-version == '3.10'
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/mail-parser-*.tar.gz
dist/mail_parser-*.whl
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ venv27
venv3
venv-mailparser
report/
junit.xml
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=5000']
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: detect-aws-credentials
args: ["--allow-missing-credentials"]
- id: detect-private-key
- id: mixed-line-ending
- id: check-ast

#- repo: https://github.com/astral-sh/ruff-pre-commit
# # Ruff version.
# rev: v0.3.2
# hooks:
# # Run the linter.
# - id: ruff
# args: [ --fix ]
# # Run the formatter.
# - id: ruff-format
73 changes: 0 additions & 73 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

62 changes: 19 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,54 +29,30 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove all build files
find . -type d -name "build" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +

clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-tests: ## remove test and coverage artifacts
find . -type f -name "*.log" -delete
find . -type f -name "coverage.xml" -delete
find . -type f -name "junit.xml" -delete
find . -type f -name ".coverage" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name "htmlcov" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name "__pycache__" -exec rm -rf {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-all: clean-tests clean-build ## remove all tests and build files

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
test: clean-tests ## run tests quickly with the default Python
pytest

lint: ## check style with flake8
flake8 mailparser tests
pre-commit: ## run pre-commit on all files
pre-commit run -a

test: ## run tests quickly with the default Python
python -m unittest discover -s tests -f -v

test-all: ## run tests on every Python version with tox
tox

# docs: ## generate Sphinx HTML documentation, including API docs
# rm -f docs/mailparser.rst
# rm -f docs/modules.rst
# sphinx-apidoc -o docs/ mailparser
# $(MAKE) -C docs clean
# $(MAKE) -C docs html
# $(BROWSER) docs/_build/html/index.html

# servedocs: docs ## compile the docs watching for changes
# watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
dist: clean-all ## builds source and wheel package
python -m build

release: dist ## package and upload a release
twine upload dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
128 changes: 0 additions & 128 deletions Pipfile.lock

This file was deleted.

Loading
Loading