cs01 / create-python-package Goto Github PK
View Code? Open in Web Editor NEWInitialize a new package
License: MIT License
Initialize a new package
License: MIT License
create-python-package
creates a virtualenv by default. While I think this is a fair default, more and more people (myself included) made the switch to pipenv to manage dependencies.
I'd love to see a --pipenv
option that would run:
pipenv install -e .
for us. After that, we can switch to use pipenv
so this wouldn't interfere with the current shortcuts around virtualenvs.
Add 'private' option prompt and automatically add appropriate classifier to setup.py if private is chosen.
Classifier is
"Private :: Do Not Upload"
I've just tried creating a Python package named tartiflette-asgi
(:wink:) and the resulting Python package is called tartiflette-asgi
. It should be tartiflette_asgi
because hyphens aren't allowed in Python identifiers.
To be clear, if name
contains hyphens:
.isidentifier()
check to be 100% sure.FYI, I had to implement a similar thing in Bocadillo CLI; PR is here: bocadilloproject/bocadillo-cli#3
Currently validation is done manually after the users has made all choices. This can result in a poor user experience. It would be better to immediately reject a user's input, tell them why, then re-ask the question. cc @florimondmanca
It would be helpful if CPP allowed the user to select from a list of continuous integration tools.
For example, if travis were chosen, a .travis.yml file would be added, such as
language: python
sudo: required
python:
- "3.6"
install:
- pip install .
script:
- python setup.py tests
cache:
pip: true
Hey, just tried using this tool to init a new Python package. Very neat. ๐
Currently, an MIT license is generated, but:
author
is not filled in.There's a great little tool called mklicense
which can be used to generate various licenses (with a certain sense of humour).
We could ask the create-python-package
user if they're OK to use MIT (and ask for the author's name?) and if not make a subcall to mklicense
.
Currently, create-python-package
sets up a sample test suite based off unittest
. One other popular option (which I personally use) is pytest
.
It would be cool if one could select their test framework, e.g. unittest
and pytest
, or choose to not have tests configured at all.
For pytest
, a pytest.ini
file should be generated to configure the test paths:
[pytest]
testpaths = tests/
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
full console log
python -m pipx run create-python-package
create-python-package is already on your PATH and installed at D:\Projects\Tools\Python3\Scripts\create-python-package.EXE. Downloading and running anyway.
Assuming app is 'create-python-package.exe' (Windows only)
Using template https://github.com/cs01/cookiecutter-pypackage5h
You've downloaded C:\Users\[user]\.cookiecutters\cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]:
full_name [First Last]: zarlo
email [[email protected]]: [email protected]
github_username [GitHubUser]: zarlo
project_name [Python Project]: sandboxre
project_short_description []:
pypi_username [zarlo]:
version [0.1.0]:
Select command_line_interface:
1 - argparse
2 - No command-line interface
Choose from 1, 2 [1]: 2
Select open_source_license:
1 - MIT license
2 - BSD license
3 - ISC license
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 2
Traceback (most recent call last):
File "C:\Users\[user]\AppData\Local\Temp\tmp4nr5gbg4.py", line 17, in <module>
remove_file(cli_file)
File "C:\Users\[user]\AppData\Local\Temp\tmp4nr5gbg4.py", line 9, in remove_file
os.remove(os.path.join(PROJECT_DIRECTORY, filepath))
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'D:\\Projects\\Github\\zarlo\\sandbox.py\\sandboxre\\sandboxre\\cli.py'
Stopping generation because post_gen_project hook script didn't exit successfully
Traceback (most recent call last):
File "D:\Projects\Tools\Python3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "D:\Projects\Tools\Python3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\[user]\.local\pipx\.cache\9e1584308bc335a\Scripts\create-python-package.exe\__main__.py", line 7, in <module>
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\createpythonpackage\main.py", line 29, in main
cookiecutter(args.template)
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\main.py", line 94, in cookiecutter
output_dir=output_dir
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\generate.py", line 376, in generate_files
delete_project_on_failure
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\generate.py", line 236, in _run_hook_from_repo_dir
run_hook(hook_name, project_dir, context)
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 145, in run_hook
run_script_with_context(script, project_dir, context)
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 129, in run_script_with_context
run_script(temp.name, cwd)
File "c:\users\[user]\.local\pipx\.cache\9e1584308bc335a\lib\site-packages\cookiecutter\hooks.py", line 91, in run_script
'Hook script failed (exit status: {})'.format(exit_status)
cookiecutter.exceptions.FailedHookException: Hook script failed (exit status: 1)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.