Skip to content

Commit

Permalink
Merge pull request #207 from InsightLab/developer
Browse files Browse the repository at this point in the history
Bump version: 2.7.2 → 3.0.0
  • Loading branch information
mxaviersmp authored Jul 14, 2021
2 parents 2caf35f + b306e75 commit ee5b682
Show file tree
Hide file tree
Showing 64 changed files with 8,510 additions and 8,108 deletions.
10 changes: 0 additions & 10 deletions .bumpversion.cfg

This file was deleted.

8 changes: 7 additions & 1 deletion .code-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ We following the [Numpy](https://numpydoc.readthedocs.io/en/latest/format.html)
## flake8

Flake8 is a python linter that helps to keep the code up to PEP standards.

## mypy

Mypy is a static type checker for python

To lint the code, run: `make lint`

## Pre-Commit
Expand Down Expand Up @@ -85,13 +90,14 @@ pymove/core/dataframe.py:970:29: E711 comparison to None should be 'if cond is N

- Don't commit to branch: Doesn't allow direct commits to `master` branch.

- seed isort known_third_party: Populates the `.isort.cfg` file.

- isort: Sorts the imports.

- flake8: Ensures that the code follows `pylint` and `pyflakes` guidelines.
It will point the errors in the code.

- mypy: Performs type checking.
It will point the errors in the code.
---

## Codacy
Expand Down
230 changes: 107 additions & 123 deletions .deployment-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,101 +10,85 @@

The link in this tutorial will explain the steps to upload a package to pypi: <https://dzone.com/articles/executable-package-pip-install>

#### Get started with Travis CI

1. Sing up on Travis-ci with GitHub.

2. Accept the authorization of Travis CI.

3. Click on your profile picture in the top right of your Travis Dashboard,
click the green Activate button, and select the repositories
you want to use with Travis CI.

4. Add a .travis.yml file to your repository to tell Travis CI what to do.

#### Use the .travis.yml file to configure your deploy

5. Create an API token to authenticate with PyPI:
1. In your Pypi account settings, go to API tokens section and
select "Add API token"

2. Add the token to the Github Actions Secret.

6. Create a github action with the following content:
```yaml
name: Publish to PyPI
on:
push:
tags:
- "*"

jobs:
build-n-publish:
if: github.event.base_ref == 'refs/heads/<branch-for-deploy>' && startsWith(github.ref, 'refs/tags')
name: Build and publish package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade "pip<20"
pip install -r requirements-dev.txt
- name: <optional step to lint and test the code>
run: |
flake8
pytest
- name: Build
run: |
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
```
#### Use Github Actions to deploy

1. Create an API token to authenticate with PyPI:
- In your Pypi account settings, go to API tokens section and select "Add API token"

- Add the token to the Github Actions Secret.

2. Create a github workflow with the following content:
```yaml
name: Publish to PyPI
on:
push:
tags:
- "*"

jobs:
build-n-publish:
if: github.event.base_ref == 'refs/heads/<branch-for-deploy>' && startsWith(github.ref, 'refs/tags')
name: Build and publish package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make dev
- name: <optional step to lint and test the code>
run: |
make lint
make test
- name: Build
run: |
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
```
#### Configure bump2version
For the versioning control we a using the package bump2version.
1. Run `pip install bump2version` in your environment
2. Add the following attributes to the .bumpversion.cfg file:
```yaml
[bumpversion]
current_version = <version_number>
allow_dirty = True
tag_name = version-{new_version}
tag = True
commit = True
[bumpversion:file:<path_to_file_version_file>]
2. Add the following attributes to the setup.cfg file:
```conf
[bumpversion]
current_version = <version_number>
allow_dirty = True
tag_name = version-{new_version}
tag = True
commit = True
[bumpversion:file:<path_to_file_version_file>]
[bumpversion:file:<path_to_setup_file>]
```

***Note:*** If `NotADirectoryError: [Errno 20] Not a directory`,
check <https://github.com/c4urself/bump2version/issues/139> for a fix.

#### For more information see these links

- <https://docs.travis-ci.com/user/tutorial/>
- <https://docs.travis-ci.com/user/deployment/pypi/>
- <https://github.com/c4urself/bump2version>

---

### Deploy the package using Travis CI

1. Run the command `bumperversion [major|minor|patch]` to increase the
version number. This will create a new tag and commit the changes.
1. Run the command `bumperversion [major|minor|patch]` to increase the version number.
This will create a new tag and commit the changes.

2. Push the changes to the developer branch.

3. Create a pull request onto master. To deploy pymove to Pypi using
you must be in the master branch, Travis was configured to only allow
deployments from tagged commits on the master branch.
you must be in the master branch, pushing a tagged commit.

4. After merging the new version into the master branch, push the new
tag created by bump2version.
Expand Down Expand Up @@ -133,76 +117,76 @@ With the package published to Pypi, we can easily deploy to the

2. Now add some information to the `<package_name>/meta.yaml` file.
```yaml
{% set name = <package_name> %}
{% set version = <package_version> %}
package:
name: "{{ name|lower }}"
version: "{{ version }}"
source:
url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz"
sha256: <package_version_sha256>
build:
number: 0
script: "{{ PYTHON }} -m pip install . -vv"
noarch: python
requirements:
host:
- pip
- python >=3.6
run:
- <package_requirements>
- python >=3.6
test:
imports:
- <all_possible_imports>
about:
home: <repository_url>
license: <licence>
license_family: <licence_family>
license_file: <path_to_licence_file>
summary: <package_summary>
doc_url: <package_docs_url>
dev_url:
extra:
recipe-maintainers:
- <your_github_username>
- <other_package_maintainers>
{% set name = <package_name> %}
{% set version = <package_version> %}
package:
name: "{{ name|lower }}"
version: "{{ version }}"
source:
url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz"
sha256: <package_version_sha256>
build:
number: 0
script: "{{ PYTHON }} -m pip install . -vv"
noarch: python
requirements:
host:
- pip
- python >=3.6
run:
- <package_requirements>
- python >=3.6
test:
imports:
- <all_possible_imports>
about:
home: <repository_url>
license: <licence>
license_family: <licence_family>
license_file: <path_to_licence_file>
summary: <package_summary>
doc_url: <package_docs_url>
dev_url:
extra:
recipe-maintainers:
- <your_github_username>
- <other_package_maintainers>
```

1. All package run requirements must be avaiable in the conda-forge channel.
All package run requirements must be available in the conda-forge channel.

#### Request the publication to the conda-forge channel

2. Fork the example recipes repository at <https://github.com/conda-forge/staged-recipes>
1. Fork the example recipes repository at <https://github.com/conda-forge/staged-recipes>

3. Copy the `<package_name>/meta.yaml` file created in the step above to
2. Copy the `<package_name>/meta.yaml` file created in the step above to
the forked repo `staged-recipes/recipes/example` directory

4. Push the changes to your forked repository.
3. Push the changes to your forked repository.

5. Make a pull request for your repository to the master branch on
4. Make a pull request for your repository to the master branch on
the stage-recipes repository.
- `conda-forge:master from <your_github_username>:<package_name>`

6. Now, the pull request will be checked.
- Comlete the checklist for the pull requests.
5. Now, the pull request will be checked.
- Complete the checklist for the pull requests.

- The recipe meta.yaml file will be checked by the `conda-forge-linting service`.

- The recipe will be built for `linux64`, `macos64`
and `windows64` systems.

7. If there are any problems with the PR, a review team member will give
6. If there are any problems with the PR, a review team member will give
you feedback, pointing out improvements and answering questions.

8. Once everything is in order, the pull request will be aproved.
7. Once everything is in order, the pull request will be aproved.

---

Expand Down
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

53 changes: 21 additions & 32 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,26 @@ name: Lint and Test
on: [push]

jobs:
lint:
name: Code Linting
lint-test:
name: Lint and Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9']
steps:
- uses: actions/checkout@main
- name: Set up Python 3.7
uses: actions/setup-python@main
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make dev
- name: Lint
working-directory: ${{ github.workspace }}
run: |
make lint
test:
name: Code Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Set up Python 3.7
uses: actions/setup-python@main
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make dev
- name: Test
working-directory: ${{ github.workspace }}
run: |
make test
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make dev
- name: Check code style
working-directory: ${{ github.workspace }}
run: |
make lint
- name: Runs unit tests
working-directory: ${{ github.workspace }}
run: |
make test
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ repos:
'flake8-docstrings==1.6.0',
'pep8-naming==0.11.1'
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.812'
hooks:
- id: mypy
Loading

0 comments on commit ee5b682

Please sign in to comment.