Skip to content

Commit

Permalink
Switch to pyproject.toml entirely (#25)
Browse files Browse the repository at this point in the history
* Switch to pyproject.toml entirely

* Switch to latest setuptools-rust release

* README: Change minimum python version to 3.7
  • Loading branch information
jeliebig authored Sep 28, 2023
1 parent 0054a2b commit b9f1ed8
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 50 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -55,18 +55,19 @@ jobs:
runs-on: ubuntu-latest
name: Linux Wheels
steps:
# For tags we assume the version in setup.py is correct!
# For tags we assume the version in pyproject.toml is correct!
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
perl -i -pe "s/__version__\s*=\s*'(.*?)(\.rc.*|\.a.*|\.post.*)?'/__version__='\1.dev0+${GITHUB_SHA::8}'/" setup.py
sed -E -i -e "s/version\s*=\s*\"(.*)(\.rc.*|\.a.*|\.post.*)?\"/version = \"\1.dev0+${GITHUB_SHA::8}\"/;" pyproject.toml
- name: Note version
run: |
echo "PACKAGE_VERSION=$(python3 -- ./setup.py --version)" >> $GITHUB_ENV
PACKAGE_VERSION=$(grep "version" ./pyproject.toml | tr -d '"' | awk -F' ' '{print $3}')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -101,14 +102,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/')"
if: "!startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-11'"
shell: bash
run: |
sed -E -i '' -e "s/version\s*=\s*\"(.*)(\.rc.*|\.a.*|\.post.*)?\"/version = \"\1.dev0+${GITHUB_SHA::8}\"/;" pyproject.toml
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/') && matrix.os != 'macos-11'"
shell: bash
run: |
perl -i -pe "s/__version__\s*=\s*'(.*?)(\.rc.*|\.a.*|\.post.*)?'/__version__='\1.dev0+${GITHUB_SHA::8}'/" setup.py
sed -E -i -e "s/version\s*=\s*\"(.*)(\.rc.*|\.a.*|\.post.*)?\"/version = \"\1.dev0+${GITHUB_SHA::8}\"/;" pyproject.toml
- name: Note version
shell: bash
run: |
echo "PACKAGE_VERSION=$(python3 -- ./setup.py --version)" >> $GITHUB_ENV
PACKAGE_VERSION=$(grep "version" ./pyproject.toml | tr -d '"' | awk -F' ' '{print $3}')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
Expand All @@ -122,11 +129,11 @@ jobs:
architecture: ${{ matrix.arch }}
- name: Upgrade pip, install dev dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip wheel build
python -m pip install -r requirements.txt
- name: Build Python wheels
run: |
python setup.py bdist_wheel
python -m build
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Configcrunch
Configcrunch is a Python library written in Rust for reading YAML-based configuration files.
It aims to be simple and fast while also providing some very powerful features.

Configcrunch is compatible with Python 3.6 and up.
Configcrunch is compatible with Python 3.7 and up.

Install it via pip: ``pip install configcrunch``

Expand Down
39 changes: 38 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
[build-system]
requires = ["setuptools", "wheel", "setuptools-rust"]
requires = ["setuptools", "setuptools-rust"]
build-backend = "setuptools.build_meta"

[project]
name = "configcrunch"
version = "1.0.4"
description = "Configuration parser based on YAML-Files with support for variables, overlaying and hierarchies"
readme = "README.rst"
requires-python = ">=3.7"
license = {file = "LICENSE"}
authors = [
{name = "Marco Köpcke", email = "[email protected]"}
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Rust",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"schema >= 0.7"
]

[project.urls]
Repository = "https://github.com/theCapypara/configcrunch"
Documentation = "https://configcrunch.readthedocs.io"

[tool.setuptools.package-dir]
configcrunch = "configcrunch"

[[tool.setuptools-rust.ext-modules]]
target = "configcrunch._main"
39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

0 comments on commit b9f1ed8

Please sign in to comment.