brentp / fishers_exact_test

Fishers Exact Test for Python (Cython)
BSD 3-Clause "New" or "Revised" License
62 stars 21 forks source link

Add `pyproject.toml` to fix `pip` install of setup dependencies #40

Closed althonos closed 10 months ago

althonos commented 10 months ago

Hi @brentp !

This small PR adds a pyproject.toml file to the repository, which can be used to instruct pip about the required setup dependencies when building fisher. This should fix #39, as pip would be able to figure out the build dependencies in advance thanks to this metadata file.

By the way, would you be interested in distributing wheels for the package? I would be happy to write a PR with GitHub Actions to compile the package for different targets using cibuildwheel, so that users don't have to compile on every install.

brentp commented 10 months ago

Thanks very much @althonos !

althonos commented 9 months ago

@brentp : Can you make a new release so that this is fixed on PyPI as well? Thanks :pray:

brentp commented 9 months ago

can you show how I would do this? I've not kept up to date with python packaging and I get errors following the instructions I can see. (python setup.py sdist upload doesn't work)

althonos commented 9 months ago

Ah yes, you'd need to use twine now, which can get a little more complicated since you also need to create an API token if you don't have one.

The other option is as I wrote earlier is to have a GitHub Actions that does this for you on every tagged commit, such as I have here, which also allows distribution of pre-compiled packages :smiley:

brentp commented 9 months ago

yes, I used twine and uploaded the dist, but as you'll see if you try to install the latest, it is (AFAICT) broken.

brentp commented 9 months ago

I'll see if I can copy your workflow

althonos commented 9 months ago

I'm having a look at the issue :+1:

brentp commented 9 months ago

started here: https://github.com/brentp/fishers_exact_test/actions/runs/6147824099

brentp commented 9 months ago

no I'm stuck on this: https://github.com/brentp/fishers_exact_test/actions/runs/6148231983/job/16681512157#step:5:2 it's installing the fisher from pypi

althonos commented 9 months ago

Ah I think that's because versioneer adds a local tag to the file and then pip refuses to use it, try updating with --pre:

python -m pip install --pre --no-binary fisher --find-links=dist fisher
brentp commented 9 months ago

Wow. I never would have figured this out.

brentp commented 9 months ago

Looks like it's working. I'll use this as a template for my other projects! Thanks very much. I'll make sure the wheels are updated by tomorrow if that part fails.

althonos commented 9 months ago

You'll need to add this repo as a trusted published on PyPI (https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/) so that it has the permission to upload the wheels :+1:

brentp commented 9 months ago

I think I had that set up correctly. It seems to be something with the tagging? https://github.com/brentp/fishers_exact_test/actions/runs/6148536650/job/16682799005

althonos commented 9 months ago

Ah yes it looks like versioneer is not playing nice with cibuildwheel

althonos commented 9 months ago

This looks related: https://github.com/python-versioneer/python-versioneer/issues/206 Maybe try updating the checkout with:

- uses: actions/checkout@v3
  with:
    fetch-depth: 0