Skip to content

Commit

Permalink
More improvements to actions (#83)
Browse files Browse the repository at this point in the history
* Define version number in pyproject.toml

* Add uv lockfile to gitignore

* Restructure package into src layout

* Make version numbers variables

* Fix publishing action

* Redefine optional dependency groups

* Update CLI docs to use new src layout

* Update to codecov-action v5
  • Loading branch information
sethaxen authored Nov 21, 2024
1 parent 95ab720 commit 4fea3d6
Show file tree
Hide file tree
Showing 53 changed files with 42 additions and 37 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
test:
name: Python ${{ matrix.python-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
uv_version: "0.5.2"
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ['3.9', '3.12']
python-version: ["3.9", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v2
Expand All @@ -27,12 +29,12 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.5.2"
version: ${{ env.uv_version }}
- name: Install the project
run: uv sync --all-extras --dev --python ${{ matrix.python-version }}
run: uv sync --extra test --python ${{ matrix.python-version }}
- name: Run tests
run: uv run pytest --cov=e3fp --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
30 changes: 19 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
name: Publish package to PyPI
name: Publish

on:
release:
types:
- published

jobs:
deploy:
build-test:
runs-on: ubuntu-latest
env:
uv_version: "0.5.2"
python_version: "3.12"
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.5.2"
version: ${{ env.uv_version }}
- name: Build the project
run: uv build --no-sources
run: uv build --no-sources --python ${{ env.python_version }}
- name: Sync only the test dependencies
run: uv sync --no-install-project --extra test
- name: Install and test source distribution
run: |
uv pip install dist/*.tar.gz
uv run --no-sync pytest
uv pip uninstall e3fp
- name: Install and test wheel
run: |
uv pip install dist/*.whl
uv run --no-sync pytest
- name: Publish to PyPI
run: uv publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
- name: Test package installation
run: uv run --with e3fp --no-project -- python -c "import e3fp"
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ doc/_build/*
*egg*
*.pyc
*.so
*.o
*.o
uv.lock
2 changes: 1 addition & 1 deletion doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Option 3: Install from source

.. code:: bash
$ uv sync --all-extras --dev
$ uv sync --extra dev
Testing
-------
Expand Down
8 changes: 4 additions & 4 deletions doc/source/usage/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Conformer Generation CLI

To see all available options, run

.. command-output:: python $E3FP_REPO/e3fp/conformer/generate.py --help
.. command-output:: python $E3FP_REPO/src/e3fp/conformer/generate.py --help
:shell:

We will generate conformers for the molecule whose SMILES string is defined in
Expand All @@ -26,7 +26,7 @@ The below example generates at most 3 conformers for this molecule.

.. code-block:: shell-session
$ python $E3FP_REPO/e3fp/conformer/generate.py -s caffeine.smi --num_conf 3 -o ./
$ python $E3FP_REPO/src/e3fp/conformer/generate.py -s caffeine.smi --num_conf 3 -o ./
2017-07-17 00:11:05,743|WARNING|Only 1 processes available. 'mpi' mode not available.
2017-07-17 00:11:05,748|INFO|num_proc is not specified. 'processes' mode will use all 8 processes
2017-07-17 00:11:05,748|INFO|Parallelizer initialized with mode 'processes' and 8 processors.
Expand Down Expand Up @@ -54,14 +54,14 @@ Fingerprinting CLI

To see all available options, run

.. command-output:: python $E3FP_REPO/e3fp/fingerprint/generate.py --help
.. command-output:: python $E3FP_REPO/src/e3fp/fingerprint/generate.py --help
:shell:

To continue the above example, we will fingerprint our caffeine conformers.

.. code-block:: shell-session
$ python $E3FP_REPO/e3fp/fingerprint/generate.py caffeine.sdf.bz2 --bits 1024
$ python $E3FP_REPO/src/e3fp/fingerprint/generate.py caffeine.sdf.bz2 --bits 1024
2017-07-17 00:12:33,797|WARNING|Only 1 processes available. 'mpi' mode not available.
2017-07-17 00:12:33,801|INFO|num_proc is not specified. 'processes' mode will use all 8 processes
2017-07-17 00:12:33,801|INFO|Parallelizer initialized with mode 'processes' and 8 processors.
Expand Down
5 changes: 0 additions & 5 deletions e3fp/__init__.py

This file was deleted.

17 changes: 6 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "e3fp"
dynamic = ["version"]
version = "1.2.6"
requires-python = ">=3.9, <3.13"
description = "Molecular 3D fingerprinting"
readme = "README.rst"
Expand Down Expand Up @@ -47,28 +47,23 @@ optional = [
test = [
"mock",
"pytest",
"e3fp[optional]",
]
dev = [
"e3fp[test]",
"pytest-cov",
"e3fp[optional]",
]
docs = [
"sphinx",
"sphinxcontrib-programoutput",
"sphinx-rtd-theme",
]
dev = [
"e3fp[docs]",
"e3fp[test]",
]

[project.urls]
Homepage = "https://github.com/keiserlab/e3fp"
Download = "https://github.com/keiserlab/e3fp/tarball/{version}"

[tool.setuptools.packages.find]
include = ["e3fp", "e3fp.*"]

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

[tool.pytest.ini_options]
addopts = "-ra -q"
testpaths = ["e3fp/test"]
Expand Down
4 changes: 4 additions & 0 deletions src/e3fp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import importlib.metadata
from .util import E3FPWarning, E3FPDeprecationWarning

__version__ = importlib.metadata.version("e3fp")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4fea3d6

Please sign in to comment.