Skip to content

Commit

Permalink
add a conda package (#132)
Browse files Browse the repository at this point in the history
This PR adds `astartes` to `conda` on [this
channel](https://anaconda.org/JacksonBurns/astartes) with a new GitHub
action for automatically building and uploading the package. I have also
manually gone back and added the current and previous releases to 1.0.0
to the channel.
  • Loading branch information
kspieks authored Jun 13, 2023
2 parents 485f66e + aaa96e6 commit 234d039
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 37 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/publish_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Publish Packages

on:
push:
branches: [ "main" ]
workflow_dispatch:

jobs:
check-for-new-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check PyPI version
uses: maybe-hello-world/pyproject-check-version@v3
id: versioncheck
with:
pyproject-path: "./pyproject.toml"

- name: Report Results
run: |
echo "New Release found? ${{ steps.versioncheck.outputs.local_version_is_higher }}"
echo "Local version: ${{ steps.versioncheck.outputs.local_version }}"
echo "Public version: ${{ steps.versioncheck.outputs.public_version }}"
outputs:
do_publish: ${{ steps.versioncheck.outputs.local_version_is_higher }}

pypi:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
needs: check-for-new-release
if: needs.check-for-new-release.outputs.do_publish
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
verbose: true
conda:
name: Build and publish Conda distrbutions
needs: pypi # wait for pypi build to finish
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0} # login bash for conda calls
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
- name: Install build dependencies
run: |
conda install conda-build anaconda-client
conda install -c conda-forge grayskull
conda config --set anaconda_upload yes
- name: Build and Push astartes
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
run: |
cd ..
sleep 60s # wait for the PyPI package to be visible
grayskull pypi astartes
cd astartes
conda build .
35 changes: 0 additions & 35 deletions .github/workflows/publish_to_pypi.yml

This file was deleted.

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ We recommend installing `astartes` within a virtual environment, using either `v
- To include the featurization options for chemical data, use `pip install astartes[molecules]`.
- To install only the sampling algorithms, use `pip install astartes` (this install will have fewer dependencies and may be more readily compatible in environments with existing workflows).

__Note for Windows Powershell or MacOS Catalina or newer__: On these systems the command line will complain about square brackets, so you will need to double quote the `molecules` command (i.e. `pip install "astartes[molecules]"`)
The base `astartes` package is also available on `conda` with this command: `conda install -c jacksonburns astartes`.
Note that this package _does not_ include built-in support for featurizing molecules, which is currently only available from the PyPI package or a source install.

> **Note**
> Windows Powershell and MacOS Catalina or newer may complain about square brackets, so you will need to double quote the `molecules` command (i.e. `pip install "astartes[molecules]"`)
To install `astartes` from source, see the [Contributing & Developer Notes](#contributing--developer-notes) section.

## Using `astartes`
`astartes` is designed as a drop-in replacement for `sklearn`'s `train_test_split` function. To switch to `astartes`, change `from sklearn.model_selection import train_test_split` to `from astartes import train_test_split`.
Expand Down Expand Up @@ -57,6 +63,8 @@ Click the badges in the table below to be taken to a live, interactive demo of `
| Cheminformatics sample set partitioning with `astartes` | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/JacksonBurns/astartes/main?labpath=examples%2Fbarrier_prediction_with_RDB7%2FRDB7_barrier_prediction_example.ipynb) |
| Comparing partitioning approaches for alkanes | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/JacksonBurns/astartes/main?labpath=examples%2Fmlpds_2023_astartes_demo%2Fmlpds_2023_demo.ipynb) |

To execute these notebooks locally, clone this repository (i.e. `git clone https://github.com/JacksonBurns/astartes.git`), navigate to the `astartes` directory, run `pip install .[demos]`, then open and run the notebooks in your preferred editor.

### Rational Splitting Algorithms
While much machine learning is done with a random choice between training/validation/test data, an alternative is the use of so-called "rational" splitting algorithms. These approaches use some similarity-based algorithm to divide data into sets. Some of these algorithms include Kennard-Stone, minimal test set dissimilarity, and sphere exclusion algorithms [as discussed by Tropsha et. al](https://pubs.acs.org/doi/pdf/10.1021/ci300338w) as well as the OptiSim as discussed in [Applied Chemoinformatics: Achievements and Future Opportunities](https://www.wiley.com/en-us/Applied+Chemoinformatics%3A+Achievements+and+Future+Opportunities-p-9783527806546). Some clustering-based splitting techniques have also been incorporated, such as [DBSCAN](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.1016.890&rep=rep1&type=pdf).

Expand Down Expand Up @@ -148,7 +156,8 @@ When submitting a PR, please mark your PR with the "PR Ready for Review" label w

To contribute to the `astartes` source code, start by cloning the repository (i.e. `git clone [email protected]:JacksonBurns/astartes.git`) and then inside the repository run `pip install -e .[molecules,dev]`. This will set you up with all the required dependencies to run `astartes` and conform to our formatting standards (`black` and `isort`), which you can configure to run automatically in vscode [like this](https://marcobelo.medium.com/setting-up-python-black-on-visual-studio-code-5318eba4cd00#:~:text=Go%20to%20settings%20in%20your,%E2%80%9D%20and%20select%20%E2%80%9Cblack%E2%80%9D.).

__Note for Windows Powershell or MacOS Catalina or newer__: On these systems the command line will complain about square brackets, so you will need to double quote the `molecules` command (i.e. `pip install -e ".[molecules,dev]"`)
> **Note**
> Windows Powershell and MacOS Catalina or newer may complain about square brackets, so you will need to double quote the `molecules` command (i.e. `pip install "astartes[molecules,dev]"`)
### Unit Testing
All of the tests in `astartes` are written using the built-in python `unittest` module (to allow running without `pytest`) but we _highly_ recommend using `pytest`. To execute the tests from the `astartes` repository, simply type `pytest` after running the developer install (or alternately, `pytest -v` for a more helpful output).
Expand Down

0 comments on commit 234d039

Please sign in to comment.