To add the PyPI package to conda distribution (conda-forge
), you need to follow the following method,
1. Fork the staged-recipes repository
2. Create configuration files
After creating the fork in your GitHub, first step is to clone your fork,
git clone https://github.com/iamtekson/staged-recipes.git
Please replace the git clone
URL
.
Now, add the LICENSE
and meta.yaml
file inside recipes/yourPackageName
folder.
Below is the example of MIT license file,
MIT License
Copyright (c) 2020, Tek Kshetri
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Inside meta.yaml
file, you need to write your package configuration. The easiest way is to copy the file from example > meta.yaml
file and edit it. Here is the example of geoserver-rest
package,
{% set name = 'geoserver-rest' %}
{% set version = '0.1.0' %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: 625327b23ee2ee77e839272b04d0b6e81b7dc98e0713e4e23d003a1bf2461551
build:
noarch: python
number: 0
script: "{{ PYTHON }} -m pip install . -vv"
requirements:
host:
- python >=3.6
- pip
run:
- python >=3.6
- pip
- gdal
- seaborn
- pycurl
- psycopg2
test:
imports:
- geo
commands:
- pip check
requires:
- pip
about:
home: https://github.com/gicait/geoserver-rest
license: MIT
license_file: LICENSE
summary: "The package for management of geospatial data in GeoServer."
description: |
The geoserver-rest package is useful for the management for geospatial data in GeoServer. The package is useful for the creating, updating and deleting geoserver workspaces, stores, layers, and style files.
dev_url: https://github.com/gicait/geoserver-rest
extra:
recipe-maintainers:
- iamtekson
3. Submit the pull request
This is the final step. Now you have to create the new branch, push code to your fork and submit the pull request. Below is the code for creating new branch and push code,
git branch myPackageName
git checkout myPackageName
git add .
git commit -m "added myPackageName to conda-forge"
git push --set-upstream origin myPackageName
Now, check your GitHub account and submit the pull request. After submitting the pull request, some of the test functions (GitHub actions) will automatically run and you will notify if there is any mistake.
If your pull request merged, that means your package can be install using conda distribution as well. You can check the package availability by using conda installation as below,
conda install -c conda-forge myPackageName
Check this pull request for your reference: https://github.com/conda-forge/staged-recipes/pull/14143
Congratulations! you finally managed to publish your package to conda distribution. If you like this blog, please support me by subscribing to my YouTube channel: https://www.youtube.com/c/iamtekson
Top comments (0)