Skip to content

Instantly share code, notes, and snippets.

@qin-yu
Created November 6, 2023 14:22
Show Gist options
  • Save qin-yu/c0293a935a3fb0009b60ee966d5dbf6c to your computer and use it in GitHub Desktop.
Save qin-yu/c0293a935a3fb0009b60ee966d5dbf6c to your computer and use it in GitHub Desktop.

Upload Package to PyPI and Conda

Publishing to PyPI Manually

Resources

Workflow

  • Create README.md in the directory root
  • Create LICENSE in the directory root
  • Create setup.py in the directory root
  • Put Python modules in a subdirectory, src or whatever
  • Put Python tests in a subdirectory, tests or whatever
  • Create __init__.py in the subdirectory to make it discoverable
  • Initialise the package with Hatch: hatch new --init
    • This creates pyproject.toml
  • Build the package with Hatch: hatch build
    • Before running this hatch version x.y.z to set the version number
    • This creates dist/
  • Upload the package to PyPI with Hatch: hatch publish -u __token__ -a TOKEN
    • the username is __token__ and the authentication token is created on PyPI

Contributing to Conda Manually

Resources

Workflow

  • conda install conda-build
  • conda install anaconda-client
  • Create meta.yaml in a folder named conda-recipe or whatever
  • Build the package by conda build .
  • Upload the package to Anaconda Cloud by anaconda upload /g/kreshuk/yu/miniconda3/envs/ENV_NAME/conda-bld/noarch/PACKAGE_NAME-pypy_1.tar.bz2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment