Skip to content

Commit

Permalink
Switch to poetry and add support for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
karelvaculik committed Apr 14, 2024
1 parent f60cc66 commit a3a2657
Show file tree
Hide file tree
Showing 57 changed files with 732 additions and 541 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/build_and_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
python -m pip install poetry
python -m poetry config virtualenvs.in-project true
python -m poetry install
- name: Build package
run: python -m build
run: python -m poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
26 changes: 21 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@ name: Tests
on: [ push ]

jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install poetry
python -m poetry config virtualenvs.in-project true
python -m poetry install
- name: Run linters
run: |
python -m poetry run tox -e format,linter,mypy
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]

python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
Expand All @@ -17,12 +32,13 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
python -m pip install poetry
python -m poetry config virtualenvs.in-project true
python -m poetry install
- name: Run tox
env:
TOXENV: "py${{ matrix.python-version }}-core-tests"
run: |
TOXENV=${{ env.TOXENV }}
TOXENV=${TOXENV//.}
tox -e $TOXENV,mypy,flake8,ufmt
python -m poetry run tox -e $TOXENV
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml

This file was deleted.

12 changes: 4 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ build:
tools:
python: "3.10"
jobs:
post_create_environment:
- python -m pip install poetry
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs --extras "examples"
pre_build:
- find docs/examples -name "*.py" ! -name "script_with_args.py" -exec pyreball {} \;
- pyreball --page-width=90 docs/examples/script_with_args.py -- --sum 23 25 24

python:
install:
- requirements: docs/requirements.txt
- requirements: requirements_examples.txt
# Install our python package before building the docs
- method: pip
path: .

mkdocs:
configuration: mkdocs.yml
fail_on_warning: true
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.1.0 (2024-04-14)

- Added support for Python 3.12.
- Internals:
- Replaced with `setup.py` with `pyproject.toml` and Poetry, moved source code
under `src` directory.
- Dependency on `pkg_resources` replaced with `importlib` for Python >= 3.9.
- Ruff is now used for linting and formatting.

## 2.0.0 (2023-11-15)

- Added option `-m` to specify input as module.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

<p style="text-align: center">

![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
[![pypi](https://img.shields.io/pypi/v/pyreball.svg)](https://pypi.python.org/pypi/pyreball)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Tests](https://github.com/karelvaculik/pyreball/actions/workflows/tests.yml/badge.svg)](https://github.com/karelvaculik/pyreball/actions/workflows/tests.yml)

</p>
Expand Down
1 change: 1 addition & 0 deletions docs/examples/custom_multi_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import altair as alt
import pandas as pd

import pyreball as pb

pb.set_title("Multi-figure Plots")
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/example_init_deps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import matplotlib.pyplot as plt
import pandas as pd
import pyreball as pb
import seaborn as sns

import pyreball as pb

pb.set_title("Tables and Figures")

df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 6, 5]})
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/plotting_bokeh.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pandas as pd
import pyreball as pb
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.plotting import figure

import pyreball as pb

df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 3, 6]})
df["x"] = df["x"].astype(str)
fig = figure(x_range=df["x"])
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plotting_matplotlib_png.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import matplotlib.pyplot as plt

import pyreball as pb

fig, ax = plt.subplots()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plotting_matplotlib_svg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import matplotlib.pyplot as plt

import pyreball as pb

fig, ax = plt.subplots()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plotting_plotly.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pandas as pd
import plotly.express as px

import pyreball as pb

df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 3, 6]})
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/plotting_seaborn.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import matplotlib.pyplot as plt
import pandas as pd
import pyreball as pb
import seaborn as sns

import pyreball as pb

df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 3, 6]})

fig, ax = plt.subplots()
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plotting_vega_altair.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import altair as alt
import pandas as pd

import pyreball as pb

df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 3, 6]})
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/references.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

import pyreball as pb
import seaborn as sns

pb.set_title("References to Figures and Tables")

Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_align.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_align_columns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_caption_position.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_captions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_datatables_definition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_multiindex.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_paging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_scrolling.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_searching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_simplest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_sorting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
1 change: 1 addition & 0 deletions docs/examples/table_styling.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd

import pyreball as pb

df = pd.DataFrame(
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ def define_env(env):
@env.macro
def inline_source(reference, language: str = "python"):
print("Reading reference:")
with open(reference, "r") as f:
with open(reference) as f:
file_content = f.read()
return f"```{language}\n{file_content}\n```"
7 changes: 0 additions & 7 deletions mypy.ini

This file was deleted.

Loading

0 comments on commit a3a2657

Please sign in to comment.