Skip to content

Commit

Permalink
Update packaging.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Nov 22, 2023
1 parent cdfe23c commit aba568f
Show file tree
Hide file tree
Showing 23 changed files with 355 additions and 166 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
50 changes: 12 additions & 38 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
run: |
pip install -U pip
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install -r requirements_dev.txt
- name: Lint 🔍
run: flake8 pymitter.py setup.py tests.py examples.py
run: flake8 pymitter tests examples.py

pypi:
runs-on: ubuntu-latest
Expand All @@ -42,14 +42,14 @@ jobs:

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install twine
pip install -U pip setuptools
pip install -U twine build
- name: Check bundling 📦
run: python setup.py sdist
run: python -m build

- name: Check setup 🚦
run: twine check "dist/$( python setup.py --fullname ).tar.gz"
run: twine check "dist/scinum-*.tar.gz"

test:
runs-on: ubuntu-latest
Expand All @@ -61,6 +61,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
name: test (python ${{ matrix.python-version }})
steps:
- name: Checkout 🛎️
Expand All @@ -75,39 +76,12 @@ jobs:

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -U pip setuptools
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install -r requirements_dev.txt
- name: Test 🎢
run: python -m unittest tests

test_legacy:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
- "3.6"
name: test (python ${{ matrix.python-version }})
steps:
- name: Checkout 🛎️
uses: actions/checkout@master
with:
persist-credentials: false

- name: Setup Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -r requirements.txt
pip install -r requirements_test.txt
- name: Test 🎢
run: python -m unittest tests
run: pytest tests

coverage:
runs-on: ubuntu-latest
Expand All @@ -124,9 +98,9 @@ jobs:

- name: Install dependencies ☕️
run: |
pip install -U pip
pip install -U pip setuptools
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install -r requirements_dev.txt
- name: Run coverage test 🎢
run: pytest --cov=pymitter --cov-report xml:coverage_39.xml tests.py
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@master
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -17,10 +17,15 @@ jobs:
with:
python-version: 3.9

- name: Install dependencies ☕️
run: |
pip install -U pip setuptools
pip install -U twine build
- name: Bundle 📦
run: python setup.py sdist
run: python -m build

- name: Publish package ⬆️
- name: Publish package 🐍
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*.log
*.DS_Store
dist
__pycache__
MANIFEST
.coverage
coverage.xml
docs/_build
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

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

