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

Setup foundations for packaging and publishing #39

Merged
merged 5 commits into from
Jan 14, 2022

Conversation

inverse
Copy link
Contributor

@inverse inverse commented Jan 2, 2022

  • Setup CI pipeline on release publish that will automatically push to pypi
  • Package up using setup.py - Went for this as I wasn't sure how to use poetry to manage this as there is only a single script vs traditional packaging modules
  • Added Makefile to automate build/cleaning

To test local flow

python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
make

## Test pipx install 
pipx install dist/decode_config-2022.1.1-py3-none-any.whl 

Resolves #38

setup.py Outdated Show resolved Hide resolved
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_token }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs a token to be added as a GitHub secret

@@ -52,7 +52,7 @@ See [Running as Python script](#running-as-python-script) for more details.

| File | Description |
|:-------------------------|:------------------------------------------------------------------------|
| `build` | contains files to build executables |
| `build-executables` | contains files to build executables |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to move it as build is used for packaging :/

@inverse inverse marked this pull request as ready for review January 2, 2022 10:21
@curzon01
Copy link
Collaborator

curzon01 commented Jan 3, 2022

it does... a lot of other work with the start of the new year, be patient for eval

@curzon01 curzon01 added the enhancement New feature or request label Jan 3, 2022
@inverse
Copy link
Contributor Author

inverse commented Jan 3, 2022

No rush - let me know if you need anything explained 👍🏼

overwrites locals
@@ -1,5 +0,0 @@
/.venv/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These ignores are here to avoid polluting and accidentally committing invalid things

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know - but overwrites already existing local ones. Your excludes are not other people excludes :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't follow? This is scoped to the repository? If anyone was to checkout the project and run make build for example they would have buiild/ and dist/ folders showing as a change with git and would be confusing.

Copy link
Collaborator

@curzon01 curzon01 Jan 8, 2022

Choose a reason for hiding this comment

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

I know that but how to handle if my working dir contains a different .gitignore? anyway I took now more than 4 hours to try to get it work pypi for both branch for a simple python script file without a result, that was the reason why I used to think of pypi as a single simple python as an overkill

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why would your git repo contain a different .gitignore? Normally these kind of things are scoped to the project so everyone has the same setup. With the exception of global ones which feel like a bit like an anti-pattern to me.

What were/are you struggling with?

My rational for this is to ease install and upgrades. Either with pure pip or by leveraging pipx

e.g. with pipx it would be pipx install decode-config and pipx upgrade decode-config

Copy link
Collaborator

Choose a reason for hiding this comment

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

To understand the current action status:
The last failed action basically is a result of the updated github release.
I updated release v12.3.0 to v12.3.1 which causes the error creating of the pypi packages using 12.3.0 which already exist.

cause github release update action didn't work, I downgraded release v12.3.1 to v12.3.0 and created a new release v12.3.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I understand the action is only invoked when the release is published and is based off the new existing tag that it was created on.

so if you had a draft release and updated it, as soon as you publish it that's what it will be based on.

I'm not sure what happens if you update an already published release though - is that what the problem came from updating an already published release?

Copy link
Collaborator

Choose a reason for hiding this comment

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

exactly, when you update an already published release (that's possible), then the github source file packages are updated but the action access an outdated tag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trying to reproduce the issue on a new repo

  • created release (CI kicked off)
  • Update release (name + tag) - CI not kicked off

How did you get yours working?

Copy link
Collaborator

Choose a reason for hiding this comment

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

same steps as yours but different yml (publish.yml from this repo) from your Init PR - that's why I'm asking

@curzon01 curzon01 merged commit bfe944a into tasmota:development Jan 14, 2022
curzon01 added a commit that referenced this pull request Jan 14, 2022
@inverse inverse deleted the publish branch January 14, 2022 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package up and publish to pypi
2 participants