Skip to content

Commit

Permalink
Migrate from setup.cfg to pyproject.toml (#107)
Browse files Browse the repository at this point in the history
* Migrate the Python package information from `setup.cfg` to `pyproject.toml`.

* fix document
  • Loading branch information
azriel1rf authored May 7, 2024
1 parent b2eebdd commit ca8b5ab
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 52 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ repos:
- id: remove-crlf
- id: remove-tabs

# Formatting for Python configuration files
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt

# Linting and formatting for C++
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ The following checks are performed:
* Python type checking with `mypy` for Python 3.8
* Python package installation for Python 3.8 to 3.11
* Pre-commit checks:
* Check `setup.cfg` (if modified)
* Lint Python files with `Ruff` according to the configuration in `pyproject.toml`
(if any Python files are modified, check all Python files)

Expand Down
36 changes: 26 additions & 10 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,11 @@ To ensure a smooth contribution process, please follow the guidelines below.

#### Option 2: Setup without pre-commit

* Install `Ruff`:
Install development dependencies:

```shell
pip install ruff
```

* Install `mypy`:

```shell
pip install mypy
```
```shell
pip install '.[dev]'
```

### Checking Changes

Expand Down Expand Up @@ -155,6 +149,28 @@ type checker, and unit tests.
python3 -m unittest discover -v
```

### Building the Package

To build the package, run the following command:

```shell
python -m build
```

This will create a `dist` folder containing the built package.

Install the built package for testing:

```shell
pip install dist/*.whl
```

Check whether your distribution's long description will render correctly on PyPI:

```shell
python -m twine check dist/*
```

Please ensure that your code passes all the checks and tests before submitting a
pull request. If you have any questions, need further assistance, or want to report
a bug or suggest an enhancement, feel free to [open an issue](https://github.com/HenryRLee/PokerHandEvaluator/issues).
58 changes: 57 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,62 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "wheel"]

[project]
name = "phevaluator"
version = "0.5.3.1"
requires-python = ">=3.8, <4"
authors = [
{name = "Henry Lee", email = "lee0906@hotmail.com"}
]
maintainers = [
{name = "azriel1rf", email = "azriel.1rf@gmail.com"}
]
description = "PH Evaluator - an efficient Poker Hand Evaluator based on a Perfect Hash algorithm"
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE"}
keywords = ["poker", "texas-holdem", "poker-evaluator"]
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries",
]

[project.urls]
Homepage = "https://github.com/HenryRLee/PokerHandEvaluator"
# TODO(@azriel1rf): Add a link to documentation for Python after it's published
# https://github.com/HenryRLee/PokerHandEvaluator/issues/105
Documentation = "https://github.com/HenryRLee/PokerHandEvaluator/tree/master/Documentation"
Repository = "https://github.com/HenryRLee/PokerHandEvaluator"
Issues = "https://github.com/HenryRLee/PokerHandEvaluator/issues"
# TODO(@azriel1rf): Add a link to the changelog after it's published
# https://github.com/HenryRLee/PokerHandEvaluator/issues/106
Changelog = "https://github.com/HenryRLee/PokerHandEvaluator/tags"
Source = "https://github.com/HenryRLee/PokerHandEvaluator/tree/master/python"

[project.optional-dependencies]
dev = [
"mypy",
"ruff",
"twine",
]

[tool.setuptools]
include-package-data = true

[tool.setuptools.package-data]
phevaluator = ["tables/*.dat"]

[tool.mypy]
exclude = ["phevaluator/tables/"]
Expand Down
34 changes: 0 additions & 34 deletions python/setup.cfg

This file was deleted.

0 comments on commit ca8b5ab

Please sign in to comment.