Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Aug 21, 2024
1 parent bd296bd commit bcf5845
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 93 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [main]
workflow_dispatch:
env:
LATEST_PY_VERSION: '3.11'
LATEST_PY_VERSION: '3.12'
COVERAGE_ARGS: '--cov --cov-report=term --cov-report=xml'
XDIST_ARGS: '--numprocesses=auto'

Expand All @@ -26,9 +26,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: snok/[email protected]
with:
virtualenvs-in-project: true
- uses: yezz123/setup-uv@v4

# Cache packages per python version, and reuse until lockfile changes
- name: Cache python packages
Expand All @@ -39,11 +37,11 @@ jobs:
key: venv-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install -v -E all
run: uv sync

# Run tests with coverage report
- name: Run tests
run: poetry run pytest -rs -x -vv ${{ env.XDIST_ARGS }} ${{ env.COVERAGE_ARGS }}
run: uv run pytest -rs -x -vv ${{ env.XDIST_ARGS }} ${{ env.COVERAGE_ARGS }}

# Latest python version: send coverage report to codecov
- name: "Upload coverage report to Codecov"
Expand Down
25 changes: 7 additions & 18 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
required: false
default: ''
env:
LATEST_PY_VERSION: '3.11'
LATEST_PY_VERSION: '3.12'

jobs:
# Deploy stable builds on tags only, and pre-release builds from manual trigger ("workflow_dispatch")
Expand All @@ -27,30 +27,19 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.LATEST_PY_VERSION }}
- uses: snok/[email protected]
with:
virtualenvs-in-project: true
- uses: yezz123/setup-uv@v4

- name: Set pre-release version
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
env:
pre-release-suffix: ${{ github.event.inputs.pre-release-suffix || 'dev' }}
pre-release-version: ${{ github.event.inputs.pre-release-version || github.run_number }}
run: |
poetry version $(poetry version -s).${{ env.pre-release-suffix }}${{ env.pre-release-version }}
poetry version
PKG_VERSION=$(sed -n "s/^version\s*=\s*'\(.*\)'/\1/p")
DEV_VERSION=$PKG_VERSION.${{ env.pre-release-suffix }}${{ env.pre-release-version }}
echo "Setting version to $DEV_VERSION"
sed -i "s/^version\s*=.*/version='$DEV_VERSION'/" pyproject.toml
- name: Build package distributions
run: poetry build
run: uvx --from build pyproject-build --installer uv
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

# Notify Docker image repo that there's a new release available
#- name: Repository Dispatch
# if: ${{ startsWith(github.ref, 'refs/tags/v') }}
# uses: peter-evans/repository-dispatch@v1
# with:
# token: ${{ secrets.DOCKERHUB_TRIGGER_TOKEN }}
# repository: JWCook/pyinaturalist-notebook
# event-type: post-release
# client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ eggs
lib
lib64
parts
scratch
sdist
var
venv/
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Contributions are welcome, and they are greatly appreciated! Every
little bit helps, and credit will always be given.

