-
Notifications
You must be signed in to change notification settings - Fork 59
ENH: Publish your python package to PyPI #164
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
Conversation
tutorials/publish-pypi.md
Outdated
|
||
```bash | ||
# This will create a default envt with your package installed in editable mode | ||
hatch env create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
➜ hatch -e dev pytest
Usage: hatch [OPTIONS] COMMAND [ARGS]...
Try 'hatch -h' for help.
Error: No such command 'pytest'.
pyosPackage (☊ main) [✎ ×1 ] is 📦 v0.1.0 🐍 v3.12.1
❯ hatch -e dev pytest
tutorials/publish-pypi.md
Outdated
|
||
If you don't already have a pyos-package development environment, create one now. | ||
|
||
::::{tab-set} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this could go away potentially with hatch.
tutorials/publish-pypi-twine.md
Outdated
@@ -0,0 +1,588 @@ | |||
# Publish your Python package to PyPI - without hatch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All: this is the older lesson that used twine. it's a lot more complex to teach because you have to either guess what envt manager someone is using or provide instructions across conda, venv windows / linux+maxos
so this lesson is much more complex. im leaning towards deleting it and just leaning in 100% to hatch.
@@ -0,0 +1,416 @@ | |||
# Publish your Python package to PyPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the hatch lesson! i left a few TODO's at the top - the biggest one is
should we teach pipx to install hatch? (it seems that would make sense) except pipx is a bit weird to install on windows potentially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am +1 on pipx. Even though the installation is not the easiest on Windows, I found it far easier to introduce tooling to beginners. With pipx, they do not mess with their global install, and they do not have any issue with tools being installed in virtual environment (and forgetting to activate said envs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I just found out that pipx is available on scoop: https://scoop.sh/#/apps?q=pipx.
Then it is just as easy to install on Windows as on Linux/MacOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok scoop is easy? i just wasn't sure. i installed with homebrew @Batalex and it was really easy but you have to have homebrew setup of course. i also read that you can install pipx with pip but that hurts my brain a bit. i'm not sure where it would get installed if you did that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked at the hatch lesson since that seems to be the chosen one. The publish workflow looks so nice with this tool.
I am wondering if too much focus is being placed on distribution types, especially for a beginner lesson. I don't think we should ignore the distribution files or not note there are two types. But maybe once in the whole lesson. Hatch, like most of the rest of the modern build front ends will always produce an sdist and wheels when it builds. And it will publish all dist files without the user really having to think about it. I think new users won't care that there are different distribution types, or why both are needed, just as long as it will work; which it will (including for conda-forge) out of the box.
* Should we install hatch with pipx? | ||
|
||
```bash | ||
pipx install hatch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be convinced, but I don't see the point of telling new users about a python venv management tool to manage their environment management tool. How do they get pipx without polluting a top-level environment? pipx-in-pipx? (mostly serious, this is a good tool, but now we have three environment tools to teach in one lesson).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i hear you. it sounds like we have mixed opinions about using pipx vs pip. it is very true that the pipx
install will add cognitive load to this lesson. it's not the simplest altho you can pip install pipx but i could see that also confusing users as it kind of confuses me to think about it!
maybe we can talk more in slack. i know some really like pipx and i do understand why. but on the other hand, most beginners won't likely be dealing with a ton of different package environments as they are just learning so keeping it simpler for now could be good. we could have a tiny breakout about pipx so they know it exists if they want to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few suggestions! otherwise things look good to me.
Co-authored-by: Jeremy Paige <ucodery@gmail.com>
Co-authored-by: Jeremy Paige <ucodery@gmail.com>
Co-authored-by: Alex Batisse <alexandre.batisse@hey.com>
Co-authored-by: Jeremy Paige <ucodery@gmail.com>
e3ef689
to
1d055bf
Compare
6007641
to
c74db0a
Compare
ok everyone! i am going to move forward with merging this as all of the feedback has been integrated and none of the changes were significant. As such i don't think we need a second review! If we discover issues in the lesson in future reviews we can always make changes then. |
@@ -37,7 +37,7 @@ Licenses are legally binding, as such you should avoid trying to create your own | |||
|
|||
### Use open permissive licenses when possible | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is causing issues in CI so i fixed the link.
Fix: bad link Fix: add 429 http code
5816ad3
to
8fe0ba2
Compare
@all-contributors please add @ofek for tutorials |
I've put up a pull request to add @ofek! 🎉 |
There are two versions of this lesson in this PR - i'm thinking the hatch version is the way to go because the environment complexities without hatch are significant. the lesson is shorted and simpler using hatch than it would be with build and twine for numerous reasons. With that said, i did leave the original twine lesson in the pr too in case people want to look at it and think about the difference between the two. we will ultimately remove one of these - likely the twine lesson.