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

Push first version to PyPi #266

Closed
zain-sohail opened this issue Nov 14, 2023 · 8 comments · Fixed by #277
Closed

Push first version to PyPi #266

zain-sohail opened this issue Nov 14, 2023 · 8 comments · Fixed by #277

Comments

@zain-sohail
Copy link
Member

For that, create a github workflow that does it when tagged, and depends on all other workflows passing.

@zain-sohail
Copy link
Member Author

So we indeed have to change the repo name to something different (e.g sed-processor), if we want that as our distribution name. scikit's repo and package name differ but their repo name and distribution name (pypi name) are the same: https://github.com/scikit-learn/scikit-learn and https://pypi.org/project/scikit-learn/

@steinnymir @rettigl

@zain-sohail
Copy link
Member Author

Saying this after also experiementing and reading at many places and I couldn't figure out a way.
Basically, the name in the pyproject.toml should correspond with where the pyproject.toml folder resides. In our case, sed.

@steinnymir
Copy link
Member

If I understand, we need to rename the github repo to, say, sed-processor. This renames our web page to https://github.com/OpenCOMPES/sed-processor. Then the toml file will have sed-processor as project name in it, and the pypi page would be https://pypi.org/project/sed-processor/

The internal folder can still be sed and when we import, we do import sed.
is this correct?

@zain-sohail
Copy link
Member Author

to double check, i locally made necessary changes and pushed to test pypi

you can install by first setting up a new environment and then running
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ sed-processor

If I understand, we need to rename the github repo to, say, sed-processor. This renames our web page to https://github.com/OpenCOMPES/sed-processor. Then the toml file will have sed-processor as project name in it, and the pypi page would be https://pypi.org/project/sed-processor/

The internal folder can still be sed and when we import, we do import sed. is this correct?

To answer your question, yes. I'd suggest you test it out too.
The only problem with changing repo name is that everyone who has cloned the repo has to reset the url associated with it (not such a big issue I guess if we email everyone)

@rettigl
Copy link
Member

rettigl commented Nov 15, 2023

Let me understand again: You can make a pypi package even without having a repository or github at all, no? So the requirement whould be to the name of the folder where you check the repository out to, no? This you can very easily change for the build process, without changing the repository name...

@zain-sohail
Copy link
Member Author

The PyPi package isn't the problem but building is.
Our package name in pyproject.toml should be same as our main directory. So for what I published on PyPi, it looks like this (additional metadata added. Using my github email till we find another, or someone else can suggest)

[tool.poetry]
name = "sed-processor"
packages = [
    {include = "sed"}
]
version = "0.1.2"
description = "Single Event Data Frame Processor: Backend to handle photoelectron resolved datastreams"
authors = ["OpenCOMPES team <[email protected]>"]
readme = "README.md"
repository = "https://github.com/OpenCOMPES/sed"
documentation = "https://opencompes.github.io/sed/"
keywords = ["sed", "mpes", "flash", "arpes"]
license = "MIT"

Now of course we can hack around in the workflow and change both dir name and name under tool.poetry only for building. But I find that really unintuitive. Would be confusing for future maintainers.

@rettigl
Copy link
Member

rettigl commented Nov 15, 2023

I don't see a problem. I think you can just do

  • name: Checkout
    uses: actions/checkout@v4
    with:
    path: sed-processor

and change the name in the project file. Seems more simple to me than chaning the repository name.

@zain-sohail
Copy link
Member Author

Ok I will try it out and inform how that goes

@zain-sohail zain-sohail mentioned this issue Nov 17, 2023
3 tasks
zain-sohail added a commit that referenced this issue Nov 17, 2023
Merge PR #277: Project Enhancements and Workflow Updates

This pull request introduces several improvements to the project:

1. **Documentation Enhancements:**
   - Dependencies for documentation are now in a separate section in the toml file, ensuring they are not packaged for users.
   - Updated the documentation structure to prioritize README and tutorials.
   - Improved shields in the README for better visibility and accuracy.
   - Updated the license to reflect the current year.

2. **Workflow Updates:**
   - Renamed the documentation workflow for a more informative shield.
   - Modified the workflow to run on the main branch, ensuring it stays up-to-date.
   - Adjusted workflow dependencies to let other workflows complete before merging.

3. **Package Versioning:**
   - Implemented a workflow that runs a prerelease job on every push to the main branch and a release job on every tag push.
   - A publish to PyPI job is executed on every successful prerelease or release job.
   - If publish is successful, the version is updated in the pyproject.toml file and pushed to the main branch.

These changes enhance the project's maintainability, versioning, and overall user experience.

[Link to prerelease example run](https://github.com/OpenCOMPES/sed/actions/runs/6897868624)
[Link to release example run](https://github.com/OpenCOMPES/sed/actions/runs/6898553103)
[Link to this PR](#266)
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 a pull request may close this issue.

3 participants