Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: pip
directory: /
schedule:
interval: weekly
16 changes: 16 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Auto-Release

on:
push:
branches:
- main

concurrency:
group: auto-release
cancel-in-progress: true

jobs:
release:
permissions:
contents: write
uses: owenvoke/semantic-release-config/.github/workflows/release.yml@f7423f9436c60a35f74e54dedfa5f80f848a5a10 # v1.3.0
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish

on:
release:
types:
- published

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
name: Publish to PyPI
steps:

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'

- name: Install Hatch
run: python3 -m pip install hatch

- name: Build package archive
run: hatch build

- name: Publish to PyPI
run: hatch publish --user '__token__' --auth '${{ secrets.PYPI_API_TOKEN }}'
56 changes: 36 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,52 @@
name: Tests

on: [ push, pull_request ]
on:
push:
branches:
- main
pull_request:

jobs:
tests:
name: Tests
permissions:
contents: read

jobs:
style:
runs-on: ubuntu-latest
name: Check style formatting
steps:

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.x'

env:
FORCE_COLOR: '1'
- name: Install Hatch
run: python3 -m pip install hatch

# Runs the Ruff version pinned in pyproject.toml, annotating PRs inline.
- name: Style Check
run: hatch run lint
env:
RUFF_OUTPUT_FORMAT: github

tests:
runs-on: ubuntu-latest
name: Tests
steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.10'
python-version: '3.11'

- name: Install Pip dependencies
run: pipx install hatch
- name: Install Hatch
run: python3 -m pip install hatch

- name: Run Tests
- name: Run tests
run: hatch run test

- name: Build package archive
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: hatch build

- name: Publish to PyPi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: hatch publish --user '__token__' --auth '${{ secrets.PYPI_API_TOKEN }}'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ from ecologi import Ecologi

ecologi = Ecologi()

sites = ecologi.impact('owenvoke')
sites = ecologi.impact("owenvoke")
```

| Available Methods | Description |
Expand Down
4 changes: 3 additions & 1 deletion ecologi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .ecologi import Ecologi, EcologiException, NotFoundException
from .ecologi import Ecologi as Ecologi
from .ecologi import EcologiException as EcologiException
from .ecologi import NotFoundException as NotFoundException
from .types import *
6 changes: 4 additions & 2 deletions ecologi/ecologi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Optional, cast
from __future__ import annotations

from typing import cast

import requests

Expand Down Expand Up @@ -35,7 +37,7 @@ def impact(self, username: str) -> Impact:
def get(self, url: str):
return self.__request("GET", url)

def __request(self, method: str, url: str, params: Optional[dict] = None):
def __request(self, method: str, url: str, params: dict | None = None):
if params is None:
params = {}

Expand Down
15 changes: 8 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python :: 3 :: Only",
]
requires-python = ">=3.9.0"
requires-python = ">=3.11.0"
dependencies = [
"requests>=2.28.1"
]
Expand All @@ -41,22 +41,23 @@ packages = ["ecologi"]

[tool.hatch.envs.default]
dependencies = [
"black",
"mypy",
"pytest==7.1",
"requests-mock==1.10",
"ruff==0.17.1",
"types-requests",
]

[tool.hatch.envs.default.scripts]
test = [
"black --check --diff .",
"mypy ecologi",
"pytest",
]
lint = [
"black ."
"ruff format --check --diff .",
"ruff check .",
]
fix = [
"ruff format .",
"ruff check --fix .",
]

[tool.black]
target-version = ["py39", "py310"]
1 change: 1 addition & 0 deletions tests/test_ecologi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests_mock

from ecologi import Ecologi

ecologi = Ecologi()
Expand Down
Loading