rstudio / rstudio/reticulate

Sourcing Python Scripts in Packages

Open
#337 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.8k
Forks
349
Avg merge
5h 13m
Merged PRs (30d)
4

Description

Hi,

Perhaps it is not wise but currently as a quick fix I use reticulate::source_python to load a Python function in .onLoad part. My problem is that function is not callable when the package is loaded...unless I define the environment (using envir parameter of source_python) as globalenv().

Is it possible to have the function in the package namespace?

I am very new to this package by the way. Though I needed a Python function and needed a quick fix.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with reticulate::source_python and the .onLoad example described in the issue, including the envir argument and globalenv() behavior. Determine whether a sourced Python function can be made callable from the package namespace; done would be a documented or reproducible resolution of that namespace behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, r
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.