Skip to content

Migrate build and setup from setup.py to pyproject.toml #52

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

Closed
wants to merge 1 commit into from

Conversation

axelfauvel
Copy link

As discussed in #37

Here is the first part towards automating the release process. You can now run the following code to build the package :

pip install --upgrade build
python -m build

This will generate both .whl and .tar.gz files, last step will be to publish them to pypi using twine.

What is in this PR ?

  • Move dependencies setup from requirements.txt & setup.py to pyproject.toml
  • Extract __version__ from package to pyproject.toml
  • Move doc dependencies to pyproject.toml

@axelfauvel axelfauvel mentioned this pull request Nov 3, 2022
@axelfauvel axelfauvel force-pushed the move-to-pyproject.toml branch from e6bf2e0 to e23e955 Compare November 3, 2022 16:09
@@ -1 +1,3 @@
__version__ = '0.0.5'
import pkg_resources
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use the newer importlib.metadata instead?

@@ -0,0 +1,71 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't choose setuptools as the build backend as it has to support many legacy workflows that prevent innovations in other tools. I would propose hatchling.build as the official tutorial does https://packaging.python.org/en/latest/tutorials/packaging-projects/#creating-pyproject-toml (although implicitly as listing it as the first choice)


[project]
name = "python-multipart"
version = "0.0.5"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we bump to 0.0.6?

'Topic :: Software Development :: Libraries :: Python Modules'
]
dependencies = [
"atomicwrites==1.2.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Dependencies should not be hard pinned here as it forces ALL users of this lib to use SPECIFICALLY this version. More relaxed requirements as atomicwrites>=1.0.0 are prefered. The minimum version that works, the better, that allows users more freedom to pin in their apps without a dependency (that's even transitive in the case of fastapi users) forcing you to certain version that might have a security vuln for example

"Homepage" = 'https://github.com/andrew-d/python-multipart'

[project.optional-dependencies]
dev = [
Copy link
Contributor

Choose a reason for hiding this comment

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

If we were to pin, here would be better as it will only be done if we're setting up a dev enviornment, not a library usage environment

@Ambro17
Copy link
Contributor

Ambro17 commented Nov 3, 2022

Thank you for your work Axel! Left my review, let me know if i wasn't clear in any of my suggestions

@axelfauvel
Copy link
Author

Thanks for the review Nahuel, I'll work on it tomorrow

Copy link
Owner

@Kludex Kludex left a comment

Choose a reason for hiding this comment

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

Can we try to match the build setup that starlette has?

@Ambro17
Copy link
Contributor

Ambro17 commented Nov 18, 2022

Hi, let me know if you need some help. If you don't have time i can update the or too with @Kludex suggestion

@axelfauvel
Copy link
Author

Hi @Ambro17 : It's been pretty crazy at work lately.

If you want to implement changes, please feel free to do so

@Kludex
Copy link
Owner

Kludex commented Feb 7, 2023

@Ambro17 do you take care of this or should I?

@Kludex
Copy link
Owner

Kludex commented Feb 7, 2023

Ah, this was already done.

@Kludex Kludex closed this Feb 7, 2023
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.

3 participants