npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fnet/to-pyip

v0.1.5

Published

## Introduction

Downloads

9

Readme

@fnet/to-pyip

Introduction

The @fnet/to-pyip project is designed to streamline the process of setting up and managing a Python package environment. It automates the procedure of configuring necessary directories, installing dependencies, and preparing a package for distribution. This tool aims to assist developers by simplifying the steps needed to deploy their Python code.

How It Works

@fnet/to-pyip operates by creating and managing directories for your package and output files. It sets up a basic environment using template files, organizes the source code, and automates the installation of Python dependencies through integrating with Conda environments. Additionally, it consolidates the package into a distributable format and facilitates its upload to repositories, aiding in smooth project distribution.

Key Features

  • Template Rendering: Automatically generates necessary project files based on templates.
  • Directory Management: Creates and organizes directories effectively for project source and output files.
  • Dependency Installation: Utilizes Conda environments to install necessary dependencies and packages.
  • Package Distribution: Prepares the package in a distributable format and supports uploading to repositories.

Conclusion

In essence, @fnet/to-pyip provides a straightforward way to automate the preliminary steps in Python package management and distribution. It removes much of the manual work involved in setting up and deploying Python projects, allowing developers to focus more on coding and less on configuration.

Developer Guide for @fnet/to-pyip

Overview

The @fnet/to-pyip library is designed to facilitate the conversion and management of source files, using templating capabilities to prepare those files for deployment in a Python environment. It automates the environment setup, which includes creating necessary directories, copying files, and executing essential Python package management commands. With this library, developers can efficiently transition their Node.js projects into Python packages and manage the associated dependencies seamlessly.

Installation

To install @fnet/to-pyip using npm, execute the following command in your terminal:

npm install @fnet/to-pyip

Alternatively, if you are using yarn, you can install it with:

yarn add @fnet/to-pyip

Usage

Follow these usage guidelines to integrate @fnet/to-pyip into your workflow:

  1. Setup Project with Source and Destination: You need to specify source and destination directories where the library will find the necessary project files and generate output, respectively.

  2. Configuration Parameters: Customize parameters like the package name and directory paths if needed. The library will handle default values if not specified.

  3. Automated Environment Setup: The library will automatically establish and manage a Conda environment to handle Python dependencies, execute scripts, and package your project.

Here's a streamlined example demonstrating its usage:

import toPyip from '@fnet/to-pyip';

const config = {
  params: {
    name: "my_project",
    version: "1.0.0",
    package_name: "my_project",
    bin_name: "my_project_cli"
  },
  src: "./project/source",
  dest: "./project/destination"
};

toPyip(config).then(() => {
  console.log('Project successfully converted and packaged.');
}).catch(err => {
  console.error('Error during conversion:', err);
});

Examples

Below are concise examples that showcase the main functionality of the library.

Template Rendering and Packaging

import toPyip from '@fnet/to-pyip';

// Basic Configuration
const params = {
  name: "example_project",
  version: "0.2.0"
};

toPyip({
  params,
  src: "./example/src",
  dest: "./example/dest"
}).then(() => {
  console.log('Packaging completed successfully.');
}).catch(err => {
  console.error('An error occurred:', err);
});

Automated Python Environment Setup

Using the library, a Python environment is automatically managed. The following operations are executed:

  • Installation of necessary Python packages
  • Listing current Python packages
  • Executing package scripts and commands
// Executing Python commands and scripts within managed environment
toPyip({
  params: {
    package_name: "automated_pkg"
  },
  src: "./source_path",
  dest: "./dest_path"
}).then(() => {
  console.log('Environment setup and execution finished.');
}).catch(err => {
  console.error('Execution error:', err);
});

Acknowledgement

The @fnet/to-pyip library leverages the functionalities of the Flownet ecosystem, particularly the @flownet/lib-render-templates-dir for template management and @fnet/auto-conda-env for managing Conda environments, to deliver a seamless development experience.

Input Schema

$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
  params:
    type: object
    properties:
      name:
        type: string
        description: Name of the package
        default: pyip
      version:
        type: string
        description: Version of the package
      package_name:
        type: string
        description: Name of the package
      bin_name:
        type: string
        description: Name of the binary
      package_dir:
        type: string
        description: Directory for the package
      dependencies:
        type: array
        description: List of dependencies
        items:
          type: object
        default: []
      out_dir:
        type: string
        description: Output directory
    required: []
  config:
    type: object
    description: Configuration object
  src:
    type: string
    description: Source directory
  dest:
    type: string
    description: Destination directory
required:
  - params
  - src
  - dest