PythonCDT icon indicating copy to clipboard operation
PythonCDT copied to clipboard

Distribute PythonCDT in PyPI

Open mdealencar opened this issue 7 months ago • 4 comments
trafficstars

Hi @artem-ogre,

Thank you for the great work on the CDT library and bindings! I want to publish on PyPI my project https://gitlab.windenergy.dtu.dk/TOPFARM/OptiWindNet/, which uses PythonCDT. It happens that PyPI only allows projects whose requirements are all published there too.

This PR goes a long way towards publishing PythonCDT on PyPI, using Github Actions and cibuildwheel. I tested it by creating a PythonCDT project in TestPyPI: https://test.pypi.org/project/PythonCDT/.

You would need to create the project in production PyPI and enable your github repo and the workflow .yml file as a Trusted Publisher. Minor changes in buildpublish.yml are required. I can walk you through it if you are inclined to merge this.

mdealencar avatar Mar 27 '25 19:03 mdealencar

Hi, this is great. I always wanted to publish a pip package but never got to it. I will take a look this/next week. Thanks for the effort, Mauricio!

artem-ogre avatar Mar 27 '25 19:03 artem-ogre

I updated the workflow to point to production PyPI and to be triggered only manually or when a version tag is pushed ('v[0-9]+.[0-9]+.[0-9]+').

It is possible to have the build system fetch the tag for setting project.version's value instead of using a hard-coded one in pyproject.toml, but that is not pursued in this PR.

The only thing missing is setting up the project in PyPI:

  • login to your account
  • open "Your projects" -> "Publishing"
  • in "Add a new pending publisher" -> "GitHub":
    • PyPI Project Name: PythonCDT
    • Owner: artem-ogre
    • Repository name: PythonCDT
    • Workflow name: buildpublish.yml
    • Environment name: pypi
  • The "Add" button concludes the process.

After you push a new version tag to any branch, e.g. 'v0.0.1', the action will do its thing and the project will be published and ready for pip install PythonCDT.

mdealencar avatar Mar 28 '25 09:03 mdealencar

Hi, quick heads up: I will try to look at this PR this week.

artem-ogre avatar Apr 06 '25 14:04 artem-ogre

Meanwhile, I have made my fork available as condeltri on PyPI. I will gladly revert back to PythonCDT when the wheels are published.

pip install condeltri
import condeltri as cdt

mdealencar avatar Apr 09 '25 15:04 mdealencar

FYI:

PythonCDT is now available as condeltri both in PyPI and conda-forge:

  • pip install condeltri
  • conda install -c conda-forge condeltri

mdealencar avatar Nov 12 '25 17:11 mdealencar