submodules:
include: all
recursive: true

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2022, Marcel Rieger
Copyright (c) 2014-2023, Marcel Rieger
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include pymitter.py setup.py requirements.txt README.md LICENSE .flake8
global-exclude *.py[cod] __pycache__
graft pymitter
include requirements.txt requirements_dev.txt README.md LICENSE .flake8
global-exclude *.py[cod] __pycache__ .github tests/*
51 changes: 43 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
# pymitter

[![Package status](https://img.shields.io/pypi/v/pymitter.svg?style=flat)](https://pypi.python.org/pypi/pymitter)
[![License](https://img.shields.io/github/license/riga/pymitter.svg)](https://github.com/riga/pymitter/blob/master/LICENSE)
[![Lint and test](https://github.com/riga/pymitter/actions/workflows/lint_and_test.yml/badge.svg)](https://github.com/riga/pymitter/actions/workflows/lint_and_test.yml)
[![Code coverage](https://codecov.io/gh/riga/pymitter/branch/master/graph/badge.svg?token=MePbStZF7U)](https://codecov.io/gh/riga/pymitter)
[![PyPI downloads](https://img.shields.io/pypi/dm/pymitter.svg)](https://pypi.python.org/pypi/pymitter)
<!-- marker-before-logo -->

<p align="center">
<img src="https://media.githubusercontent.com/media/riga/pymitter/master/assets/logo250.png" />
</p>

<!-- marker-after-logo -->

<!-- marker-before-badges -->

<p align="center">
<a href="http://pymitter.readthedocs.io">
<img alt="Documentation status" src="https://readthedocs.org/projects/pymitter/badge/?version=latest" />
</a>
<img alt="Python version" src="https://img.shields.io/badge/Python-%E2%89%A53.7-blue" />
<a href="https://pypi.python.org/pypi/pymitter">
<img alt="Package version" src="https://img.shields.io/pypi/v/pymitter.svg?style=flat" />
</a>
<a href="https://pypi.python.org/pypi/pymitter">
<img alt="Package downloads" src="https://img.shields.io/pypi/dm/pymitter.svg" />
</a>
<a href="https://codecov.io/gh/riga/pymitter">
<img alt="Code coverge" src="https://codecov.io/gh/riga/pymitter/branch/master/graph/badge.svg?token=MePbStZF7U" />
</a>
<a href="https://github.com/riga/pymitter/actions/workflows/lint_and_test.yml">
<img alt="Build status" src="https://github.com/riga/pymitter/actions/workflows/lint_and_test.yml/badge.svg" />
</a>
<a href="https://github.com/riga/pymitter/blob/master/LICENSE">
<img alt="License" src="https://img.shields.io/github/license/riga/pymitter.svg" />
</a>
</p>

<!-- marker-after-badges -->

<!-- marker-before-header -->

Python port of the extended Node.js EventEmitter 2 approach of https://github.com/asyncly/EventEmitter2 providing namespaces, wildcards and TTL.

Original source hosted at [GitHub](https://github.com/riga/pymitter).

<!-- marker-after-header -->

<!-- marker-before-body -->

## Features

Expand All @@ -20,7 +53,7 @@ Python port of the extended Node.js EventEmitter 2 approach of https://github.co

## Installation

*pymitter* is a registered [PyPI module](https://pypi.python.org/pypi/pymitter), so the installation with *pip* is quite easy:
Simply install via [pip](https://pypi.python.org/pypi/pymitter):

```shell
pip install pymitter
Expand Down Expand Up @@ -260,3 +293,5 @@ Negative values mean infinity.
- Source hosted at [GitHub](https://github.com/riga/pymitter)
- Python module hosted at [PyPI](https://pypi.python.org/pypi/pymitter)
- Report issues, questions, feature requests on [GitHub Issues](https://github.com/riga/pymitter/issues)

<!-- marker-after-body -->
3 changes: 3 additions & 0 deletions assets/favicon.ico
Git LFS file not shown
3 changes: 3 additions & 0 deletions assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/logo250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Makefile for Sphinx documentation

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " clean to cleanup all build files"
@echo " html to make standalone HTML files"

clean:
rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
11 changes: 11 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* custom styles */

div#site-navigation img.logo {
width: 250px !important;
height: 55px !important;
max-height: none !important;
}

div#site-navigation div.navbar_extra_footer {
display: none;
}
56 changes: 56 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# coding: utf-8

import sys
import os


thisdir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.dirname(thisdir))

import pymitter as pm


project = pm.__name__
author = pm.__author__
copyright = pm.__copyright__
copyright = copyright[10:] if copyright.startswith("Copyright ") else copyright
copyright = copyright.split(",", 1)[0]
version = pm.__version__[:pm.__version__.index(".", 2)]
release = pm.__version__
language = "en"

templates_path = ["_templates"]
html_static_path = ["_static"]
master_doc = "index"
source_suffix = ".rst"
exclude_patterns = []
pygments_style = "sphinx"
add_module_names = False

html_title = "{} v{}".format(project, version)
html_logo = "../assets/logo.png"
html_favicon = "../assets/favicon.ico"
html_theme = "sphinx_book_theme"
html_theme_options = {
"show_navbar_depth": 2,
"repository_url": "https://github.com/riga/pymitter",
"use_repository_button": True,
"use_issues_button": True,
"use_edit_page_button": True,
}

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinx.ext.autosectionlabel",
"autodocsumm",
"myst_parser",
"sphinx_lfs_content",
]

autodoc_member_order = "bysource"


def setup(app):
app.add_css_file("styles.css")
7 changes: 7 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**pymitter**
============

.. include:: ../README.md
:parser: myst_parser.sphinx_
:start-after: <!-- marker-before-badges -->
:end-before: <!-- marker-after-body -->
13 changes: 13 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# main packages
-r ../requirements.txt

# dev packages
-r ../requirements_dev.txt

# documentation packages
sphinx~=6.2.1
sphinx-autodoc-typehints~=1.22,<1.23
sphinx-book-theme~=1.0.1
sphinx-lfs-content~=1.1.3
autodocsumm~=0.2.11
myst-parser~=2.0.0
Loading

0 comments on commit aba568f

Please sign in to comment.