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

Publish package to PyPi and GitHub Releases #47

Merged
merged 2 commits into from May 18, 2022
Merged

Conversation

kousu
Copy link
Contributor

@kousu kousu commented Apr 29, 2022

Here at https://github.com/neuropoly/ we think your project is very useful and would like to build on it! Unfortunately if we write a setup.cfg for ourselves that depends on "torchsampler", it fails to install, because https://pypi.org/project/torchsampler/ is a 404:

Screenshot 2022-04-29 at 14-51-02 Page Not Found (404)

This Workflow script makes publishing the conventional way easy and reliable, and will mean that projects like ours can build on your work!

To use it,

  1. Create an account at https://pypi.org/
  2. Go to https://pypi.org/manage/account/token/ and make a token
  3. Go to then go to https://github.com/kousu/imbalanced-dataset-sampler/settings/secrets/actions and paste the token in there, with name "PYPI_TOKEN"

Then every time you are ready to publish,

  1. Go to https://github.com/ufoym/imbalanced-dataset-sampler/releases/new,
  2. Fill in a new tag like "1.0.0"
  3. Click Publish.

It will run the Action and then in a minute or so will show up on https://github.com/kousu/imbalanced-dataset-sampler/releases/ and https://pypi.org/project/torchsampler/#history

For your first few runs, while you get used to this script, I recommend using "rc" suffixes to post versions without committing to them. For example, I've used this script myself to produce

Screenshot 2022-04-29 at 15-04-19 radicale-bsdauth

the ones with the yellow "pre-release" tags get ignored by pip by default, unless a user opts into them with pip install --pre.

Publishing to PyPI will avoid issues like

and again, let us build on your work. Without publishing to pypi, it means our install instructions need to include yours:

pip install https://github.com/ufoym/imbalanced-dataset-sampler/archive/master.zip neuropoly-seg-model

which is pretty awkward for us.

Thanks a lot for your work, it's really helping out our research prototyping.

@ufoym ufoym merged commit 87c4e3a into ufoym:master May 18, 2022
@ufoym
Copy link
Owner

ufoym commented May 18, 2022

Thanks pretty much for your contribution @kousu

@kousu
Copy link
Contributor Author

kousu commented May 18, 2022 via email

kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
@kousu kousu mentioned this pull request May 22, 2022
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 22, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 23, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).

`setuptools-scm` also replaces most of MANIFEST.in, so this removes the
redundant lines from that too.
kousu added a commit to kousu/imbalanced-dataset-sampler that referenced this pull request May 23, 2022
Follows up ufoym#47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in ufoym#47 (which is triggered
by tagging a new version in git).

`setuptools-scm` also replaces most of MANIFEST.in, so this removes the
redundant lines from that too.
ufoym pushed a commit that referenced this pull request May 23, 2022
* Use setuptools_scm

Follows up #47

- on [pypi](https://pypi.org/project/torchsampler/0.1.1/) it's 0.1.1
- on github it's [0.1.0](https://github.com/ufoym/imbalanced-dataset-sampler/releases/tag/v0.1.0)
    - but the attached [wheel](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1-py3-none-any.whl)
      and [sdist](https://github.com/ufoym/imbalanced-dataset-sampler/releases/download/v0.1.0/torchsampler-0.1.1.tar.gz) are 0.1.1

[`setuptools-scm`](https://pypi.org/project/setuptools-scm/) makes git the single-source of truth
for the version of the package, and works well with the build script in #47 (which is triggered
by tagging a new version in git).

`setuptools-scm` also replaces most of MANIFEST.in, so this removes the
redundant lines from that too.

* Deprecate torchsampler.__about__

It's better to keep all metadata in setup.py and use importlib.metadata.
Otherwise, you need to 'import __about__' during the build process
means importlib-metadata needs to be installed during the build
if building on python 3.6 or python 3.7, and potentially running an
unbounded amount of other code during the build.

It's easier to just sidestep the issue.

* Squash a build warning

> .../site-packages/setuptools/dist.py:726: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead

description_file has been superseded recently in
4c4a6e3 anyway.
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.

None yet

2 participants