Skip to content

Commit

Permalink
switching to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Sep 29, 2024
1 parent 1a3cc9c commit d6bae65
Show file tree
Hide file tree
Showing 11 changed files with 766 additions and 103 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
# Install a specific version of uv.
version: "0.4.17"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.7.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install habanero
run: python -m pip install .
run: uv python install ${{ matrix.python-version }}
- name: Install the project
run: uv sync --all-extras --dev
- name: Tests
if: contains(fromJSON('["3.10.9", "3.11.1", "3.11.5", "3.12"]'), matrix.python-version)
run: pytest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ docs/_build/
src
.env
.env385

.venv
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
16 changes: 6 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ all: install
.PHONY: install test docs distclean dist upload

install:
python3 -m pip install .
uv pip install .

test:
python3 -m pytest --record-mode=once --cov-report term --cov=habanero test/
python -m pytest --record-mode=once --cov-report term --cov=habanero test/

test_no_vcr:
python3 -m pytest --disable-recording --cov-report term --cov=habanero test/
python -m pytest --disable-recording --cov-report term --cov=habanero test/

docs:
cd docs;\
Expand All @@ -22,22 +22,18 @@ clean:
rm -rf dist/* build/*

dist:
python3 -m build
python -m build

upload_test:
python3 -m twine upload --repository testpypi dist/*
python -m twine upload --repository testpypi dist/*

upload:
python3 -m twine upload --repository pypi dist/*
python -m twine upload --repository pypi dist/*

.PHONY: lint-fix
lint-fix:
source .env/bin/activate; \
pip3 install -q -r requirements-dev.txt; \
ruff check --select I --fix habanero

.PHONY: lint-check
lint-check:
source ./.env/bin/activate; \
pip3 install -q -r requirements-dev.txt
ruff check habanero
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,4 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/3": None}
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
79 changes: 77 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "habanero"
dynamic = ["version"]
description = "Low Level Client for Crossref Search API"
maintainers = [
{name = "Scott Chamberlain", email = "myrmecocystus@gmail.com"}
]
readme = "README.rst"
license = {file = "docs/LICENSE.rst"}
requires-python = ">=3.12"
dependencies = [
"bibtexparser==2.0.0b7",
"pyyaml>=6.0.2",
"requests>=2.32.3",
"tqdm>=4.66.5",
"urllib3==2.2.0",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Homepage = "https://github.com/sckott/habanero"
Documentation = "https://habanero.readthedocs.io/"
Repository = "https://github.com/sckott/habanero"
"Bug Tracker" = "https://github.com/sckott/habanero/issues"
Changelog = "https://github.com/sckott/habanero/blob/main/Changelog.rst"

[tool.setuptools.dynamic]
version = {attr = "habanero.__version__"}

[tool.ruff]
line-length = 88
Expand All @@ -19,3 +64,33 @@ lint.ignore = [
"habanero/request_class.py" = ["E722"]
"test/*" = ["E501"]
"habanero/*" = ["E501"]

[tool.uv]
dev-dependencies = [
"docutils>=0.21.2",
"ruff>=0.6.8",
"sphinx>=8.0.2",
"sphinx-autodoc-typehints>=2.4.4",
"sphinxcontrib-issuetracker>=0.11",
"pytest>=8.3.3",
"pytest-cov>=5.0.0",
"codecov>=2.1.13",
"vcrpy>=5.1.0",
"pytest-recording",
"sphinx-rtd-theme==3.0.0rc3",
]

[tool.uv.sources]
pytest-recording = { git = "https://github.com/kiwicom/pytest-recording", rev = "128d134c77837d9f4eccbc0f2c08f50882af7e6a" }

# from https://github.com/pypa/setuptools/discussions/3627
[project.optional-dependencies]
bibtex = [
"bibtexparser==2.0.0b7",
]
test = [
"pytest",
]

[tool.setuptools.packages.find]
exclude = ["docs*", "test*"]
1 change: 0 additions & 1 deletion requirements-dev.txt

This file was deleted.

16 changes: 0 additions & 16 deletions requirements.txt

This file was deleted.

58 changes: 0 additions & 58 deletions setup.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions setup.py

This file was deleted.

Loading

0 comments on commit d6bae65

Please sign in to comment.