MCPcopy
hub / github.com/pex-tool/pex / make_project

Function make_project

testing/__init__.py:140–221  ·  view source on GitHub ↗
(
    name="my_project",  # type: str
    version="0.0.0",  # type: str
    zip_safe=True,  # type: bool
    install_reqs=None,  # type: Optional[List[str]]
    extras_require=None,  # type: Optional[Dict[str, List[str]]]
    entry_points=None,  # type: Optional[Union[str, Dict[str, List[str]]]]
    python_requires=None,  # type: Optional[str]
    universal=False,  # type: bool
    prepare_project=None,  # type: Optional[Callable[[str], None]]
)

Source from the content-addressed store, hash-verified

138
139@contextlib.contextmanager
140def make_project(
141 name="my_project", # type: str
142 version="0.0.0", # type: str
143 zip_safe=True, # type: bool
144 install_reqs=None, # type: Optional[List[str]]
145 extras_require=None, # type: Optional[Dict[str, List[str]]]
146 entry_points=None, # type: Optional[Union[str, Dict[str, List[str]]]]
147 python_requires=None, # type: Optional[str]
148 universal=False, # type: bool
149 prepare_project=None, # type: Optional[Callable[[str], None]]
150):
151 # type: (...) -> Iterator[str]
152 project_content = {
153 "setup.py": dedent(
154 """
155 from setuptools import setup
156
157 setup(
158 name=%(project_name)r,
159 version=%(version)r,
160 zip_safe=%(zip_safe)r,
161 packages=[%(project_name)r],
162 scripts=[
163 'scripts/%(hello_world_script_name)s',
164 'scripts/%(shell_script_name)s',
165 ],
166 package_data={%(project_name)r: ['package_data/*.dat']},
167 install_requires=%(install_requires)r,
168 extras_require=%(extras_require)r,
169 entry_points=%(entry_points)r,
170 python_requires=%(python_requires)r,
171 options={'bdist_wheel': {'universal': %(universal)r}},
172 )
173 """
174 ),
175 os.path.join(name, "__init__.py"): 0,
176 os.path.join(name, "my_module.py"): 'def do_something():\n print("hello world!")\n',
177 os.path.join(name, "package_data/resource1.dat"): 1000,
178 os.path.join(name, "package_data/resource2.dat"): 1000,
179 } # type: Dict[str, Union[str, int]]
180
181 if WINDOWS:
182 project_content.update(
183 (
184 (
185 "scripts/hello_world.py",
186 '#!/usr/bin/env python\r\nprint("hello world from py script!")\r\n',
187 ),
188 ("scripts/shell_script.bat", "@echo off\r\necho hello world from shell script\r\n"),
189 )
190 )
191 else:
192 project_content.update(
193 (
194 (
195 "scripts/hello_world",
196 '#!/usr/bin/env python\nprint("hello world from py script!")\n',
197 ),

Callers 10

assert_entry_pointsFunction · 0.90
assert_pex_args_shebangFunction · 0.90
create_sdistFunction · 0.90
test_scriptFunction · 0.90
make_sdistMethod · 0.90
built_wheelFunction · 0.70
make_source_dirFunction · 0.70

Calls 4

temporary_contentFunction · 0.85
prepare_projectFunction · 0.50
joinMethod · 0.45
updateMethod · 0.45

Tested by 7

assert_entry_pointsFunction · 0.72
assert_pex_args_shebangFunction · 0.72
create_sdistFunction · 0.72
test_scriptFunction · 0.72