-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major changes following best practices for packaging, publishing, tes…
…ting similar to sep005-io-fast package.
- Loading branch information
Showing
11 changed files
with
257 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI for Python package | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
if: ${{ ! contains(github.event.head_commit.message, 'Bumpversion') }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[dev] | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 ./sep005_io_ashes ./tests --count --max-line-length=127 --show-source --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest ./tests | ||
pytest --cov=./tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Publish release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python "3.12" | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build distribution | ||
run: | | ||
python -m build | ||
- name: Publish distribution | ||
uses: pypa/gh-action-pypi-publish@release/v1.8 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
|
||
release: | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: marvinpinto/action-automatic-releases@latest | ||
name: Release | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# noxfile.py | ||
import nox | ||
|
||
|
||
@nox.session(python="3.12") | ||
def tests(session): | ||
session.run("pip", "install", "-e", "./[dev]") | ||
session.run("pytest", "./tests") | ||
session.run("pytest", "--cov=./tests") | ||
|
||
|
||
@nox.session(python="3.12") | ||
def lint(session): | ||
session.install("flake8") | ||
session.run("flake8", "./sep005_io_ashes", "./tests", "--max-line-length=127") | ||
|
||
|
||
@nox.session(python="3.12") | ||
def format(session): | ||
session.install("isort", "black") | ||
session.run("isort", "./sep005_io_ashes", "./tests") | ||
session.run("black", "./sep005_io_ashes", "./tests") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "sep005-io-ashes" | ||
authors = [ | ||
{name = "Abdulelah Al-Ghuwaidi", email = "[email protected]"} | ||
] | ||
maintainers = [ | ||
{name = "Abdulelah Al-Ghuwaidi", email = "[email protected]"}, | ||
{name = "Arsen Melnikov", email = "[email protected]"} | ||
] | ||
description = "Transform Ashes .txt files with data into the data compliant with SDyPy SEP005" | ||
requires-python = ">=3.9" | ||
keywords = ["io", "Ashes", "SEP005"] | ||
license = {text = "MIT license"} | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12" | ||
] | ||
dynamic = [ | ||
"dependencies", | ||
"version", | ||
"readme" | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"black", | ||
"flake8", | ||
"isort", | ||
"nox", | ||
"pytest", | ||
"pytest-cov", | ||
"pytest-mock", | ||
"pytest-xdist" | ||
] | ||
|
||
[project.urls] | ||
Repository = "https://github.com/OWI-Lab/sep005-io-ashes" | ||
|
||
[tool.setuptools.dynamic] | ||
dependencies = {file = ["requirements.txt"]} | ||
version = {attr = "sep005_io_ashes.__version__"} | ||
readme = {file = "README.md", content-type = "text/markdown"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
version_old=$(git describe --tags --abbrev=0) | ||
if [ "$version_old" == "v$1" ]; then | ||
echo "Error: you did not change the version! Please check the __version__ in your __init__.py" | ||
exit 1 | ||
fi | ||
echo "Creating new release: $version_old -> v$1" | ||
git add . | ||
git commit -m "Bumpversion $version_old -> v$1" | ||
git push | ||
git tag -a "v$1" -m "Release v$1" | ||
git push origin "v$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = "0.0.1" | ||
|
||
from .ashes import read_ashes_file | ||
from .ashes import read_ashes_file # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.