## Installation
To set up for local development (requires [poetry](https://python-poetry.org)):
To set up for local development (requires [uv](https://docs.astral.sh/uv)):
```bash
$ git clone https://github.com/pyinat/pyinaturalist.git
$ cd pyinaturalist
$ poetry install -v -E docs
$ uv sync --all-extras
```

## Contribution Guidelines
Expand Down
134 changes: 67 additions & 67 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
[project]
name = "pyinaturalist"
version = "0.20.0"
description = "iNaturalist API client for python"
authors = [{ name = "Jordan Cook" }]
license = "MIT"
readme = "README.md"
name = 'pyinaturalist'
version = '0.20.0'
description = 'iNaturalist API client for python'
authors = [{ name = 'Jordan Cook' }]
license = 'MIT'
readme = 'README.md'
keywords = [
"inaturalist",
"biodiversity",
"conservation",
"citizen-science",
"community-science",
"api",
"api-client",
"data-model",
"requests",
'inaturalist',
'biodiversity',
'conservation',
'citizen-science',
'community-science',
'api',
'api-client',
'data-model',
'requests',
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Topic :: Software Development :: Libraries :: Python Modules',
'Typing :: Typed',
]
requires-python = ">=3.8"
requires-python = '>=3.8'
dependencies = [
"attrs>=21.2",
"keyring>=22.3",
"platformdirs>=2.6",
"python-dateutil>=2.0",
"requests>=2.25",
"requests-cache>=1.2",
"requests-ratelimiter>=0.5.1",
"rich>=10.9",
'attrs>=21.2',
'keyring>=22.3',
'platformdirs>=2.6',
'python-dateutil>=2.0',
'requests>=2.25',
'requests-cache>=1.2',
'requests-ratelimiter>=0.5.1',
'rich>=10.9',
]

[project.urls]
homepage = "https://github.com/pyinat/pyinaturalist"
repository = "https://github.com/pyinat/pyinaturalist"
documentation = "https://pyinaturalist.readthedocs.io"
homepage = 'https://github.com/pyinat/pyinaturalist'
repository = 'https://github.com/pyinat/pyinaturalist'
documentation = 'https://pyinaturalist.readthedocs.io'

# include = [
# { path = "*.md" },
# { path = "*.yml" },
# { path = "docs", format = "sdist" },
# { path = "examples", format = "sdist" },
# { path = "test", format = "sdist" }
# { path = '*.md' },
# { path = '*.yml' },
# { path = 'docs', format = 'sdist' },
# { path = 'examples', format = 'sdist' },
# { path = 'test', format = 'sdist' }
# ]
# packages = [
# { include = "pyinaturalist" },
# { include = "pyinat" },
# { include = 'pyinaturalist' },
# { include = 'pyinat' },
# ]


[project.optional-dependencies]
# Optional dependencies
all = [
"filelock>2.0",
"ujson>5.0",
'filelock>2.0',
'ujson>5.0',
]

# Documentation dependencies needed for Readthedocs builds
docs = [
"furo~=2024.4",
"ipython~=8.12",
"linkify-it-py~=2.0",
"matplotlib>=3.7",
"myst-parser>=1.0",
"nbsphinx~=0.9",
"pillow>=10.1",
"sphinx~=6.2",
"sphinx-automodapi~=0.15",
"sphinx-autodoc-typehints==1.20",
"sphinx-copybutton>=0.5",
"sphinx-design>=0.5",
"sphinxcontrib-apidoc~=0.3",
"sphinxext-opengraph>=0.9",
'furo~=2024.4',
'ipython~=8.12',
'linkify-it-py~=2.0',
'matplotlib>=3.7',
'myst-parser>=1.0',
'nbsphinx~=0.9',
'pillow>=10.1',
'sphinx~=6.2',
'sphinx-automodapi~=0.15',
'sphinx-autodoc-typehints==1.20',
'sphinx-copybutton>=0.5',
'sphinx-design>=0.5',
'sphinxcontrib-apidoc~=0.3',
'sphinxext-opengraph>=0.9',
]

[tool.uv]
dev-dependencies = [
"coverage>=7.2",
"nox~=2024.4",
"pre-commit~=3.5",
"pretty-errors>=1.2",
"pytest~=8.2",
"pytest-asyncio>=0.21",
"pytest-cov>=3.0",
"pytest-xdist>=2.2",
"requests-mock~=1.8",
"sphinx-autobuild>=2021.3",
'coverage>=7.2',
'nox~=2024.4',
'pre-commit~=3.5',
'pretty-errors>=1.2',
'pytest~=8.2',
'pytest-asyncio>=0.21',
'pytest-cov>=3.0',
'pytest-xdist>=2.2',
'requests-mock~=1.8',
'sphinx-autobuild>=2021.3',
]

[build-system]
Expand Down Expand Up @@ -128,7 +128,7 @@ files = ['pyinaturalist']

[tool.pytest.ini_options]
markers = [
"enable_client_session: Enable all ClientSession features: caching, rate-limiting, etc.",
'enable_client_session: Enable all ClientSession features: caching, rate-limiting, etc.',
]

[tool.ruff]
Expand Down

0 comments on commit bcf5845

Please sign in to comment.