python nixpkgs tools
These are scripts written to remove the tedious nature of creating nix package derivations for nixpkgs. The goal of these scripts is not to create a perfect package derivation but complete as much as possible and guide the user on necessary changes.
python-package-init
usage: python-package-init [-h] [--version VERSION] [--filename FILENAME] [--stdout] [--nixpkgs-root NIXPKGS_ROOT] [-f] package
positional arguments:
package pypi package name
optional arguments:
-h, --help show this help message and exit
--version VERSION pypi package version (stable if not specified)
--filename FILENAME filename for nix derivation
--stdout Print the nix derivation to stdout
--nixpkgs-root NIXPKGS_ROOT
Root directory of nixpkgs
-f, --force Force creation of file, overwriting when it already exists
python-package-init now has the ability to create a <package-name> = callPackages ../...<package-name> { }; in
pkgs/top-level/python-modules.nix and write the default.nix to
pkgs/development/python-modules/<package-name>/default.nix with a
nearly complete derivation.
Example lets add nixpkgs-pytools to nixpkgs. It is already in
nixpkgs so you would need to provide the -f (force) option to force
it to be written to nixpkgs.
nix-shell -p nixpkgs-pytools
python-package-init nixpkgs-pytools --nixpkgs-root=<path to nixpkgs>
Creates a default.nix derivation to go into
nixpkgs/pkgs/development/python-modules/<pypi-name>/default.nix. This
script is overly verbose so that you don't have to remember the name
of attributes. Delete the ones that you don't need.
python-rewrite-imports
usage: python-rewrite-imports [-h] --path PATH [--replace REPLACE REPLACE]
optional arguments:
-h, --help show this help message and exit
--path PATH path to refactor imports
--replace REPLACE REPLACE
module import to replace
example rewriting airflow imports
nix-shell -p nixpkgs-pytools
cd /tmp
wget https://github.com/apache/airflow/archive/master.tar.gz
tar -xf master.tar.gz
python-rewrite-imports --path /tmp/airflow-master \
--replace flask_appbuilder flask_appbuilder_1_13_6237336a2b92fa6ba5f7f14dda56c08af6c0a76a \
--replace pendulum pendulum_1_4_4_55011d302b80c60360e2cc9f3a5ace7336c727c7
grep -R pendulum /tmp/airflow-master
You'll notice that all imports have been rewritten. Rewrites are done via rope a robust refactoring library used by many text editors.
Hacking on these tools
nix-shell will load the correct environment for your usage:
nix-shell
Metadata
Release files for nixpkgs-pytools 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nixpkgs-pytools-1.3.0.tar.gz | 11.9 kB | Without provenance | Details for nixpkgs-pytools-1.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nixpkgs_pytools-1.3.0-py3-none-any.whl | Python 3 | none | any | Details for nixpkgs_pytools-1.3.0-py3-none-any.whl |
Total release size: 25.7 kB
Release files / nixpkgs-pytools-1.3.0.tar.gz
| Download URL | nixpkgs-pytools-1.3.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29585690d2fd1d09d218bbb28b9f5f0b4e75c97271c622d36638391ae2625387
|
|
BLAKE2b-256 checksum How to use checksums |
ec1a3f01a58ee79d657e6f083b5a351742338db77926035a7f896c6ee57bf61b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1
|
Release files / nixpkgs_pytools-1.3.0-py3-none-any.whl
| Download URL | nixpkgs_pytools-1.3.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86f1a200b7de80cc0951179ceca37489d7a6078989b06fb4eb28108087b1bbc8
|
|
BLAKE2b-256 checksum How to use checksums |
7a26a16adc8e2e8ed4e02cbe0b0e6a860eed8d0554c4fdf234c4c0a6e8291dfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1
|
Security for nixpkgs-pytools 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.