Skip to content

Commit

Permalink
Add infrastructure for PyPI.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed Mar 13, 2024
1 parent d439781 commit 5707f4a
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 1 deletion.
72 changes: 72 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: build_and_test

on:
push:
branches:
- main
tags:
- "*"
pull_request:

jobs:
build_and_test:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Build and install
run: |
python -m pip install --no-deps -v -e .
- name: Run tests
run: |
pytest -r a -v -n 3 --open-files --cov=tests --cov-report=xml --cov-report=term --cov-branch
- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml

pypi:
runs-on: ubuntu-latest
needs: [build_and_test]
if: startsWith(github.ref, 'refs/tags/')

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel build
- name: Build and create distribution
run: |
python -m build --skip-dependency-check
- name: Upload
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_UPLOADS }}
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,51 @@
[project]
name = "lsst-s3daemon"
description = "A daemon to maintain a connection pool for bursty S3 data transfers."
license = {text = "GPLv3+ License"}
readme = "README.md"
authors = [
{name="Rubin Observatory Data Management", email="dm-admin@lists.lsst.org"}
]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
keywords = ["lsst"]
dependencies = ["aiobotocore"]
dynamic = ["version"]
requires-python = ">=3.11.0"

[project.urls]
"Homepage" = "https://github.com/lsst-dm/s3daemon"

[project.optional-dependencies]
test = [
"moto >= 1.3,!=5.0.0",
"pytest >= 3.2",
"pytest-openfiles >= 0.5.0",
]

[build-system]
requires = ["setuptools>=60", "setuptools-scm>=8.0", "wheel"]

[tool.black]
line-length = 110
target-version = ["py311"]

[tool.coverage.report]
show_missing = true
exclude_lines = [
"pragma: no cover",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

[tool.isort]
profile = "black"
line_length = 110
Expand All @@ -16,6 +60,9 @@ convention = "numpy"
# not fit on one line. We do not require docstrings in __init__ files (D104).
add-ignore = ["D107", "D105", "D102", "D100", "D200", "D205", "D400", "D104"]

[too.pytest.ini_options]
addopts = "--import-mode=importlib" # Recommended as best practice

[tool.ruff]
line-length = 110
target-version = "py311"
Expand Down Expand Up @@ -51,3 +98,13 @@ max-doc-length = 79

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.setuptools.packages.find]
where = ["python"]

[tool.setuptools]
zip-safe = true
license-files = ["COPYRIGHT", "LICENSE"]

[tool.setuptools_scm]
version_file = "python/s3daemon/_version.py"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aiobotocore
aiobotocore >= 2.12.0

0 comments on commit 5707f4a

Please sign in to comment.