Skip to content

Commit

Permalink
Merge pull request #4 from HLasse/pypi_integration
Browse files Browse the repository at this point in the history
add pypi integration to spacy version
  • Loading branch information
HLasse authored Jul 28, 2021
2 parents b5ae477 + 6243a83 commit de8a92f
Show file tree
Hide file tree
Showing 24 changed files with 520 additions and 7 deletions.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/01_bugs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: "\U0001F6A8 Submit a Bug Report"
about: Use this template if you came across a bug or unexpected behaviour differing from the docs.
labels: bug
---

## How to reproduce the behaviour
<!-- Include a code example or the steps that led to the problem. Please try to be as specific as possible. -->

## Your Environment
<!-- Include details of your environment. To get the version of textdescriptives you can get use `python -c "import textdescriptives as td; print(td.__version__)"`.-->
* textdescriptives Version Used:
* Operating System:
* Python Version Used:
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/02_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: "\U0001F4DA Submit a Documentation Report"
about: Did you spot a mistake in the docs, is anything unclear or do you have a
suggestion?
labels: documentation
---
<!-- Describe the problem or suggestion here. If you've found a mistake and you know the answer, feel free to submit a pull request -->

## Which page or section is this issue related to?
<!-- Please include the URL and/or source. -->
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/03_feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: "🚀 Submit a Feature request"
about: Use this template if you want a feature added which is currently not present
labels: enhancement
---

<!-- Describe your desired feature and why it is important. If possible state what you can and are willing to do to help with it -->
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: 🗯 Discussions forum
url: https://HLasse/textdescriptives/discussions
about: Usage questions, general discussion and anything else that isn't a bug report or a feature request.
- name: 📖 TextDescriptives usage guides & package references
url: https://HLasse.github.io/textdescriptives/
about: Everything you need to know about textdescriptives and how to use it.
- name: 🛠 Submit a pull request
url: https://github.com/HLasse/textdescriptives/pulls
about: Did you spot a mistake and know how to fix it? Feel free to submit a PR and contribute!
29 changes: 29 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

name: Documentation
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install sphinx furo sphinx-copybutton sphinxext-opengraph
- name: Build and Commit
uses: sphinx-notes/pages@master
with:
documentation_path: docs
install_requirements: "true"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.SPHINX_DOCUMENTATION }}
branch: gh-pages
35 changes: 35 additions & 0 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

name: Publish to PyPI
on:
push:
branches: [ main ]

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
47 changes: 47 additions & 0 deletions .github/workflows/pytest-cov-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

name: CI Pytest
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
pytest:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run and write pytest
run: |
python ./dev/pytest-coverage/run_coverage.py
- name: Pytest coverage comment
id: coverage-comment
uses: MishaKav/[email protected]
with:
pytest-coverage-path: ./dev/pytest-coverage/pytest-coverage.txt

- name: Check the output coverage
run: |
echo "Coverage Report - ${{ steps.coverage-comment.outputs.coverage }}"
echo "Coverage Color - ${{ steps.coverage-comment.outputs.color }}"
- name: Create the Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }}
gistID: af8637d94475ea8bcb6b6a03c4fbcd3e
filename: badge-dacy-pytest-coverage.json
label: Coverage
message: ${{ steps.coverage-comment.outputs.coverage }}
color: ${{ steps.coverage-comment.outputs.color }}
namedLogo: python
26 changes: 26 additions & 0 deletions .github/workflows/pytest_mac_catalina.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pytest (MacOS Catalina)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
pytest:
runs-on: macos-10.15
steps:

- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run and write pytest
run: |
python ./dev/pytest-coverage/run_coverage.py
28 changes: 28 additions & 0 deletions .github/workflows/pytest_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is a basic workflow to help you get started with Actions

name: Pytest (Windows)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
pytest:
runs-on: windows-latest
steps:

- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
pip install -r requirements.txt
- name: Run and write pytest
run: |
python ./dev/pytest-coverage/run_coverage.py
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ share/python-wheels/
*.egg
MANIFEST


# docs
docs/_build/*

# Mac
.DS_Store
=======
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down Expand Up @@ -131,4 +138,4 @@ dmypy.json
# Mac stuff
.DStore

.vscode
.vscode
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!--
[![PyPI version](https://badge.fury.io/py/tomsup.svg)](https://pypi.org/project/tomsup/)
[![Code style: flake8](https://img.shields.io/badge/Code%20Style-flake8-blue)](https://pypi.org/project/flake8/)
[![pip downloads](https://img.shields.io/pypi/dm/textdescriptives.svg)](https://crate.io/packages/textdescriptives)
[![python versions](https://img.shields.io/pypi/pyversions/textdescriptives?colorB=blue)](https://pypi.org/project/textdescriptives/)
-->

[![spacy](https://img.shields.io/badge/built%20with-spaCy-09a3d5.svg)](https://spacy.io)
[![github actions pytest](https://github.com/hlasse/textdescriptives/actions/workflows/pytest-cov-comment.yml/badge.svg)](https://github.com/hlasse/textdescriptives/actions)
[![github actions docs](https://github.com/hlasse/textdescriptives/actions/workflows/documentation.yml/badge.svg)](https://hlasse.io/textdescriptives/)
![github coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/hlasse/GISTID/raw/badge-textdescriptives-pytest-coverage.json)
<!-- Needs to add gist -->



Expand Down Expand Up @@ -113,6 +113,7 @@ The table below shows the metrics included in TextDescriptives and their attribu

Developed by Lasse Hansen ([@HLasse](https://lassehansen.me)) at the [Center for Humanities Computing Aarhus](https://chcaa.io)


Collaborators:

* Ludvig Renbo Olsen ([@ludvigolsen]( https://github.com/ludvigolsen ), [ludvigolsen.dk]( http://ludvigolsen.dk ))
Expand Down
Empty file added dev/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions dev/pytest-coverage/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
omit =
textdescriptives/tests/*
36 changes: 36 additions & 0 deletions dev/pytest-coverage/run_coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
A script for running path
"""
import os
import subprocess
from pathlib import Path


import subprocess

test_failed = False
try:
grepOut = subprocess.check_output(
"pytest --cov=textdescriptives --cov-config=dev/pytest-coverage/.coveragerc --cov-report term-missing",
shell=True,
)
output = grepOut.decode("utf-8")
except subprocess.CalledProcessError as grepexc:
output = grepexc.output.decode("utf-8")
test_failed = True
print("error code", grepexc.returncode, "\n\n --------- \n", output)


save_path = os.path.join("dev", "pytest-coverage")
Path(save_path).mkdir(parents=True, exist_ok=True)

save_path = os.path.join(save_path, "pytest-coverage.txt")

if os.path.exists(save_path):
os.remove(save_path)
with open(save_path, "w") as f:
f.write(output)


if test_failed is True:
raise ValueError("Tests did not pass")
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_static/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/icon_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit de8a92f

Please sign in to comment.