Skip to content

Commit

Permalink
Modernized the code base
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Dec 26, 2023
1 parent e803c69 commit c4e0101
Show file tree
Hide file tree
Showing 24 changed files with 551 additions and 394 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish packages to PyPI

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+[a-b][0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"

jobs:
build:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install build
- name: Create packages
run: python -m build
- name: Archive packages
uses: actions/upload-artifact@v3
with:
name: dist
path: dist

publish:
needs: build
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Retrieve packages
uses: actions/download-artifact@v3
- name: Upload packages
uses: pypa/gh-action-pypi-publish@release/v1
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: test suite

on:
push:
branches: [master]
pull_request:

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.10"]
include:
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.8"
- os: windows-latest
python-version: "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: pip
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: pip install .[test]
- name: Test with pytest
run: |
coverage run -m pytest
coverage xml
- name: Upload Coverage
uses: coverallsapp/github-action@v2
with:
parallel: true
file: coverage.xml

coveralls:
name: Finish Coveralls
needs: test
runs-on: ubuntu-latest
steps:
- name: Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
.tox
.coverage
.cache
.mypy_cache/
.pytest_cache/
.ruff_cache/
.eggs/
*.egg-info/
*.pyc
__pycache__/
docs/_build/
dist/
build/
virtualenv/
venv*
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is the configuration file for pre-commit (https://pre-commit.com/).
# To use:
# * Install pre-commit (https://pre-commit.com/#installation)
# * Copy this file as ".pre-commit-config.yaml"
# * Run "pre-commit install".
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ "--fix=lf" ]
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
args: ["--explicit-package-bases"]
additional_dependencies:
- asphalt
- py4j
- pytest
15 changes: 15 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

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

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements: [doc]
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.. image:: https://travis-ci.org/asphalt-framework/asphalt-py4j.svg?branch=master
:target: https://travis-ci.org/asphalt-framework/asphalt-py4j
.. image:: https://github.com/asphalt-framework/asphalt-py4j/actions/workflows/test.yml/badge.svg
:target: https://github.com/asphalt-framework/asphalt-py4j/actions/workflows/test.yml
:alt: Build Status
.. image:: https://coveralls.io/repos/github/asphalt-framework/asphalt-py4j/badge.svg?branch=master
:target: https://coveralls.io/github/asphalt-framework/asphalt-py4j?branch=master
:alt: Code Coverage
.. image:: https://readthedocs.org/projects/asphalt-py4j/badge/?version=latest
:target: https://asphalt-py4j.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

This Asphalt framework component provides the ability to run Java code directly from Python.

Expand Down
114 changes: 0 additions & 114 deletions asphalt/py4j/component.py

This file was deleted.

7 changes: 7 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API reference
=============

Component
---------

.. autoclass:: asphalt.py4j.component.Py4JComponent
45 changes: 23 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
#!/usr/bin/env python3
import pkg_resources
import importlib.metadata

from packaging.version import parse

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints',
'sphinxcontrib.asyncio'
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx_autodoc_typehints",
]

templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'asphalt-py4j'
author = 'Alex Grönholm'
copyright = '2015, ' + author
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
project = "asphalt-py4j"
author = "Alex Grönholm"
copyright = "2015, " + author

v = pkg_resources.get_distribution(project).parsed_version
v = parse(importlib.metadata.version(project))
version = v.base_version
release = v.public

language = None
language = "en"

exclude_patterns = ['_build']
pygments_style = 'sphinx'
highlight_language = 'python3'
exclude_patterns = ["_build"]
pygments_style = "sphinx"
highlight_language = "python3"
todo_include_todos = False

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
htmlhelp_basename = project.replace('-', '') + 'doc'
html_theme = "sphinx_rtd_theme"
htmlhelp_basename = project.replace("-", "") + "doc"

intersphinx_mapping = {'python': ('http://docs.python.org/3/', None),
'asphalt': ('http://asphalt.readthedocs.org/en/latest/', None),
'py4j': ('https://www.py4j.org/', None)}
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"asphalt": ("https://asphalt.readthedocs.org/en/latest/", None),
"py4j": ("https://www.py4j.org/", None),
}
Loading

0 comments on commit c4e0101

Please sign in to comment.