Skip to content

Commit

Permalink
packaging: Use Hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jan 1, 2024
1 parent 4f69fd8 commit e9ee8bc
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 1,585 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ updates:
- "edgarrmondragon"
commit-message:
prefix: "ci: "
groups:
actions:
patterns:
- "*"
8 changes: 2 additions & 6 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
pip==23.3.1
nox==2023.4.22
nox-poetry==1.0.3
poetry==1.7.1
poetry-dynamic-versioning==1.1.1
poetry-plugin-export==1.6.0
pip==23.3.2
hatch==1.9.1
44 changes: 14 additions & 30 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,30 @@
name: Publish with Dynamic Versioning
name: Build

on:
release:
types: [published]
push:

permissions:
contents: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hynek/build-and-inspect-python-package@v2

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
environment: publishing
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python
uses: actions/[email protected]
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
python-version: "3.10"

- name: Upgrade pip
run: |
pip install pip
pip --version
- name: Install Poetry
run: |
pipx install poetry
pipx inject poetry poetry-dynamic-versioning[plugin]
poetry --version
poetry self show plugins
- name: Build
run: poetry build

name: Packages
path: dist
- name: Upload wheel to release
uses: svenstaro/upload-release-action@v2
with:
Expand Down
56 changes: 31 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,64 @@
### A CI workflow template that runs linting and python testing

name: Test tap-bitso

on:
push:
branches: [ main ]
paths:
- tap_bitso/**
- tests/**
- pyproject.toml
- .github/workflows/test.yml
- .github/workflows/constraints.tx
pull_request:
branches: [ main ]
paths:
- tap_bitso/**
- tests/**
- pyproject.toml
- .github/workflows/test.yml
- .github/workflows/constraints.tx
schedule:
- cron: "0 10 * * *"
workflow_dispatch:

jobs:
tests:
runs-on: ubuntu-latest
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
NOXSESSION: tests-${{ matrix.python-version }}
FORCE_COLOR: "1"
PIP_CONSTRAINT: .github/workflows/constraints.txt
strategy:
fail-fast: false
matrix:
script: ["test:integration"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- { script: "test:dependencies", python-version: "3.11" }
- { script: "typing:check", python-version: "3.11" }

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

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

- name: Upgrade pip
run: |
pip install pip
pip --version
- name: Install Poetry
run: |
pipx install poetry
pipx inject poetry poetry-plugin-export
pipx inject poetry poetry-dynamic-versioning
poetry --version
- name: Install Nox
run: |
pipx install nox
pipx inject nox nox-poetry
nox --version
- name: Check Types
- name: Install Hatch
run: |
nox -s mypy-${{ matrix.python-version }}
pipx install hatch
hatch --version
- name: Run Tests
- name: Run
env:
TAP_BITSO_KEY: ${{ secrets.TAP_BITSO_KEY }}
TAP_BITSO_SECRET: ${{ secrets.TAP_BITSO_SECRET }}
run: |
nox -s tests-${{ matrix.python-version }}
hatch run ${{ matrix.script }}
44 changes: 25 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,30 @@ ci:
autoupdate_commit_msg: "ci(deps-dev): pre-commit autoupdate"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-json
exclude: "\\.vscode/.*.json"
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-json
exclude: "\\.vscode/.*.json"
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
exclude: "plugins/.*/.*\\.lock"
- id: trailing-whitespace

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.5.3"
hooks:
- id: pyproject-fmt
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.5.3"
hooks:
- id: pyproject-fmt

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit
rev: v3.6.0
hooks:
- id: validate_manifest
56 changes: 0 additions & 56 deletions noxfile.py

This file was deleted.

34 changes: 34 additions & 0 deletions plugins/loaders/target-jsonl--andyh1203.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"plugin_type": "loaders",
"name": "target-jsonl",
"namespace": "target_jsonl",
"variant": "andyh1203",
"label": "JSON Lines (JSONL)",
"docs": "https://hub.meltano.com/loaders/target-jsonl--andyh1203",
"repo": "https://github.com/andyh1203/target-jsonl",
"pip_url": "target-jsonl",
"description": "JSONL loader",
"logo_url": "https://hub.meltano.com/assets/logos/loaders/jsonl.png",
"settings": [
{
"name": "destination_path",
"kind": "string",
"value": "output",
"label": "Destination Path",
"description": "Sets the destination path the JSONL files are written to, relative\nto the project root.\n\nThe directory needs to exist already, it will not be created\nautomatically.\n\nTo write JSONL files to the project root, set an empty string (`\"\"`).\n"
},
{
"name": "do_timestamp_file",
"kind": "boolean",
"value": false,
"label": "Include Timestamp in File Names",
"description": "Specifies if the files should get timestamped.\n\nBy default, the resulting file will not have a timestamp in the file name (i.e. `exchange_rate.jsonl`).\n\nIf this option gets set to `true`, the resulting file will have a timestamp associated with it (i.e. `exchange_rate-{timestamp}.jsonl`).\n"
},
{
"name": "custom_name",
"kind": "string",
"label": "Custom File Name Override",
"description": "Specifies a custom name for the filename, instead of the stream name.\n\nThe file name will be `{custom_name}-{timestamp}.jsonl`, if `do_timestamp_file` is `true`.\nOtherwise the file name will be `{custom_name}.jsonl`.\n\nIf custom name is not provided, the stream name will be used.\n"
}
]
}
Loading

0 comments on commit e9ee8bc

Please sign in to comment.