Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v2.0.0_release'
Browse files Browse the repository at this point in the history
* origin/v2.0.0_release:
  Bump version and update changelog for version 2.0.0
  Fixes #20. Add doc note aobut combining diactrical marks.
  add fullwidth full stop. fixes #30
  remove python2 support
  fix copy/paste error and update docs link for pypi
  update docs links and status images
  fix remaining flake8 warnings. Also addresses #34
  run black on all files
  formatting fixes from black
  Switch to using hatch for development and upgrade to latest Sphinx for documentation.
  Bump wheel from 0.29.0 to 0.38.1
  Update __init__.py
  Update __init__.py
  Use new string format in docs.
  Add 3.6 and remove 3.3 from setup.py.
  Lint fixes.
  Add tests and Makefile to manifest.
  Move tests to separate directory.
  Update travis/tox tests.
  Update requirements file.
  • Loading branch information
tsroten committed Jun 24, 2023
2 parents 5eb0ec4 + 37ba5e2 commit e59bf21
Show file tree
Hide file tree
Showing 35 changed files with 1,624 additions and 1,119 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = E731, P101
exclude = src/zhon/cedict/*
max-line-length = 100
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
- push
- pull_request

jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest]
include:
- python-version: 3.7
py: py37
- python-version: 3.8
py: py38
- python-version: 3.9
py: py39
- python-version: '3.10'
py: py310
- python-version: '3.11'
py: py311
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade hatch
- name: Run tests
run: |
hatch run test.py${{ matrix.python-version }}:run
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade hatch
- name: Check with black
if: always()
run: hatch run style:format && git diff --exit-code
- name: Check with flake8
if: always()
run: hatch run style:check
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: docs

on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade hatch
- name: Build docs
if: always()
run: hatch run docs:generate
- name: Check docs
if: always()
run: hatch run docs:check
- name: Upload docs
uses: actions/upload-pages-artifact@v1
with:
path: docs/_build/html

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: publish

on:
push:
tags:
- '*'

jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Hatch
run: |
python -m pip install -U hatch
- name: Build package
run: |
hatch build
- name: Publish
run: |
hatch publish
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }}
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,13 @@ v.1.1.5 (2016-05-23)
--------------------

* Add missing Zhuyin characters. Fixes #23.

v.2.0.0 (2023-06-24)
--------------------

* Removes Python 2.7 support
* Bumps minimum support Python to Python 3.7
* Switches to hatch for project management
* Fixes an invalid backslash escape sequence (#34)
* Automatically imports subpackages when importing zhon (#31)
* Updates documentation about combining diacritic marks (#29)
18 changes: 6 additions & 12 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,21 @@ Ready to contribute? Here's how to set up `zhon` for local development.

$ git clone git@github.com:your_name_here/zhon.git

3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
3. Run the tests. Assuming you have `hatch <https://hatch.pypa.io/latest/>`_ installed::

$ mkvirtualenv zhon
$ cd zhon/
$ python setup.py develop
$ hatch run test

4. Create a branch for local development::

$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
5. When you're done making changes, run the linter and tests::

$ flake8 zhon
$ python setup.py test
$ tox

To get flake8 and tox, just pip install them into your virtualenv.

You can ignore the flake8 errors regarding `zhon.cedict` files. Rather than include hundreds of newline characters in each file, we are ignoring those errors.
$ hatch run test
$ hatch run format

6. Commit your changes and push your branch to GitHub::

Expand All @@ -101,7 +95,7 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.3, and 3.4. Check
3. The pull request should work for Python 3.7+. Check
https://travis-ci.org/tsroten/zhon/pull_requests
and make sure that the tests pass for all supported Python versions.
4. If you want to receive credit, add your name to `AUTHORS.rst`.
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

21 changes: 10 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Zhon
====

.. image:: https://badge.fury.io/py/zhon.png
:target: http://badge.fury.io/py/zhon
.. image:: https://badge.fury.io/py/zhon.svg
:target: https://pypi.org/project/zhon

.. image:: https://travis-ci.org/tsroten/zhon.png?branch=develop
:target: https://travis-ci.org/tsroten/zhon
.. image:: https://github.com/tsroten/zhon/actions/workflows/ci.yml/badge.svg
:target: https://github.com/tsroten/zhon/actions/workflows/ci.yml

Zhon is a Python library that provides constants commonly used in Chinese text
processing.

* Documentation: http://zhon.rtfd.org
* Documentation: https://tsroten.github.io/zhon/
* GitHub: https://github.com/tsroten/zhon
* Support: https://github.com/tsroten/zhon/issues
* Free software: `MIT license <http://opensource.org/licenses/MIT>`_
Expand All @@ -25,7 +25,7 @@ Zhon's constants can be used in Chinese text processing, for example:

.. code:: python
>>> re.findall('[%s]' % zhon.hanzi.characters, 'I broke a plate: 我打破了一个盘子.')
>>> re.findall('[{}]'.format(zhon.hanzi.characters), 'I broke a plate: 我打破了一个盘子.')
['', '', '', '', '', '', '', '']
* Validate Pinyin syllables, words, or sentences:
Expand All @@ -44,7 +44,7 @@ Zhon's constants can be used in Chinese text processing, for example:
Features
--------

+ Includes commonly-used constants:
* Includes commonly-used constants:
- CJK characters and radicals
- Chinese punctuation marks
- Chinese sentence regular expression pattern
Expand All @@ -53,12 +53,11 @@ Features
- Zhuyin characters and marks
- Zhuyin syllable regular expression pattern
- CC-CEDICT characters
+ Runs on Python 2.7 and 3

Getting Started
---------------

* `Install Zhon <http://zhon.readthedocs.org/en/latest/#installation>`_
* Read `Zhon's introduction <http://zhon.readthedocs.org/en/latest/#using-zhon>`_
* Learn from the `API documentation <http://zhon.readthedocs.org/en/latest/#zhon-hanzi>`_
* `Install Zhon <https://tsroten.github.io/zhon/#installation>`_
* Read `Zhon's introduction <https://tsroten.github.io/zhon/#using-zhon>`_
* Learn from the `API documentation <https://tsroten.github.io/zhon/#module-zhon.hanzi>`_
* `Contribute <https://github.com/tsroten/zhon/blob/develop/CONTRIBUTING.rst>`_ documentation, code, or feedback
Loading

0 comments on commit e59bf21

Please sign in to comment.