📝 Edit page
➕ Add page
Python
Topics
Built-ins
Configs
Files and paths
Formatting
Install
Libraries
Linting
Project administration
Strings
Type checks
Pages
- Argument parsing
- Browser
- CLI
- Challenges
- Conditionals
- Copy
- Databases
- Delete
- Environment
- Exceptions
- Get value with fallback
- Hash
- Input
- Logging
- Looping
- Numbers
- Pitfalls
- Pre-commit
- Random
- Resources
- Shell
- Slicing
- Sorting
- Split a list into equal-sized chunks
- Tests
- Time handling
- Virtual environments
Content
Some useful commands, boilerplate code from my existing projects or things to use in new development.
Related
- Python package managers - how to use tools like
pip
andpoetry
to install Python packages. - Python pip versions - how pip uses version numbers
- Python recipes in my Code Cookbook.
Other cheatsheets
- Python Cheatsheet website
Installing dependencies and installing your package
It uses requirement.txt
and pip
which are the traditional/common choices. And setup.cfg
as from my research that is also the popular/modern way to go. Use requirements-lock.txt
if you care about subdependencies.
If you care about installing your project itself (not just its dependencies), so it can be installed by others for example, only then do you need to worry about setup.py
.
See my installable package here:
Or
setup.py
#!/usr/bin/env python """ Install my-app. """ import setuptools setuptools.setup()
Some tools like poetry need pyproject.toml
.
And if using Pipenv then use Pipfile
and Pipfile.lock
.