Skip to main content

Another uncompromising code formatter.

Project description

StraitJacket: Another Uncompromising Code Formatter

StraitJacket is a wrapper around black which implements post processing to perform automatic code alignment.

Code Style: sjfmt Type Checked with mypy Build Status Code Coverage MIT License PyCalVer v201810.0004-beta PyPI Version PyPI Wheel Supported Python Versions

Contributing

If you would like to contribute as a developer, here is how to get started with development. You will require a linux system, though WSL on Windows should work fine too.

Setup Conda

If you haven't already, install conda like so:

.. code-block:: bash

$ conda --version
conda: command not found
$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
$ bash miniconda.sh -b -p $HOME/miniconda
$ export PATH="$HOME/miniconda3/bin:$PATH"
$ conda --version
conda 4.5.11

Setup Virtual Environments

Next you can do make install to setup local conda environments.

.. code-block:: bash

$ make install
Solving environment: done

## Package Plan ##

  environment location: /home/user/miniconda3/envs/sjfmt37
...

Development Tasks

This creates environments named for the supported python versions of the project. Finally you can run your typical development commands:

.. code-block:: bash

$ make lint         # run sjfmt and flake8
$ make mypy         # mypy src/
$ make test         # pytest test/
$ make devtest      # pytest test/ --verbose --exitfirst
$ make doc          # rst2html5

Distributing

.. code-block:: bash

make bump_version
make build
make upload

Project Structure

For most things you can review this guide: https://docs.python-guide.org/writing/structure/

One main difference is the use of src/ as a top level directory to contain all library source code. This is done because the PYTHONPATH always has the current directory as its first entry and so import module will always look for module in PWD first. This is fine when testing during develpment, because that's actually where the source is that you want to test. If you want to test a distribution however, you may think everything is fine, because you ran pip install . or pip install dist/...whl, and running your tests everything is green. In reality you will not be testing the installed module though, but rather the source from your local directory.

Using a src/ directory avoids this problem. You have to be explicit about your PYTHONPATH (as make test is for example), and you will always be testing what you expect.

Changelog for straitjacket

v201809.0001-alpha

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

straitjacket-201810.4a0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

straitjacket-201810.4a0-py2.py3-none-any.whl (10.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file straitjacket-201810.4a0.tar.gz.

File metadata

  • Download URL: straitjacket-201810.4a0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for straitjacket-201810.4a0.tar.gz
Algorithm Hash digest
SHA256 019e2f0544b6c0333f5a8defded17b448ef829f73c266667735a99b3f4f0aa32
MD5 77602303725628dcf68584990032b4af
BLAKE2b-256 34c201936293b832b6632bbf4e1fca888bc2bb5093139b1b90cde28f245f4690

See more details on using hashes here.

File details

Details for the file straitjacket-201810.4a0-py2.py3-none-any.whl.

File metadata

  • Download URL: straitjacket-201810.4a0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for straitjacket-201810.4a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 46328715539cec0a7a8e6f37852142aa34553f3ee03d7b225ec94876f129b4bc
MD5 0f3cf103e655a09aea379af8cbc2484a
BLAKE2b-256 8d561bb507de3fc0e5b0303c0df63f0dd37cd12b2965d2b6b5dd88ee4f05a65f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page