https://github.com/arcadia-science/arcadia-pycolor
Python package for styling plots according to Arcadia's style guide
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.0%) to scientific vocabulary
Keywords
Repository
Python package for styling plots according to Arcadia's style guide
Basic Info
- Host: GitHub
- Owner: Arcadia-Science
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://arcadia-science.github.io/arcadia-pycolor/
- Size: 70.3 MB
Statistics
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 12
- Releases: 8
Topics
Metadata Files
README.md
arcadia-pycolor
This repo contains a Python package called arcadia_pycolor that provides tools for styling Matplotlib, Seaborn, and Plotly figures to comply with Arcadia's style guide.
Installation
The package is hosted on PyPI and can be installed using pip:
bash
pip install arcadia-pycolor
Usage
Please see the quickstart guide for Matplotlib or Plotly for an introduction to the package, as well as how to use it to style plots.
For detailed documentation about the package and links to example plots, see the documentation README.
Development
Environment setup
We use poetry to manage dependencies and packaging. First, create a new conda environment and install poetry:
bash
conda env create -n arcadia-pycolor -f envs/dev.yml
conda activate arcadia-pycolor
Then, install dependencies, including the development dependencies:
bash
poetry install --no-root --with=dev
Finally, install the package in editable mode:
bash
pip install -e .
Testing
We use pytest for testing. The tests are found in the arcadia_pycolor/tests/ subpackage. To run the tests, simply run pytest from the root directory of the repository.
Some of the tests generate plots whose correctness is difficult to validate programmatically. Therefore, when changes are made to the style defaults or to the auto-styling methods in arcadia_pycolor.mpl, it is important to manually inspect these plots to verify that no unintended changes have been introduced. To do so, there is a custom --output-dirpath pytest option that can be used to save the test plots to a local directory. For example, to save the test plots to a directory called test-outputs, run:
bash
pytest --output-dirpath ./test-outputs
The directory passed to --output-dirpath will be created if it does not already exist and will be overwritten if it does exist. The test plots will be saved in this directory as PDF files with the same names as the test functions that generated them. The tests are parametrized by the pre-defined figure sizes in arcadia_pycolor.style_defaults, so there will be one file for each test and each figure size.
Hint: you can use pytest's -k option to filter the tests that are run if you only need to generate certain plots. This can be convenient for faster feedback during development. For example, to run only the tests that generate barplots, run:
bash
pytest -k barplots --output-dirpath ./test-outputs
Updating the Jupyter notebooks
Some of the documentation is in the form of Jupyter notebooks. The inline graphical outputs of these notebooks are part of the documentation, so these notebooks are committed to the repo with their outputs included. It is therefore important to keep the notebook outputs up-to-date by re-running all of the notebooks when changes are made to the package.
Run the makefile command execute-all-notebooks to execute all the notebooks. This 1) ensures that the notebooks execute without errors and 2) updates their outputs in-place. Then, commit any modified notebooks to the repo.
Publishing a new version of the package on PyPI
Publishing the package on PyPI requires that you have API tokens for the test and production PyPI servers. You can find these tokens in your PyPI account settings. Copy .env.copy to .env and add your tokens to this file.
To release a new version of the package on PyPI, its version number must first be incremented.
We use git tags to define versions. When you're ready to release a new version of the package, first create a new git tag. The name of the tag should correspond to the version number, e.g. "v0.1.0". Annotate the tag with a message that describes the release, e.g. "Release version 0.1.0".
Before creating the tag, make sure that your local git repository is on main, is up-to-date, and does not contain uncommitted changes!
bash
git tag -a v0.1.0 -m "Release version 0.1.0"
git push origin v0.1.0
We use semantic versioning in which the versions have the form MAJOR.MINOR.PATCH. See here for more information.
Next, build the package:
bash
make build
You should see an output that looks like this:
Building arcadia-pycolor (0.1.0)
- Building sdist
- Built arcadia_pycolor-0.1.0.tar.gz
- Building wheel
Make sure that the version number matches the one from the git tag that you just created. If it does not, double-check that you created the git tag correctly. If the version number is 0.0.0, this indicates that Poetry is failing to infer any version number at all. Check that you are in the correct conda environment and that you have installed the dev dependencies using poetry install --no-root --with=dev.
Next, test that you can publish the package to the PyPI test server:
bash
make build-and-test-publish
This command calls poetry build to build the package and then poetry publish to upload the build artifacts to the test server.
Note: the build artifacts are also written to the dist/ directory.
Check that you can install the package from the test server:
bash
pip install --index-url https://test.pypi.org/simple/ arcadia-pycolor
If everything looks good, build and publish the package to the prod PyPI server:
bash
make build-and-publish
Finally, check that you can install the package from the prod PyPI server:
bash
pip install arcadia-pycolor
Owner
- Name: Arcadia Science
- Login: Arcadia-Science
- Kind: organization
- Location: United States of America
- Website: https://www.arcadiascience.com/
- Twitter: ArcadiaScience
- Repositories: 16
- Profile: https://github.com/Arcadia-Science
GitHub Events
Total
- Create event: 23
- Release event: 3
- Issues event: 27
- Watch event: 2
- Delete event: 18
- Issue comment event: 46
- Push event: 127
- Pull request review comment event: 49
- Pull request review event: 55
- Pull request event: 28
Last Year
- Create event: 23
- Release event: 3
- Issues event: 27
- Watch event: 2
- Delete event: 18
- Issue comment event: 46
- Push event: 127
- Pull request review comment event: 49
- Pull request review event: 55
- Pull request event: 28
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 18
- Total pull requests: 14
- Average time to close issues: 4 months
- Average time to close pull requests: 3 days
- Total issue authors: 5
- Total pull request authors: 3
- Average comments per issue: 0.39
- Average comments per pull request: 1.64
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 14
- Pull requests: 14
- Average time to close issues: about 1 month
- Average time to close pull requests: 3 days
- Issue authors: 5
- Pull request authors: 3
- Average comments per issue: 0.43
- Average comments per pull request: 1.64
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mezarque (10)
- keithchev (9)
- wasimsandhu (7)
- ekiefl (4)
- ilyakolb (2)
- reillyowencooper (1)
- lanery (1)
Pull Request Authors
- keithchev (12)
- wasimsandhu (11)
- mezarque (10)
- ekiefl (5)
- lanery (2)
- wasimxyz (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 109 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 7
- Total maintainers: 1
pypi.org: arcadia-pycolor
A Python package to distribute Arcadia's color and style guidelines for figures.
- Homepage: https://github.com/Arcadia-Science/arcadia-pycolor
- Documentation: https://github.com/Arcadia-Science/arcadia-pycolor
- License: MIT
-
Latest release: 0.6.3
published 9 months ago
Rankings
Maintainers (1)
Dependencies
- colorspacious *
- matplotlib *
- numpy *
- plotly *