Skip to content

Commit

Permalink
Merge pull request #764 from Debilski/build/pyproject
Browse files Browse the repository at this point in the history
Removes the setup.py script in favour of a flit-based pyproject.toml
  • Loading branch information
Debilski authored Aug 25, 2023
2 parents 756bd7b + 4332f46 commit 0176b15
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 99 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/push_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
python -c "import zmq; print('Using pyzmq {} and zmq {}.'.format(zmq.pyzmq_version(), zmq.zmq_version()))"
- name: Test with pytest
run: |
python -m pytest --cov=./pelita/ test/
python -m pytest -v --cov=./pelita/ test/
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
with:
Expand All @@ -56,7 +56,7 @@ jobs:
cd ..
git clone https://github.com/ASPP/pelita_template
cd pelita_template
python -m pytest .
python -m pytest -v .
coveralls:
Expand All @@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, "3.10"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand All @@ -101,10 +101,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all history and tags (needed for git describe)
- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'
- name: Install sphinx and prepare repo
run: |
python -m pip install --upgrade pip
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
- name: Set up Python 3.1
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.11'

- name: Install pypa/build
run: python -m pip install build --user
- name: Install flit
run: python -m pip install flit

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/
run: flit build

- name: Publish distribution to Test PyPI
# We’d like to always publish to Test PyPI in order to spot errors with
# the publish step, however, this would require a new version each time
# we make a (test) release. For now, use the same logic for test as for
# the real release.
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
FLIT_INDEX_URL: https://test.pypi.org/legacy/

- name: Publish distribution to PyPI
# Only publish to main PyPI when it is a tagged release
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = [
"flit_core >=3.2,<4",
"pytest-runner",
]
build-backend = "flit_core.buildapi"

[project]
name = "pelita"
description = "Pelita"
keywords = ["education"]
license = {text = "BSD-2"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Education",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
urls = {Homepage = "https://github.com/ASPP/pelita"}
requires-python = ">= 3.9"
dependencies = [
"pyzmq",
"PyYAML",
"numpy",
"networkx",
"pytest>=4",
"zeroconf",
"rich",
]
dynamic = ["version"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.scripts]
pelita = "pelita.scripts.pelita_main:main"
pelita-tournament = "pelita.scripts.pelita_tournament:main"
pelita-tkviewer = "pelita.scripts.pelita_tkviewer:main"
pelita-player = "pelita.scripts.pelita_player:main"
pelita-createlayout = "pelita.scripts.pelita_createlayout:main"

[tool.aliases]
test = "pytest"

[tool.pytest.ini_options]
# addopts = --verbose
python_files = ["test/*.py"]

[tool.coverage.run]
relative_files = true
omit = [
"pelita/scripts/*",
"pelita/ui/*",
]
61 changes: 0 additions & 61 deletions setup.cfg

This file was deleted.

18 changes: 0 additions & 18 deletions setup.py

This file was deleted.

0 comments on commit 0176b15

Please sign in to comment.