Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Migrate package installation to pyproject.toml (PEP 621) #54

Merged
merged 11 commits into from
Dec 12, 2022

Conversation

Ambro17
Copy link
Contributor

@Ambro17 Ambro17 commented Nov 19, 2022

Intro

Based on #52 and the suggestion of the andrew-d to inspire the solution on starlette's setup and the apparent inactivity of the PR, i port the installation of the lib to use the new packaging standards of using pyproject.toml and starlette's style. I modified the invoke tasks so you can release a new version with the same setup as before

Solution

First install dev dependencies with pip install .[dev]. Editable installs work from pip==21.3 so an editable install to iterate on refactors will also work. This is safer though because it avoid running tests with local changes and publishing another, not-tested version.
So with hatch how do we handle packaging tasks?

Build distribution artifacts (source and build)

hatch build

This will save a source and wheel artifact into the default folder dist/

Upload distribution artifacts

hatch publish

Run Tests

inv test

Bump the library version

inv bump minor/major/patch

Could be also replaced by https://hatch.pypa.io/latest/version/#updating if you prefer the hatch native way. If you do not, the above still works

Deploy a new version, enforcing a test run

inv deploy

It will interactively ask for your pypi creds

Let me know if you only want to offer a wheel artifacts or if there is any incompatibility with a platform. My educated guess is we won't since we're not using any platform-specific magic on the lib but i'm not the author so feel free to correct me

All tests pass using python3.7.15 virtualenv. I can try with the 3.8, 3.9, 3.10 and 3.11 too if you want. I noticed the invoke task api changed so i updated the tasks accordingly. Please tell me if you prefer to pin an older version of invoke to avoid this changes

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@Ambro17
Copy link
Contributor Author

Ambro17 commented Nov 29, 2022

@andrew-d can you review when you have time? Thanks!

multipart/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
@Ambro17
Copy link
Contributor Author

Ambro17 commented Dec 7, 2022

Adressed all comments. Can i have another look @Kludex @ofek? Thanks in advance

@Kludex
Copy link
Owner

Kludex commented Dec 8, 2022

cc @tomchristie

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Copy link

@ofek ofek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@tomchristie
Copy link
Collaborator

I'm happy to facilitate a release here, if that's what folks would like.

@tomchristie tomchristie merged commit 3e4db8e into Kludex:master Dec 12, 2022
@Kludex
Copy link
Owner

Kludex commented Dec 12, 2022

I'm happy to facilitate a release here, if that's what folks would like.

Thanks 👍

@tomchristie
Copy link
Collaborator

Do we need anything else before rolling a new release here?

@Kludex
Copy link
Owner

Kludex commented Dec 12, 2022

We need an analogous workflow to encode projects to release the package via pipeline.

@Ambro17
Copy link
Contributor Author

Ambro17 commented Dec 12, 2022

Thank you for merging 🙂

I'd be happy to contribute with another PR that sets up the release pipeline in case you're interested

@Kludex
Copy link
Owner

Kludex commented Dec 12, 2022

We are. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants