Giter Club home page Giter Club logo

Comments (6)

nokome avatar nokome commented on May 29, 2024 1

After a change has been made to the build approach it should be tested as part of the release workflow in .github/workflows/release.yml (although I'm assuming that it will work fine because we are only maturin there ?). You can do that by going to https://github.com/stencila/stencila/actions/workflows/release.yml and only turning on Python SDK builds (for the current tag v2.0.0-alpha.23)

image

from stencila.

nokome avatar nokome commented on May 29, 2024

Thanks Simon. @brettc I wonder if you could look at this and make a PR that improves the docs and/or refines the Python DX.

from stencila.

brettc avatar brettc commented on May 29, 2024

I had a look over this. I think there are bigger issues about poetry. Here are my first thoughts (looking for feedback).

Poetry is great for developing python projects, but has poor support for extensions. It is currently a bit of a hack.

I have written my own "build.py" script for the c++ extension to deal with this.

In the current setup, this means that poetry does not really know about maturin. A "poetry install" will not work, as it does not call the maturin build. (Actually, it currently just breaks because it does not know where the package is, but that can be fixed).

Possible paths ahead:

  1. Ignore these issues and just say in the docs you need poetry installed.
  2. Write a "build.py" script that correctly invokes maturin.
  3. Get rid of poetry and use some of the newer, standard python building tools.

For 3, I'm thinking we could save ourselves a lot of trouble by looking at the current version of pydantic-core (the rust based support for pydantic 2.0). It has the same layout, uses Makefiles, and has much of the funtionality desired, without using poetry.

Thoughts?

from stencila.

nokome avatar nokome commented on May 29, 2024

Get rid of poetry and use some of the newer, standard python building tools.

This seems like the right approach (I thought Poetry was the best, maybe it was, but now isn't 😕 ) and yep, copying what the other projects using maturin are doing is a good idea. I think that I started doing that but things seemed over complicated and I went for the simplest approach that would work to get robust release builds:

# Build Python SDK
# Based on https://github.com/messense/py-dissimilar/blob/main/.github/workflows/CI.yml
build-python:
if: ${{ inputs.build-python }}
needs: [create-release]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
architecture: x64
target: x64
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: ubuntu-latest
architecture: x64
target: x64
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: macos-latest
architecture: x64
target: x64
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: macos-latest-xlarge

But all done quite hastily, and probably easily improved. If you think you can do that reasonably quickly, then go for it. I can show you how to run the workflow on GH Actions (without actually creating a release).

from stencila.

nokome avatar nokome commented on May 29, 2024

I had another fairly quick look at this issue, some of the alternatives, and at pydantic-core and agree with this:

For 3, I'm thinking we could save ourselves a lot of trouble by looking at the current version of pydantic-core (the rust based support for pydantic 2.0). It has the same layout, uses Makefiles, and has much of the funtionality desired, without using poetry.

My only ask is that we keep things as simple as possible (But No Simpler ™️ ): acknowledging from the outset that dropping poetry will immediately simplify things.

from stencila.

brettc avatar brettc commented on May 29, 2024

Further investigation:

  • l looked at copying the maturin setup from pydantic-core, which has some similarities.
  • It was unclear to me how they pinned their non-dev dependencies (I think there just are not that many). But this is something that I suspect we will want to do, if the python library starts supporting plugins and other niceties.
  • Pinning, and especially updating the pinned dependencies, is non-trivial. Poetry (and also PDM) provides solutions to this problem. A simple pip freeze does not.
  • So, for the ease of our futures selves, for now, we are going to stick with poetry, cos it is already there, and it mostly works (I have added one tiny fix that cause poetry install issues in #1851).
  • The remaining problem is that you need to manually run maturin because poetry will not do it for you. But the makefile does the right thing.

TLDR: if you are a developer, you need poetry installed. Use the makefile commands to build and test.
We can revisit the building in the future, but I think we should close this issue @nokome

from stencila.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.