![]() # This file is autogenerated by pip-compile $ pip-compile -output-file=- > requirements.txt Use pip-compile to generate requirements.txt.Specify your application/project's direct dependencies your requirements.in file:.Create a virtual env and install pip-tools there.Here's my recommended steps in constructing your requirements.txt (if using requirements.in): ![]() The pip-compile command lets you compile a requirements.txt file from your dependencies, specified in either setup.py or requirements.in This will make sure that builds are predictable and deterministic. text( " \n".I believe using pip-compile from pip-tools is a good practice when constructing your requirements.txt. ![]() asgi import Response import os REDACT = ". "expose_some_environment_variables = datasette_expose_some_environment_variables"Īnd a datasette_expose_some_environment_variables.py file containing the actual plugin: from datasette import hookimpl from datasette. Name = "datasette-expose-some-environment-variables",ĭescription = "Expose environment variables in Datasette at /-/env", That Gist has two files-a setup.py file containing the following: from setuptools import setup VERSION = "0.1" setup( Then pass that to pip install or datasette install to install it. You can right click and copy link on the “Download ZIP” button to get this URL: Here’s an example Gist containing my datasette-expose-some-environment-variables plugin. This means it’s possible to create and host a full Python package just using a Gist, by packaging together a setup.py file and one or more Python modules. This isn’t as useful as checking out the code directly, since it’s harder to review the code in a text editor-but it’s useful knowing it’s possible. I can install that in a fresh environment on my machine using: pip install This is a new trick I discovered this morning: there’s a hard-to-find URL that lets you do the same thing for code in pull requests.Ĭonsider PR #1717 against Datasette, by Tim Sherratt, adding a -timeout option the datasette publish cloudrun command. Then in my requirements.txt file I drop in a URL to the fix in my own repository-with a comment reminding me to switch back to the official package as soon as they’ve applied the bug fix. I create a fork on GitHub, apply my fix and send a pull request to the project. I sometimes use this trick when I find a bug in an open source Python library and need to apply my fix before it has been accepted by upstream. But if you don’t want to remember or look them up you can instead find them using the Code -> Download ZIP menu item for any view onto the repository: That last option, installing for a specific commit hash, is particularly useful in requirements.txt files since unlike branches or tags you can be certain that the content will not change in the future.Īs you can see, the URLs are all predictable-GitHub has really good URL design.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |