Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release

on:
push:
# release on tag push
tags:
- '*'

jobs:
wheels:

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
PYTHONIOENCODING: utf-8
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, '3.10', '3.11', '3.12', '3.13']

steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install tox

- name: Build dist pkgs
run: |
tox -e build,check

- name: Upload artifacts
if: matrix.python-version == 3.9 && runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: wheels
path: |
./dist/*.whl
./dist/*.tar.gz

create_release:
name: Create Release
needs: [wheels]
runs-on: ubuntu-latest

steps:
- name: Get version
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo ${{ env.VERSION }}

- uses: actions/checkout@v4
with:
fetch-depth: 0

# download all artifacts to project dir
- uses: actions/download-artifact@v4

- name: Generate changes file
uses: sarnold/gitchangelog-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN}}

- name: Create release
id: create_release
uses: softprops/action-gh-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body_path: CHANGES.md
draft: false
prerelease: false
files: |
wheels/*.whl
wheels/*.tar.gz
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test

on:
workflow_dispatch:
pull_request:
push:
branches: [ master ]

jobs:
build:

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
PYTHONIOENCODING: utf-8
PIP_DOWNLOAD_CACHE: ${{ github.workspace }}/../.pip_download_cache
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, '3.10', '3.11', '3.12', '3.13']
steps:
- name: Set git crlf/eol
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions

- name: Lint with tox
run: tox -e lint

- name: Run tests
run: |
tox
env:
PLATFORM: ${{ matrix.os }}

- name: Build pkg
run: tox -e build,check
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -536,4 +536,4 @@ valid-metaclass-classmethod-first-arg=mcs

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
61 changes: 40 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=6.0",
]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["."]
include = ["tftpy"]
[tool.setuptools_scm]
version_scheme = "post-release"

[tool.pytest.ini_options]
minversion = "6.0"
log_cli = false
doctest_optionflags = ["ELLIPSIS", "NORMALIZE_WHITESPACE",]
addopts = "--strict-markers -rxX --tb=long --color=yes"
markers = "subscript"
testpaths = [
"tests/",
]

[project]
name = "tftpy"
version = "0.8.6"
authors = [
{ name="Michael Soulier", email="msoulier@digitaltorque.ca" },
[tool.coverage.run]
branch = true
source = [
"tftpy/",
".tox/py*/lib/python*/site-packages/",
]
description = "A TFTP protocol library for Python"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
omit = [
"tests/*",
".tox",
]
license = { text = "MIT" }

[project.urls]
Homepage = "https://github.com/msoulier/tftpy"
Issues = "https://github.com/msoulier/tftpy/issues"
[tool.coverage.paths]
source = ["tftpy"]

[tools.setuptools]
script-files = ["bin/tftpy_client.py", "bin/tftpy_server.py"]
[tool.coverage.report]
fail_under = 70
show_missing = true
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"raise AssertionError",
"if typing.TYPE_CHECKING:",
"if TYPE_CHECKING:",
]
omit = [
"doc*",
"tests/*",
]
82 changes: 82 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[metadata]
name = tftpy
version = attr: setuptools_scm.get_version
description = A TFTP protocol library for Python
url = https://github.com/msoulier/tftpy
author = Michael Soulier
author_email = msoulier@digitaltorque.ca
long_description = file: README.md
long_description_content_type = text/markdown
license_expression = MIT
license_files = LICENSE
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
Programming Language :: Python :: 3
Environment :: Console
Environment :: No Input/Output (Daemon)
Operating System :: OS Independent
Topic :: Internet
Topic :: Software Development
Topic :: Software Development :: Testing

project_urls =
Source = https://github.com/msoulier/tftpy.git
Issues = https://github.com/msoulier/tftpy/issues

[options]
python_requires =
>= 3.8

setup_requires =
setuptools_scm[toml]

install_requires =

packages =
tftpy

scripts =
bin/tftpy_client.py
bin/tftpy_server.py

[options.extras_require]
doc =
sphinx
sphinx_git
myst-parser
sphinx_rtd_theme<3.0
sphinxcontrib-apidoc
test =
pytest
pytest-cov
cov =
coverage[toml]
coverage_python_version
all =
%(cov)s
%(doc)s
%(test)s

[check]
metadata = true
restructuredtext = true
strict = false

[check-manifest]
ignore =
.gitattributes
.gitignore
.pre-commit-config.yaml

[flake8]
exclude =
.git,
__pycache__,
build,
dist,
doc,
docs,
tests

max-line-length = 90
2 changes: 2 additions & 0 deletions tests/test.py → tests/test_tftpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import logging
import os
import sys
import threading
import time
import unittest
Expand Down Expand Up @@ -643,6 +644,7 @@ def testDirectoriesWithSpaces(self):
else:
server.listen("localhost", 20001)

@unittest.skipUnless(sys.platform == "linux", "Linux only fcntl")
def testStdin(self):
cdir = os.path.dirname(os.path.abspath(__file__))
script = os.path.join(cdir, "stdin.py")
Expand Down
Loading
Loading