Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
matrix:
include:
- { python-version: "3.8", tox-env: "py38" }
- { python-version: "3.9", tox-env: "py39" }
- { python-version: "3.10", tox-env: "py310" }
- { python-version: "3.11", tox-env: "py311" }
- { python-version: "3.12", tox-env: "py312,py312-type" }
- { python-version: "3.13", tox-env: "py313" }
name: Python ${{ matrix.python-version }} tests
steps:
- uses: actions/checkout@v2
Expand All @@ -26,6 +26,6 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install dependencies
run: pip install -r requirements-dev.txt
run: pip install .[dev]
- name: Run tests and type checking
run: tox -e ${{matrix.tox-env }}
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ All the type annotations in the following cells will be type checked.
## Local Development / Testing

- Create and activate a virtual environment
- Run `pip install -r requirements-dev.txt` to do an editable install
- Run `pip install -e .[dev]` to do an editable install
- Run `pytest` to run tests

## Type Checking
Expand All @@ -31,19 +31,13 @@ Run `mypy .`

## Create and upload a package to PyPI

Make sure to bump the version in `setup.cfg`.
Make sure to bump the version in `__init__.py`.

Then run the following commands:

```bash
rm -rf build dist
python setup.py sdist bdist_wheel
```

Then upload it to PyPI using [twine](https://twine.readthedocs.io/en/latest/#installation):

```bash
twine upload dist/*
hatch build -t wheel
hatch publish
```

## Credits
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini

This file was deleted.

82 changes: 82 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "ipython-beartype"
dynamic = ["version"]
description = "IPython extension type-checking IPython environments with beartype."
readme = "README.md"
requires-python = ">=3.9"
urls = {homepage = "https://github.com/beartype/ipython-beartype"}
authors = [
{name="Tushar Sadhwani",email="tushar.sadhwani000@gmail.com"}
]
license = {file="LICENSE"}
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Typing :: Typed"
]
dependencies = [
"beartype",
# 8 came out > 4 years ago so seems reasonable for backwards compatibility
"IPython>=8.0.0"
]

[tool.hatch.build.targets.wheel]
include = [
"/src/ipython_beartype/**",
]
packages = [
"src/ipython_beartype",
]

[tool.hatch.build.targets.sdist]
include = [
".gitignore",

"/README.md",
"/LICENSE",
"/pyproject.toml",
"/tox.ini",

"/src/ipython_beartype/**",
"/tests/**"
]


[project.optional-dependencies]
dev = [
"ruff",
"mypy",
"pytest",
"pytest-cov",
"tox",
]

[tool.hatch.version]
path = "src/ipython_beartype/__init__.py"
variable = "__version__"

[tool.pytest]
addopts = [
"--cov",
"--cov-report=term-missing"
]

[tool.mypy]
strict = "True"
exclude = [
"setup.py",
"venv",
"build"
]
1 change: 0 additions & 1 deletion requirements-dev.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

52 changes: 0 additions & 52 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

7 changes: 4 additions & 3 deletions src/ipython_beartype/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""IPython extension type-checking IPython environments with beartype."""

from beartype.claw._ast.clawastmain import BeartypeNodeTransformer
from beartype._conf.confcls import BeartypeConf
from IPython.terminal.interactiveshell import InteractiveShell
from beartype import BeartypeConf
from IPython.core.interactiveshell import InteractiveShell

__version__ = "0.1.0"

def load_ipython_extension(ipython: InteractiveShell) -> None:
# The import is local to avoid degrading import times when the magic is
Expand Down Expand Up @@ -31,4 +32,4 @@ def register_ipython_beartype(self, line: str) -> None:
)
)

ipython.register_magics(IPythonBeartypeMagics) # type: ignore[no-untyped-call]
ipython.register_magics(IPythonBeartypeMagics)
8 changes: 7 additions & 1 deletion tests/ipython_beartype_test.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# TODO
import ipython_beartype
import pytest

def test_smoke()->None:
"""Smoke test for the ipython_beartype package."""
assert ipython_beartype.__version__ is not None, "Version should not be None"
assert hasattr(ipython_beartype, "load_ipython_extension"), "Function should exist"
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist = py38,py39,py310,py311,py312,py312-type
envlist = py{39,310,311,312,312-type, 313}

[testenv]
deps = -rrequirements-dev.txt
commands = pytest
deps = .[dev]
commands = pytest {toxinidir}/tests

[testenv:py312-type]
description = Type check with mypy
Expand Down