The link in this tutorial will explain the steps to upload a package to pypi: https://dzone.com/articles/executable-package-pip-install
-
Create an API token to authenticate with PyPI:
-
In your Pypi account settings, go to API tokens section and select "Add API token"
-
Add the token to the Github Actions Secret.
-
-
Create a github workflow with the following content:
name: Publish to PyPI
on:
push:
tags:
- "*"
jobs:
build-n-publish:
if: github.event.base_ref == 'refs/heads/<branch-for-deploy>' && startsWith(github.ref, 'refs/tags')
name: Build and publish package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make dev
- name: <optional step to lint and test the code>
run: |
make lint
make test
- name: Build
run: |
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
For the versioning control we a using the package bump2version.
- Run
pip install bump2version
in your environment - Add the following attributes to the setup.cfg file:
[bumpversion]
current_version = <version_number>
allow_dirty = True
tag_name = version-{new_version}
tag = True
commit = True
[bumpversion:file:<path_to_file_version_file>]
[bumpversion:file:<path_to_setup_file>]
Note: If NotADirectoryError: [Errno 20] Not a directory
,
check c4urself/bump2version#139 for a fix.
-
Run the command
bumperversion [major|minor|patch]
to increase the version number. This will create a new tag and commit the changes. -
Push the changes to the developer branch.
-
Create a pull request onto master. To deploy pymove to Pypi using you must be in the master branch, pushing a tagged commit.
-
After merging the new version into the master branch, push the new tag created by bump2version.
git push --tags
The link in this tutorial will explain the steps to upload a package to conda-forge: https://conda-forge.org/docs/maintainer/adding_pkgs.html
With the package published to Pypi, we can easily deploy to the conda-forge chanel. First we create a conda recipe.
-
Run the command conda
conda skeleton pypi <package_name>
. This will create a conda recipe for the package. -
Now add some information to the
<package_name>/meta.yaml
file.
{% set name = <package_name> %}
{% set version = <package_version> %}
package:
name: "{{ name|lower }}"
version: "{{ version }}"
source:
url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz"
sha256: <package_version_sha256>
build:
number: 0
script: "{{ PYTHON }} -m pip install . -vv"
noarch: python
requirements:
host:
- pip
- python >=3.6
run:
- <package_requirements>
- python >=3.6
test:
imports:
- <all_possible_imports>
about:
home: <repository_url>
license: <licence>
license_family: <licence_family>
license_file: <path_to_licence_file>
summary: <package_summary>
doc_url: <package_docs_url>
dev_url:
extra:
recipe-maintainers:
- <your_github_username>
- <other_package_maintainers>
All package run requirements must be available in the conda-forge channel.
-
Fork the example recipes repository at https://github.com/conda-forge/staged-recipes
-
Copy the
<package_name>/meta.yaml
file created in the step above to the forked repostaged-recipes/recipes/example
directory -
Push the changes to your forked repository.
-
Make a pull request for your repository to the master branch on the stage-recipes repository.
conda-forge:master from <your_github_username>:<package_name>
-
Now, the pull request will be checked.
-
Complete the checklist for the pull requests.
-
The recipe meta.yaml file will be checked by the
conda-forge-linting service
. -
The recipe will be built for
linux64
,macos64
andwindows64
systems.
-
-
If there are any problems with the PR, a review team member will give you feedback, pointing out improvements and answering questions.
-
Once everything is in order, the pull request will be aproved.
-
After the pull request, a new repository for the package will be created similar to
https://github.com/conda-forge/<package_name>-feedstock.
-
You will be added as a maintainer for the newly created repository
-
The repository will automatically build the conda package and upload to https://anaconda.org/conda-forge
-
To make any changes to the conda package, send a
PR
to the git feedstock repository main branch from a fork. -
Branches of the main repository are used for maintaining different versions only.
The regro-cf-autotick-bot
will make an automatic Pull Request
when it detects that the PyPi package has been updated.
Follow the PR
instructions to update the conda-forge
package.