Skip to content

Commit

Permalink
Merge pull request #48 from marmig0404/dev
Browse files Browse the repository at this point in the history
Migrate from setup.py to pyproject.toml
  • Loading branch information
cpederkoff authored Nov 11, 2022
2 parents c325fb0 + bd3494f commit 6e48bc7
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 103 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/python-lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python lint and test

on:
push:
branches:
- "**" # matches every branch
pull_request:
branches: [master]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --with dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: Run unittest
run: |
poetry run python -m unittest discover "test" -p 'test_*.py'
84 changes: 19 additions & 65 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,26 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: Build pypi package

on:
push:
branches:
- '**' # matches every branch
pull_request:
branches: [ master ]
tags: # on tags with versions
- "v*.*.*"

jobs:
build:

# https://github.com/actions/setup-python
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pep8-naming nose
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: Test with nose
run: |
nosetests test/
build-n-publish:
deploy:
runs-on: ubuntu-latest

# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@master
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build and publish
run: |
poetry version $(git describe --tags --abbrev=0)
poetry build
poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
poetry.lock

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "stl-to-voxel"
packages = [
{ include = "stltovoxel" },
]
version = "v0.0.0"
description = "Turn STL files into voxels, images, and videos"
readme = "README.md"
authors = ["Christian Pederkoff"]
license = "MIT"
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules"
]
keywords = ['numpy', 'Pillow', 'matplotlib', 'numpy-stl']
repository = "https://github.com/cpederkoff/stl-to-voxel"


[tool.poetry.dependencies]
python = "^3.8"
matplotlib = "^3.6"
numpy = "^1.13"
Pillow = "^9.3"
numpy-stl = "^2.17"

[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
flake8 = "^5.0.4"
pep8-naming = "^0.13.2"

[tool.poetry.scripts]
stltovoxel = "stltovoxel.__main__:main"
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

34 changes: 0 additions & 34 deletions setup.py

This file was deleted.

0 comments on commit 6e48bc7

Please sign in to comment.