Python setup.py and pkg_resources, refrencing package dataWhat is setup.py?python setup.py uninstallhow to write setup.py for this application structure?need to package jinja2 template for python__init__.py does not find modules in same directorypackaging multiple pre-compiled binary python c extensions(.so, created using SWIG interface)How to access text file in project root from python package under `src/` directoryPython pkg_resources and file access in packagesNew to creating a Python PackagePython Packaging with .pth files
Caro-Kann c4-c5 push
Missing quartile in boxplot
Why has Speaker Pelosi been so hesitant to impeach President Trump?
Why not add cuspidal curves in the moduli space of stable curves?
Decision Variable Value from a Set (Gurobi)
How can Germany increase investments in Russia while EU economic sanctions against Russia are still in place?
Could the Queen overturn the UK Supreme Court ruling regarding prorogation of Parliament?
What is the meaning of first flight and introduction in aircraft production?
How is this situation not a checkmate?
Realistically, how much do you need to start investing?
Can an untrusted VPN client monitor my network activity?
How to find places to store/land a private airplane?
Did Tolkien ever write about a Heaven or Hell for Men?
Confusion regarding control system of Mars Rover?
Would an object shot from earth fall into the sun?
How closely correlated is culture to geography?
How dangerous are my worn rims?
Knights and Knaves: What does C say?
Giving a good fancy look to a simple table
Why does it seem the best way to make a living is to invest in real estate?
How to "Start as close to the end as possible", and why to do so?
Is there anything on the ISS that would be destroyed if that object were returned to Earth?
What's the global, general word that stands for "center tone of a song"?
Airport Security - advanced check, 4th amendment breach
Python setup.py and pkg_resources, refrencing package data
What is setup.py?python setup.py uninstallhow to write setup.py for this application structure?need to package jinja2 template for python__init__.py does not find modules in same directorypackaging multiple pre-compiled binary python c extensions(.so, created using SWIG interface)How to access text file in project root from python package under `src/` directoryPython pkg_resources and file access in packagesNew to creating a Python PackagePython Packaging with .pth files
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this
# copy_template.py
def copy_template(destiny):
# Find from static resources
# and Copy the whole template dir
copytree(resource, destiny)
And I have a file structure like this
# The assets dir and template dir actually have content, and I would like to
# reference them in the package for several reasons.
.
├── assets
│ ├── resource0
│ ├── resource1
│ └── resource2
├── template
│ ├── data
│ ├── img
│ └── assets
├── package
│ ├── __init__.py
│ ├── copytemplate.py
├── Pipfile
├── README.md
└── setup.py
What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py
and how to reference the files inside the module.
I tried to use
# setup.py
setup(...
package_data=
"": ["template/*"]
# reference attempt
package_name = __name__.split('.')[0]
print(pkg_resources.resource_listdir(package_name, ''))
But when ever I try to reference I get a traceback for a TypeError
so I don't find how to make this work.
any ideas?
setup.py python-packaging pkg-resources
add a comment
|
I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this
# copy_template.py
def copy_template(destiny):
# Find from static resources
# and Copy the whole template dir
copytree(resource, destiny)
And I have a file structure like this
# The assets dir and template dir actually have content, and I would like to
# reference them in the package for several reasons.
.
├── assets
│ ├── resource0
│ ├── resource1
│ └── resource2
├── template
│ ├── data
│ ├── img
│ └── assets
├── package
│ ├── __init__.py
│ ├── copytemplate.py
├── Pipfile
├── README.md
└── setup.py
What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py
and how to reference the files inside the module.
I tried to use
# setup.py
setup(...
package_data=
"": ["template/*"]
# reference attempt
package_name = __name__.split('.')[0]
print(pkg_resources.resource_listdir(package_name, ''))
But when ever I try to reference I get a traceback for a TypeError
so I don't find how to make this work.
any ideas?
setup.py python-packaging pkg-resources
add a comment
|
I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this
# copy_template.py
def copy_template(destiny):
# Find from static resources
# and Copy the whole template dir
copytree(resource, destiny)
And I have a file structure like this
# The assets dir and template dir actually have content, and I would like to
# reference them in the package for several reasons.
.
├── assets
│ ├── resource0
│ ├── resource1
│ └── resource2
├── template
│ ├── data
│ ├── img
│ └── assets
├── package
│ ├── __init__.py
│ ├── copytemplate.py
├── Pipfile
├── README.md
└── setup.py
What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py
and how to reference the files inside the module.
I tried to use
# setup.py
setup(...
package_data=
"": ["template/*"]
# reference attempt
package_name = __name__.split('.')[0]
print(pkg_resources.resource_listdir(package_name, ''))
But when ever I try to reference I get a traceback for a TypeError
so I don't find how to make this work.
any ideas?
setup.py python-packaging pkg-resources
I'm trying to have a static "template" of a directory structure, and call for a copy of this template to a given file, in a module like this
# copy_template.py
def copy_template(destiny):
# Find from static resources
# and Copy the whole template dir
copytree(resource, destiny)
And I have a file structure like this
# The assets dir and template dir actually have content, and I would like to
# reference them in the package for several reasons.
.
├── assets
│ ├── resource0
│ ├── resource1
│ └── resource2
├── template
│ ├── data
│ ├── img
│ └── assets
├── package
│ ├── __init__.py
│ ├── copytemplate.py
├── Pipfile
├── README.md
└── setup.py
What I'm trying to figure out, is if the template directory needs to be inside the package or not (from what I've read it's not required), how to include it in the setup.py
and how to reference the files inside the module.
I tried to use
# setup.py
setup(...
package_data=
"": ["template/*"]
# reference attempt
package_name = __name__.split('.')[0]
print(pkg_resources.resource_listdir(package_name, ''))
But when ever I try to reference I get a traceback for a TypeError
so I don't find how to make this work.
any ideas?
setup.py python-packaging pkg-resources
setup.py python-packaging pkg-resources
edited Mar 28 at 20:54
ekiim
asked Mar 28 at 20:46
ekiimekiim
3314 silver badges12 bronze badges
3314 silver badges12 bronze badges
add a comment
|
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406593%2fpython-setup-py-and-pkg-resources-refrencing-package-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55406593%2fpython-setup-py-and-pkg-resources-refrencing-package-data%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown